I previously wrote a script to invert the screen, but it was cumbersome in previous versions of MacOSX (although it worked perfectly fine). But in 10.5 there’s some new commands that allow for a much more elegant way to perform this task… so here’s the 10.5 way. If you’re interested, you can see the old version here: http://bbs.applescript.net/viewtopic.php?pid=82131
-- this will only work on 10.5 Leopard or later
-- this assumes the first time you run the script you screen is normal i.e. not inverted colors
-- this is a "toggle" script... it will toggle between inverted screen colors and not-inverted screen colors on successive runs
-- it will work with any number of displays you have connected to your computer.
(* How it works: when your screens are inverted, the script will store the state of your current desktops for each display you have connected to your computer. It will set the desktop picture of each display to a white image so that when inverted your desktops will appear black. When the screen is returned to normal it will restore the stored desktop settings so your desktops appears like they were before you inverted them.*)
property displayProps : {}
property is_inverted : false
property invertPic : (path to desktop pictures folder as text) & "Solid Colors:Solid White.png"
if is_inverted then
tell application "System Events"
repeat with i from 1 to count of desktops
tell desktop i
set displayName to display name
repeat with aProp in displayProps -- repeat through props to make sure you reset the proper display
if theName of aProp is displayName then
-- reset the desktop to its original values
set picture rotation to theRotation of aProp
set picture to (thePic of aProp) as file specification
exit repeat
end if
end repeat
end tell
end repeat
-- invert screens and toggle inverted state
key code 28 using {command down, control down, option down}
set is_inverted to false
end tell
else -- screens are not inverted
set displayProps to {}
tell application "System Events"
repeat with i from 1 to count of desktops
tell desktop i
-- get the display properties so you can reset them when you un-invert the screens
set end of displayProps to {theName:display name, theRotation:picture rotation, thePic:picture as text}
-- set the desktop to the invert picture and make sure the pic doesn't rotate
set picture rotation to 0
set picture to file invertPic
end tell
end repeat
-- invert screens and toggle inverted state
key code 28 using {command down, control down, option down}
set is_inverted to true
end tell
end if