Re: Scripting UI elements with the new System Events.app
Re: Scripting UI elements with the new System Events.app
- Subject: Re: Scripting UI elements with the new System Events.app
- From: "Kinsella, John R." <email@hidden>
- Date: Fri, 3 Jan 2003 20:54:18 -0600
Ahh!
I didn't figure out the Radio group portion of the heiarchy. That
makes perfect sense! Can't wait for PreFab UI Browser!
Thanks!!
John K
>
Message: 15
>
Date: Fri, 03 Jan 2003 15:47:23 -0500
>
Subject: Re: Scripting UI elements with the new System Events.app
>
From: Bill Cheeseman <email@hidden>
>
To: AppleScript-Users Mail <email@hidden>
>
>
on 03-01-03 2:38 PM, Kinsella, John R. at email@hidden wrote:
>
>
> Basically I'm working on a setup assistant for our standard image. It's
>
> working well but I'm having trouble selecting an item in a scroll box,
>
in
>
> this case, in the Screen Effects window, trying to set the standard
>
screen
>
> saver. I can't seem to get access to the list of screen savers.
>
>
If you mean you can't find the list, this sounds like a job for PreFab UI
>
Browser, announced Wednesday and scheduled to ship in about two weeks
>
(www.prefab.com).
>
>
The containment hierarchy of the screen saver names is as follows,
>
according
>
to UI Browser, using the lingo of the accessibility API on which GUI
>
Scripting is based:
>
>
AXApplication "System Preferences"
>
AXWindow "Screen Effects"
>
AXTabGroup [the tab view]
>
AXBrowser [a 1-column browser]
>
AXScrollArea [the scroller holding column 1]
>
AXRadioGroup [column 1 of the browser]
>
AXStaticText [1 of several siblings, eg., "Computer Name", "Flurry"]
>
>
The name of each screen saver is the AXValue attribute of the AXStaticText
>
item.
>
>
With this information about the hierarchy, you should be able to get the
>
names of the screensavers using this script (watch out for word wrap in
>
the
>
third line):
>
>
tell application "System Events"
>
tell process "System Preferences"
>
get every static text of radio group 1 of scroll area 1 of browser 1
>
of
>
tab group 1 of window "Screen Effects"
>
end tell
>
end tell
>
>
The result on my machine is a list of the named static text items, or
>
screensavers, as expected.
>
>
If you mean instead that you can't set the value of the column to a
>
specific
>
screen saver, testing with UI Browser suggests that GUI Scripting may have
>
a
>
bug in this context. In UI Browser's browser window, I can click on the
>
cell
>
representing one of the screensavers -- for example, "Flurry" -- and
>
change
>
its AXFocused attribute to true by clicking a checkbox, and by golly
>
Flurry
>
is instantly selected in System Preferences. However, the equivalent
>
script
>
gets a "System Events got an error: NSInternalSCriptError" error message
>
in
>
Script Editor 2.0 beta.
>
>
The first script I tried was like the one above, but with this third line
>
(watch out for word wrap):
>
>
set focused of static text "Flurry" of radio group 1 of scroll area 1 of
>
browser 1 of tab group 1 of window "Screen Effects" to true
>
>
The second script I tried was identical, except it used 'selected' instead
>
of 'focused', on the theory that GUI Scripting's 'selected' is a synonym
>
for
>
'focused'. This didn't generate an error, but it didn't work, either.
>
>
Since this doesn't work in GUI Scripting but the equivalent technique does
>
work in UI Browser, I would suggest that GUI Scripting is broken here. But
>
perhaps someone can find a workaround.
>
>
--
>
>
Bill Cheeseman - email@hidden
>
Quechee Software, Quechee, Vermont, USA
>
http://www.quecheesoftware.com
>
>
The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
>
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
>
Croquet Club of Vermont - http://members.valley.net/croquetvermont
>
>
>
--__--__--
>
>
_______________________________________________
>
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.
>
>
>
End of applescript-users Digest
_______________________________________________
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.