Applescript to change system's highlight color?

Hi,

I was wondering if there is a simple script that I could use to change the system highlight color? I have my favorite highlight color which I use most of the time, except for one application which makes it hard to see the color because of its non-standard interface. Instead of always having to go to the System Preferences before launching this application, I’d like to use an applescript that could automatically change the higlight color when launching the app (I have Keyboard Maestro, which can run an applescript automatically when launching any specific application).

Seems like it should be pretty basic, but I know absolutely nothing about Applescript, so I would very much appreciate some help. A search did not return any info on this (I guess it’s TOO basic and nobody else needs to do this). :slight_smile:

Thanks in advance.

Hi,

there are two ways to do this
First with GUI scripting (Enable access for assistive devices in PrefPane “Universal access” must be enabled)
for example

tell application "System Preferences" to reveal anchor "Main" of pane id "com.apple.preference.general"

tell application "System Events"
	tell pop up button 1 of window 1 of process "System Preferences"
		click
		pick menu item "Red" of menu 1
	end tell
end tell
quit application "System Preferences"

disadvantage: System Preferences must be opened

or directly by writing into the plist file

do shell script "defaults write .GlobalPreferences AppleHighlightColor '1.000000 1.000000 0.000000'" -- yellow
tell application "Finder"
	quit
	delay 1
	launch
end tell

disadvantage: the Finder must be restarted to apply the changes

Thanks Stefan! Works like a charm.