View Full Version : A plea to the applescripting gods.

Aug 14, 2006, 03:35 AM
I'm not going to lie to you, I'm not a coder. The closest thing to coding I get is webdesign and the most basic actionscripting.

Right now I'm trying to make a Automator workflow for graphic design which will switch the system appearance to "graphite", the highlight color to "silver", and the desktop picture to a custom neutral background that I made. This way when working on a project for hours on end, I'll be [less] influenced by OSX's bright colors. As far as I can tell, the only thing automator can do is change the desktop picture. I was hoping to get arround this shortcoming by finding some sort of applescript I could run to switch the appearance prefrences, but after hours of googling I have found none. If any of you amazing people could help me out, that would be absolutely amazing :o

Thanks in advance!

Aug 14, 2006, 04:17 AM
As far as I know the only way to set the appearance settings is with GUI scripting. While it works, it is slow and likely to break in future versions of Mac OS X (the script will need slight modifications to continue working if the interface of the Appearance preferences pane changes). You also need to turn on the "Enable access for assistive devices" option in the Universal Access pane in System Preferences for it to work.

The code below should work on Mac OS X 10.4.7. Set the properties at the top to your desired settings.

property desktopPicture : "/Library/Desktop Pictures/Aqua Graphite.jpg"
property appearance : "Graphite"
property highlightColor : "Silver"

--Set the desktop picture
tell application "Finder"
set desktop picture to file (POSIX file desktopPicture as string)
end tell

--Open the Appearance pane of System Preferences
tell application "System Preferences"
set current pane to pane "com.apple.preference.general"
reveal (first anchor of current pane whose name is "output")
end tell

tell application "System Events"
tell window 1 of process "System Preferences"
tell pop up button 2
click menu item appearance of menu 1
end tell
delay 1

--Highlight color
tell pop up button 1
click menu item highlightColor of menu 1
end tell
end tell
end tell

tell application "System Preferences" to quit

Aug 14, 2006, 02:24 PM
Thank you so much! That's exactly what I was trying to do~:cool: