Hello all…
I wrote this script a while ago for my mother, so that she could easily choose between directories of “winter”, and “summer” images for her desktop, during the appropriate times of year. It worked fine on her iMac…
I just got a 30" monitor, so I wanted to set it up on my system so that I could easily change the images for my two individual monitors… Anyway, I am noticing that on my G5 dual 2.5ghz desktop, system preferences freaks out when the desktop images are moved-- and it stops displaying them (if it’s set to change every X amount of time)… Weird though that it worked fine on the iMac…
Anyway, I was wondering if anyone had any suggestions on maybe a unix command to kill something to force system preferences to rescan the current chosen directory, or if anyone has a better solution on how to achieve this sort thing.
So the way my directories are structured (if it’s not clear)… I have a folder inside pictures called Desktop Images, and a sub directory in there called Script Choices which holds various folders of images… Then I have system preferences set to point at a folder called “cinemadisplay”… I made a duplicate of this script and just changed that location “hitachidisplay” for my 17" monitor…
Here is the script:
tell application "Finder"
set thetarget to ""
set contentlist to {}
set homepath to path to home folder from user domain as string
set foldername to homepath & "Pictures:Desktop Images:Script Choices" as alias
set activetarget to homepath & "Pictures:cinemadisplay" as alias
set folderlist to every folder in foldername
set namelist to {}
set x to 0
repeat with currentfolder in folderlist
set x to x + 1
if name of currentfolder contains "(in use)" then
set thetarget to item x of folderlist
else
if name of currentfolder does not contain "cinemadisplay" and name of currentfolder does not contain "iPhoto" then
copy name of item x of folderlist to end of namelist
end if
end if
end repeat
set thesource to choose from list namelist with prompt "Choose the folder you want to use for your Desktop images"
if thesource = false then
display dialog "have a nice day!" buttons {"you too!"}
return
end if
set thesource to ((foldername as string) & thesource) as alias
if thetarget ≠"" then
move items of activetarget to thetarget
set removedinuse to the name of thetarget
set removedinuse to (characters 1 thru -10 of removedinuse) as Unicode text
set name of thetarget to removedinuse
end if
set name of thesource to name of thesource & " (in use)"
move items of thesource to activetarget
end tell