Scripting energy saver panel with SystemEvents
Scripting energy saver panel with SystemEvents
- Subject: Scripting energy saver panel with SystemEvents
- From: Michel Binkhorst <email@hidden>
- Date: Tue, 28 Jan 2003 16:59:49 +0100
Hi all,
I'm trying to accomplish the following:
I've made a script(source below) that sets the energy saver panel to either
let the display sleep after 1 minute or (if it is set to sleep) disable this
feature (uncheck "use separate time..etc).
Works as I expected it to work, except for one thing;
When I run the script and it closes system preferences, it has set the
options the way I wanted to. When I then re-open system preferences it has
set the 'use separate time..' slider to "never" instead of to one minute.
I'm using SystemEvents and here is my script(lines wrap):
---
tell application "System Preferences"
activate
end tell
tell application "System Events"
tell process "System Preferences"
click menu item "Energy Saver" of menu "View" of menu bar 1
delay 3
tell window "Energy Saver"
tell tab group 1 of group 1
click radio button "sleep"
if the value of check box "Use separate time to put the
display to sleep" = 0 then
click check box "Use separate time to put the display to
sleep"
set value of slider 2 to 1.0
else
click check box "Use separate time to put the display to
sleep"
end if
end tell
end tell
end tell
end tell
ignoring application responses
tell application "System Preferences" to quit
end ignoring
---
Any ideas why this doesn't work?
Also this is my first applescript, if you see any clumsy stuff, please let
me know :)
Regards,
Michel Binkhorst
--
. . . .
. Headland Interaction Design
. Entrepotdok 65 1018 AD Amsterdam
. . t. 020 626 01 21
. . f. 020 470 74 70
. . e. email@hidden
--------------------------------------------
"...true art lies in the mix."
- Lev Manovich,'The Language of New Media'
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.