I’m trying to toggle the “Mirror Displays” checkbox in the system prefs.
I’m using the following that I’ve cribbed from others here on this board and I’m trying this on 10.4.3 but it doesn’t seem to work. Some check boxes don’t seem to want to respond but others do. The “Mirror Displays” checkbox seems not to want to.
any help would be greatly appreciated!
thanks
tell application "System Preferences"
activate
set current pane to pane "Displays"
tell application "System Events"
try
tell application process "System Preferences"
click radio button "Arrangement" of tab group 1 of window "Color LCD"
tell window "Color LCD"
click checkbox 1 of tab group 1 of window "Color LCD"
end tell
end tell
end try
end tell
end tell
I tried it on my wife’s eMac, but she’s running 10.3 (panther) and it can’t seem to call up the display pane. is it represented differently in panther than in Tiger?
The methods mentioned above didn’t work on my Mac Book Dual Core OS X 10.4.9 (Tiger) and latest updates.
The following line caused an Error -4 (read: Object not found) when run.
perform action "AXPress" of checkbox 1 of group 1 of tab group 1 of front window
I adapted the script as follows:
on run {input, parameters}
tell application "System Preferences"
set current pane to pane id "com.apple.preference.displays"
reveal (first anchor of current pane whose name is "displaysArrangementTab")
tell application "System Events" to tell process "System Preferences"
set frontmost to true
click checkbox "Mirror Displays" of group 1 of tab group 1 of front window
end tell
quit
end tell
return input
end run
Note: I’m a Mac user since 2 days and I seriously don’t what what I’m doing (yet). Please use this script with care.
I just wanted to contribute to this forum since it did help me a lot.