Help with a desktop changer script

:confused:

I need some help with a script that I’m trying to create to change the desktop pattern on my computer from the blue I normally have to a nuetral grey for photo editing. I did get a little bit of help with this a while back, but got side tracked and I’m now trying to finish the script.

Ideally I’d also like to create a script to change the pattern back to the particular colour that I like to have when I’m not photo editing.

So far the code I’ve got reads like this:

tell application “Finder”
activate
select window of desktop
select window of desktop
tell application “System Preferences”
activate
end tell
tell application “System Events”
tell process “System Preferences”
click menu item “Desktop & Screen Saver” of menu “View” of menu bar 1
delay 2
tell window “Desktop & Screen Saver”
if (exists tab group 1) then
tell tab group 1
click radio button “Desktop”
delay 2
click radio button “Solid Colors”
delay 2
select “Solid Aqua Graphite”
end tell
end if
end tell
end tell
end tell
end tell

The only problem is that the script stalls when it get to the line, click radio button “Solid Colors”, when a dialog box appears with the message, ‘System Events got an error: NSReceiverEvaluationScriptError: 4

Thanks in advance for any help people are able to give me with this problem.

:smiley:

Hi,

why not the direct way?

set AquaGraphite to (path to desktop pictures folder as Unicode text) & "Solid Colors:Solid Aqua Graphite.png"
tell application "Finder" to set desktop picture to file AquaGraphite