Keynote
136
2003-10-09 16:01:28 -0700
root
East
West
North
1st Qtr
20.4
30.6
45.9
2nd Qtr
27.4
38.6
46.9
3rd Qtr
90.0
34.6
45.0
4th Qtr
20.4
31.6
43.9
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
root
East
West
North
1st Qtr
20.4
30.6
45.9
2nd Qtr
27.4
38.6
46.9
3rd Qtr
90.0
34.6
45.0
4th Qtr
20.4
31.6
43.9
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
root
East
West
North
1st Qtr
20.4
30.6
45.9
2nd Qtr
27.4
38.6
46.9
3rd Qtr
90.0
34.6
45.0
4th Qtr
20.4
31.6
43.9
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
root
East
West
North
1st Qtr
20.4
30.6
45.9
2nd Qtr
27.4
38.6
46.9
3rd Qtr
90.0
34.6
45.0
4th Qtr
20.4
31.6
43.9
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
root
East
West
North
1st Qtr
20.4
30.6
45.9
2nd Qtr
27.4
38.6
46.9
3rd Qtr
90.0
34.6
45.0
4th Qtr
20.4
31.6
43.9
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
root
East
West
North
1st Qtr
20.4
30.6
45.9
2nd Qtr
27.4
38.6
46.9
3rd Qtr
90.0
34.6
45.0
4th Qtr
20.4
31.6
43.9
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
root
East
West
North
1st Qtr
20.4
30.6
45.9
2nd Qtr
27.4
38.6
46.9
3rd Qtr
90.0
34.6
45.0
4th Qtr
20.4
31.6
43.9
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0.8 0.6
0 0 0
0.2 0.2 0.8
0 0 0
0.8 0.8 1
0 0 0
0.698039 0.698039 0.698039
0 0 0
0.501961 0.501961 0.501961
0 0 0
0 0 0
0 0 0
0 0 0
version
1
CPBorderColorProperty
0 0 0
CPTextProperty
root
East
West
North
1st Qtr
20.4
30.6
45.9
2nd Qtr
27.4
38.6
46.9
3rd Qtr
90.0
34.6
45.0
4th Qtr
20.4
31.6
43.9
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
Applescripting the Unscriptable -- Ted Stevko, Stevko Studios
Click to edit Master text styles
•
Second level
–
Third level
•
Fourth level
–
4
Click to edit Master text styles
•
Second level
–
Third level
•
Fourth level
–
4
0
1
2
3
4
Applescripting the Unscriptable -- Ted Stevko, Stevko Studios
Click to edit Master text styles
•
Second level
–
Third level
•
Fourth level
–
4
version
1
CPBorderColorProperty
0 0 0
CPTextProperty
Applescripting the Unscriptable -- Ted Stevko, Stevko Studios
Click to edit Master text styles
•
Second level
–
Third level
•
Fourth level
–
4
version
1
CPBorderColorProperty
0 0 0
CPTextProperty
Applescripting the Unscriptable -- Ted Stevko, Stevko Studios
Click to edit Master text styles
•
Second level
–
Third level
•
Fourth level
–
4
version
1
CPBorderColorProperty
0 0 0
CPTextProperty
Applescripting the Unscriptable -- Ted Stevko, Stevko Studios
Click to edit Master text styles
•
Second level
–
Third level
•
Fourth level
–
4
version
1
CPBorderColorProperty
0 0 0
CPTextProperty
Applescripting the Unscriptable -- Ted Stevko, Stevko Studios
Click to edit Master text styles
•
Second level
–
Third level
•
Fourth level
–
4
version
1
CPBorderColorProperty
0 0 0
CPTextProperty
Applescripting the Unscriptable -- Ted Stevko, Stevko Studios
Click to edit Master text styles
•
Second level
–
Third level
•
Fourth level
–
4
version
1
CPBorderColorProperty
0 0 0
CPTextProperty
Applescripting the Unscriptable -- Ted Stevko, Stevko Studios
Click to edit Master text styles
•
Second level
–
Third level
•
Fourth level
–
4
version
1
CPBorderColorProperty
0 0 0
CPTextProperty
Applescripting the Unscriptable -- Ted Stevko, Stevko Studios
Click to edit Master text styles
•
Second level
–
Third level
•
Fourth level
–
4
version
1
CPBorderColorProperty
0 0 0
CPTextProperty
Notes about this presentation
I dropped the final Applescript file into SubEthaEdit for perusal.
If you’ve got questions, shout out.
Why? It’s a long story...
This all started out because I listen to headphones all day
Audio streams aren't always convenient or stoppable.
Audio Hijack Pro has no Applescript support
So I had to find another way to do this...
GUI Scripting
Goal is not
Goals of this presentation
To go through what’s been introduced in the GUI Scripting
Touch on how GUI scripting works on the back end for Cocoa/Carbon programmers
Show how to build a GUI script for a program that has no built-in Applescript
What can you do with GUI scripting?
Can access any standard GUI element's attributes and actions
What can you do with GUI scripting?
Also includes key commands and x/y coordinate clicking (sort of)
How’s it work?
Beta for 10.2 Released in December 2002, final 1.0 in Panther
Sample scripts in the scripts menu
But how do I script these elements, dammit?
This leaves us a few problems, though
What are the basic GUI elements?
How do I tell Applescript which GUI elements I want?
What info can I get from the GUI element?
What can I do to the GUI element?
Finding The Basic Applescript Classes and Commands
The classes and commands for these are found in the System Events application
Finding Out Things About An Application You Want To Script
This is where the UI Element Inspector comes in.
You use this to find out about not only the application you want to script
What’s the UI Element Inspector?
Same program bundled with the Accessability API
It’s the most confusing thing about Applescript GUI Scripting.
So, let's take a look at it!
Looking at the Inspector
If you look at this while you roll over things, you get three distinct areas
The tree heirarchy of an element
•
The attributes of an element
•
The actions available to an element
•
Tree Hierarchy
This shows the tree you're going to have to walk down to access a GUI element
What the heck's "AXPopUpButton"?
This is the proper name of the element as seen by Apple’s Accessability API.
Attributes and Actions
Lots of attributes for every element, but not all available for getting
Some attributes can be "set" -- ones with (W) in front of them
Why can’t I script some elements?
How do I use the UI Element Inspector?
Use the tree information to find where the UI element is
Use the attributes to find out information about the UI element
Use the actions to find out what actions you can perform.
This gives you the information you need to script any specific UI element.
Prefab UI Browser
Prefab UI Browser: http://www.prefab.com/uibrowser/, $40
Prefab UI Browser
end tell
end tell]]>
Building The Script
Referencing elements
Since each of the items is in a vast tree, you just have to descend the tree.
Getting and setting attributes
of ”; setting is “set, etc.”]]>
Buttons
Again, simple as can be: find the element and use "click"
Drop-down Menus
Drop-down menus include both "pop up buttons" and "menu buttons"
You must click the button first to be able to reach the menu items.
Menus & Menu Items
Menu Bars & Menu Bar Items
Menu Bars are containers for menu bar items, which are containers for menus.
This is new in Panther; the beta had menu bar, menu, menu item.
Text Fields
Enabled and Disabled Elements
Open Dialogs
"/users/stevko/Desktop/"
Open Dialogs
Incrementors
Incrementors are a particular type of UI element which moves values up and down
Consist both of sliders and up/down buttons
They also can contain child buttons, which can be used in a click statement
Clicking Elements By Location
You can also "click" at a location on the screen.
Call click using a list consisting of an {x,y} coordinate point
Does not work for elements which aren't extensions of the Accessability API
Keystrokes
Unscriptable Elements
Now, To The Actual Script....
Additional Things To Do
Create this as a CGI, set up a web server, and go to town.
Downsides Of GUI Scripting
Can’t register a click at a particular location!
Positive Benefits of GUI Scripting
Encourages good UI development in a logical structure
Encourages use of standard UI elements whenever possible
Future Developments?
Obviously, more UI elements and simpler access for common elements
Support for double-click and click and drag
A more readable UI Element Inspector
Questions, Comments, Insults?
The Final Applescript
The Final Applescript cont’d
The Final Applescript cont’d
The Final Applescript cont’d
0) then
]]>
1
0
144
1
{0, 0}
152 87 961 637 0 0 1152 746
144
0.500000