I am trying to run a script that access the display setting in system preferences. I almost have the script done, it is suppost to select a desktop photo file I have and set it as the desktop photo. I have one problem. There is a “text field” or “scroll bar” at the left of the window where you select the different pics. The bottom one says “choose”, so you can select the photo anywhere on the computer. Well. I cannot find anyway to click this item. It is called row 9, but I cannot click the thing. I cannot use Extra Suites for this situation. Can anyone tell me if there is a way to click this, or another way to set a picture file to the desktop picture? Thanks.
Browser: Firefox 1.0.7
Operating System: Mac OS X (10.4)
Kel,
here is what I am doing . The script you gave me works, but will not work with the JPG made from the shell script. Any idea why? Also, How can I tell it the pic name without the path? I want to use the script on different computers, so the path name will vary because the username will.
do shell script "screencapture - ~/desktop/screen01.jpg"
tell application "Finder"
set desktop picture to /Users/iandopps/Desktop/screen01.jpg
end tell
In Tiger, screen captures are PNGs, not JPGs. In Jaguar, they’re PDFs. I’ve no idea what they are in Panther.
On my machines, the picture only changes if a differently specified file is chosen. If the script’s run more than once, the dump to the file might be different, but the desktop picture won’t be changed because it’s still file “screen01.png” of the desktop. Some swapping around seems to be necessary.
The new desktop picture will only be visible if “Change picture:” isn’t checked in System Preferences’s “Desktop & Screen Saver” panel. (The picture chosen automatically by the system is displayed over the top of the picture set by the script.)
If you’re placing the file on the desktop, the Finder has its own desktop reference that you could use. (Or you could leave it out altogether, as the Finder’s default location is the desktop anyway.)
-- Tiger version with PNG files.
do shell script "screencapture ~/desktop/screen01.png"
-- Do another dump to another file.
do shell script "screencapture ~/desktop/screen02.png"
tell application "Finder"
-- Set the desktop picture to the second file, then back to the first.
set desktop picture to file "screen02.png" of desktop
set desktop picture to file "screen01.png" of desktop
delete file "screen02.png" of desktop
end tell