Re: On the line GUI scripting
Re: On the line GUI scripting
- Subject: Re: On the line GUI scripting
- From: Bill Cheeseman <email@hidden>
- Date: Fri, 5 Mar 2010 14:16:14 -0500
On Mar 5, 2010, at 1:07 PM, Alex Zavatone wrote: I've got an app that I've been able to script pretty well through GUI scripting, but at tis base level, some controls in a window are turned on and off and I'd like to check them, but it appears that there is no provision in UI scripting to find if an individual element is on or off or displayed or not. I'm trying to see if an NSProgressIndicator is displaying progress or not.
Does anyone know if it is possible to do this through GUI scripting? GUI Scripting allows you to read the value or state of lots of UI elements, such as checkboxes, sliders, etc. And in many cases you can also set them using GUI Scripting, either by setting their value or clicking them. I wrote PreFab UI Browser to help make it easy for scripters to tell at a glance what the hierarchy of UI elements is, what is the index of specific UI elements, whether UI elements are settable -- and to auto-generate AppleScript statements that read and write values of UI elements.
Here's an example of a script that reads a checkbox and clears it if it is on. The script assumes that the Snow Leopard TextEdit Preferences window is on and set to the first tab view.
activate application "TextEdit" tell application "System Events" tell process "TextEdit" tell tab group 1 of window "Preferences" get value of checkbox "Check spelling as you type " if result is 0 then click checkbox "Check spelling as you type " end if end tell end tell end tell
You can also read and sometimes set attributes like 'enabled', 'focused', and 'hidden' for many kinds of UI elements. |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden