Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

pathumx

macrumors member
Original poster
May 7, 2008
49
0
I have 2 macs and i'm trying to sync up the desktop backgrounds via iDisk. Unfortunately, the iDisk doesn't mount immediately so OSX goes back to the default background. In leopard just opening up system preferences to the desktop and screen savers pane fixed the problem, but that fix doesn't work in snow leopard.

I had this script in Leopard:
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.desktopscreeneffect"
quit
end tell

If i toggle the "Change Picture" checkbox off and then back on, it solves the problem. so i need a script for this, and i don't know what i'm doing.
 
It's figuring out crap like this which is why I loathe scripting with System Events.

See if this works:

Code:
tell application "System Preferences"
	activate
	set current pane to pane "com.apple.preference.desktopscreeneffect"
end tell

tell application "System Events"
	tell process "System Preferences"
		tell window "Desktop & Screen Saver"
			tell tab group 1
				click checkbox "Change picture:"
			end tell
		end tell
	end tell
end tell

And anyone who can polish this code up, feel free to point out where I went wrong. I fiddled with this thing for 20 minutes before I figured out "click button" wasn't good enough. Ugh.

mt
 
almost perfect.

i don't know how to do that nifty code box thing you did in your post, but here is the final code.

tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.desktopscreeneffect"
end tell

tell application "System Events"
tell process "System Preferences"
tell window "Desktop & Screen Saver"
tell tab group 1
click checkbox "Change picture:"
click checkbox "Change picture:"
end tell
end tell
end tell
end tell

tell application "System Preferences"
quit
end tell

i needed to uncheck and then re check it. but that was an easy fix. and then i added a quit at the end.

Thank you for the help! I need to learn how to do this. any good places to learn?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.