I wrote this script to change my monitor display sleep:
tell application "System Preferences"
activate
end tell
tell application "System Events"
get properties
tell process "System Preferences"
click menu item "Energy Saver" of menu "View" of menu bar 1
delay 2
tell slider 2 of tab group 1 of group 1 of window 1
if value is 541 then
set value to 1
else
set value to 541
end if
end tell
end tell
end tell
tell application "System Preferences"
quit
end tell
The problem is, while the slider is moved, it's as though the mouse is still held down on the slider, never lets up, therefore the value never switches (remove the quit part and realize that the "1 hour" or "1 minute" continue to display after it's set) can anyone help me figure out how to make this stick?