Re: GUI scripting beta in OS 10.2--sliders
Re: GUI scripting beta in OS 10.2--sliders
- Subject: Re: GUI scripting beta in OS 10.2--sliders
- From: "Cory Forsyth" <email@hidden>
- Date: Fri, 6 Feb 2004 12:40:36 -0700
This is what I've got:
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 4
tell window "Energy Saver"
if (exists (button "Show Details")) then
click button "Show Details"
end if
-- need to make sure we're on the right "optimize energy settings" setting and
-- the right "settings for:" setting...check this later
click radio button "Sleep" of tab group 1 of group 1
delay 1
set value of slider 1 of tab group 1 of group 1 to 901.0
delay 1
if (value of check box "Use separate time to put the display to sleep" of tab
group 1 of group 1 is equal to 0) then
click check box "Use separate time to put the display to sleep" of tab group
1 of group 1
end if
set value of slider 2 of tab group 1 of group 1 to 422
delay 1
end tell
end tell
end tell
--
Cory Forsyth
email: cforsyth [at] alum [dot] pomona [dot] edu
email: cforsyth [at] singingtree [dot] com
---------- Original Message -----------
From: Robert Poland <email@hidden>
To: "Cory Forsyth" <email@hidden>
Sent: Fri, 6 Feb 2004 11:06:33 -0700
Subject: Re: GUI scripting beta in OS 10.2--sliders
>
>I'm trying to create an applescript that sets the energy saver preferences. I
>
>have it so far so that it will launch Energy Saver from w/in System
>
>Preferences, and I can even have it move the sliders. I use "set value of
>
>slider 1 of tab group 1 of group 1 to 901.0" to set the first slider all the
>
>way to the right, "never", for example.
>
>
>
>But I find that when I quit system preferences, the prefs never stick.
>
>
>
>I also notice that when the script does its work, the text appears slightly
>
>above and to the right of the slider that says "1 minute, 2 minutes, 3 minutes
>
>... never" stays visible. If you use the mouse to drag the slider, that text
>
>only appears while you're dragging the slider.
>
>
>
>It seems that the visibility of that text is tied somehow to System Prefs
>
>saving the preferences, because if I let the script do its thing and then I
>
>grab and drag the slider very slightly, so that the text disappears when I let
>
>go of the mouse, the preferences will be saved if I quit.
>
>
>
>I've tried using "increment" to move the slider, but the same problem
>
>exists...it doesn't save the preferences.
>
>
>
>Any idea how to fix/change this? All I can think of at this point is to have
>
>the mouse click on the slider by figuring out the screen coordinates.
>
>
>
>cheers,
>
>Cory
>
>
I thought I'd play around with your concept. I
>
get the same non-sticking that you get. OS 10.3.2.
>
>
I can not seem to get the "Sleep" Tab to obey at all. Errors out
>
every time.
>
>
Here's what I am trying...
>
>
tell application "Finder"
>
set PreferencesRunning to (processes
>
whose name = "System Preferences") {}
>
if not PreferencesRunning then
>
repeat until (some process whose creator type is "sprf") exists
>
tell application "System Preferences" to activate
>
end repeat
>
end if
>
>
tell application "System Preferences" to activate
>
tell application "System Events"
>
tell process "System Preferences"
>
click menu item "Energy
>
Saver" of menu "View" of menu bar 1
>
delay 1
>
end tell
>
end tell
>
end tell
>
>
tell application "System Events"
>
tell process "System Preferences"
>
tell window 1
>
tell tab group 1
>
tell radio button
>
"Sleep" -- to if value is 0 then
>
click
>
set value
>
of slider 1 of tab group 1 of group 1 to 901 --
>
max
>
end tell
>
end tell
>
end tell
>
end tell
>
end tell
>
>
--
>
Bob Poland - Englewood, CO
>
http://www.ibrb.org/
------- End of Original Message -------
_______________________________________________
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.