uh, that's so cool! AS 1.9.1
uh, that's so cool! AS 1.9.1
- Subject: uh, that's so cool! AS 1.9.1
- From: Paul Skinner <email@hidden>
- Date: Fri, 20 Dec 2002 12:46:24 -0500
http://www.apple.com/applescript/GUI/
Scripters have often requested the ability to control, via
AppleScript, applications which either do not have AppleScript support
or are only partially scriptable. The new Developer Tools release
contains a beta version of the System Events application incorporating
support for scripting the GUI (Graphic User Interface) of applications.
Using this version of the System Events application, AppleScript
scripts can select menu items, push buttons, enter text into text
fields, and generally control the GUI of most non-Classic applications.
This software, which requires Mac OS X 10.2.3, is offered for testing
and feedback and should not be used in mission critical environments.
Please post your comments in these venues:
* Apple AppleScript Users List
* Apple Discussion Boards
The following script examples demonstrate a few possible uses of GUI
scripting:
Selecting a Menu Item
(* EXECUTE MENU ITEM *)
-- replace with the target application name, the menu name, and the
menu item name
if my do_menu("Finder", "Finder", "Hide Others") is false then error
number -128
if my do_menu("Finder", "View", "Clean Up") is false then error number
-128
on do_menu(app_name, menu_name, menu_item)
try
-- bring the target application to the front
tell application app_name
activate
end tell
tell application "System Events"
with timeout of 300 seconds -- 5 minutes
tell process app_name
tell menu bar 1
click menu item menu_item of menu menu_name
end tell
end tell
end timeout
end tell
return true
on error error_message
return false
end try
end do_menu
...
--
Paul Skinner
_______________________________________________
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.