Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Use an AppleScript to force a desktop picture change' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use an AppleScript to force a desktop picture change
Authored by: allentown on Mar 14, '10 06:00:33PM

I am not sure why this has to be so verbose and complicated. I made a simple script that has been tested on Snow Leopard.

It assumes that you have
[X] "change picture ever x timesteps"
[X] Random Order

My current settings are 15 minutes, but I find the randomizer to lean on the edges, never giving me pictures from the middle.

tell application "System Events"
	tell current desktop
		set initInterval to get change interval -- get the currrent display interval
		set change interval to -1 -- force a change to happen right now
		set change interval to initInterval -- change it back to the original display interval
	end tell
end tell

What this does is gets the current setting of your change interval in seconds, so my 15 minutes will return 900. That is set to a variable of initInterval. I then set the change interval to -1, which will force an immediate change of the desktop image. Finally, I set it back to the original change interval.

I have tied this to an action in LaunchBar. And you may find that at times it is not set back to your original change interval. You can add in a "Delay 3" to right before the line that sets it back to the original change interval, which will solve that.

For me, LaunchBar will be stuck for that 3 seconds, which bothers me, so I sick with it, and if I see my desktop image changing repeatedly, I know to go fix it.

[ Reply to This | # ]