Where is GUI scripting reference?

Is there working web site with GUI scripting reference and examples?

I have just put the following in a feedback form to Apple but I wonder if anybody will act upon it.

There is no navigation from:
http://www.apple.com/applescript/uiscripting/
to subsequent pages such as:
http://www.apple.com/applescript/uiscripting/03.html

The navigation on subsequent pages does not work properly either and some of this navigation is not visible in Firefox.

The style on:
http://www.apple.com/applescript/uiscripting/01.html
results in overlapping text in Firefox.

Xserve and two 733 MHz G4s with Leopard !, Mac OS X (10.5.6)

Posted on May 1, 2009 3:10 AM

Reply
9 replies

May 1, 2009 1:20 PM in response to Neville Hillyer

You are right, the text overlaps in Firefox. I would use Safari; it looks correct there. While you shouldn't have to switch, sometimes you do. I have three browsers on my bar so I have options (certain sites work better on certain browsers).

The uiscripting page you specified is the whole NEW ui scripting instruction. If you look at the "subsequent" pages, all of their script examples are the same as the first page examples. They are redundant (with more details on them, but the scripts are redundant).

May 1, 2009 2:10 PM in response to red_menace

I am trying to find out more about GUI scripting which should work with applications with poor scripting facilities.

So far I have only found an introduction to GUI scripting and I have not found much about it elsewhere. For example where can I find the reference which describes process numbers and window numbers in relation to the OS rather than to a specific application? I suspect the OS keeps track of all open windows and I was hoping that some of this information could be used by AppleScript. For example how do I address the front window if it is not active and I don't know to which application it belongs? If this cannot be done surely it should say so somewhere?

May 1, 2009 3:50 PM in response to Neville Hillyer

The user interface items are described in reference to the application, since that is what is defining/using them. You cannot use UI scripting if an application is not in front - System Events targets the currently active user interface.

System Events can get a list of the processes (visible processes are the ones that can be seen) - these are usually arranged in the order that the application was launched. If an application has open windows, you can get a list of those - they are ordered from 1 to the number of windows, with 1 being the front one. You can usually get properties of the windows, values of attributes, etc.

<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #FFEE80;
overflow: auto;"
title="this text can be pasted into the Script Editor">
tell application "System Events"
repeat with SomeProcess in (get processes whose visible is true)
log (get name of SomeProcess)
repeat with SomeWIndow in (get windows of SomeProcess)
get properties of SomeWIndow
end repeat
end repeat
end tell
</pre>

May 2, 2009 2:53 AM in response to red_menace

Thanks for the information.

From what you say GUI is a misnomer in that it would appear to not directly facilitate interigation of the Graphical User Interface ie the display contents. This is a pity since the OS knows which is the front window so the information does exist. Also I can see which is the front window without any knowledge of its ownership.

Are there any other ways to get around it such as terminal or key presses etc? Where does window level/layer exist in the OS? I assume that there must be some sort of stack in which the last clicked window is moved to the top.

Is there any list of processes in the order in which they were last used. If so this might be a way of resolving this.

May 2, 2009 9:44 AM in response to Neville Hillyer

Graphical user interface scripting does just what it says - it uses System Events to access items via the Mac OS X Accessibility Frameworks in order to control the interfaces of many applications. Since the System Events application defines the terminology and commands, you are limited by what it gives you.

You can access other frameworks which may give you the access you need - for example see the call method command.

May 3, 2009 1:14 PM in response to red_menace

That is interesting. It had never occurred to me that your definition of GUI existed. As a hardware engineer I had always used the Wikipedia definition:

"Graphical user interface (GUI) is a type of user interface which allows people to interact with electronic devices such as computers; hand-held devices such as MP3 Players, Portable Media Players or Gaming devices; household appliances and office equipment with images rather than text commands."

Consequently I had viewed GUI as the computer's (or OS's) interface with people.

I can see no reason why the term should not also be applied to an application's interface as you have described.

From what you say my interface requirements are beyond the capabilities of existing AppleScript so I will take my questions elsewhere.

Thanks for trying to help me with this issue.

May 3, 2009 1:34 PM in response to Neville Hillyer

I think we are talking about different things. The definition of a Graphical User Interface is as you describe, but to use AppleScript's GUI scripting, terminology from the System Events application is typically what is used (Applescript is primarily designed to use terminology from other applications). Obviously there are different frameworks that can be used to get at different UI elements - for example, Apple's Accessibility Inspector doesn't use AppleScript.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Where is GUI scripting reference?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.