GUI scripting 101
GUI scripting 101
- Subject: GUI scripting 101
- From: Christian Boyce <email@hidden>
- Date: Wed, 1 Jan 2003 13:14:44 -0800
Time for some education from the list.
1. It has been my understanding that one of AppleScript's strengths is
that it "goes below" the user interface to get things done. Thus, when
you want to make a mail message you write something like this (pseudo
code):
make new message with properties {recipient: email@hidden,
subject: thesubject, body: thebody}
and when you run the script, blammo, a new message appears, addressed
properly, with the subject and body filled in as specified. This was
much preferred compared to accomplishing the same goal with QuicKeys as
one wouldn't see the the process (menu items being selected, text being
typed) and besides that, it felt bullet-proof. There was little chance
that the user (me) would click a key at the wrong time, interrupting
the script.
Now we have GUI scripting in AppleScript. I'm trying to understand how
it fits in. Should I turn to AppleScript GUI scripting first, or last,
or...? That is, if I have the ability to do something like
make new message with properties {recipient: email@hidden,
subject: thesubject, body: thebody}
should I do it that way, or would it be just as fast (and just as
bullet-proof) to do the job like this (pseudo code):
tell menu 1 to click menu item "New"
tell text area 1 keystroke "email@hidden"
tell text area 2 keystroke "thesubject"
tell text area 3 keystroke "thebody"
(I'm inclined to think this is not as good as doing it the "make new
message" way)
In short, should I think of GUI interface scripting as an adjunct to
the "traditional" way of scripting? A someday-replacement? Or maybe
something else?
2. If I understand the big picture, the idea is that Cocoa user
interface items become "reachable" through GUI AppleScripting. If this
is so, is it reasonable to expect EVERY GUI element in a Cocoa app to
be scriptable? Every button, every text area, etc.? I would think so,
but I have been reading about people not being able to access some
elements, so I wonder. In any case, I hope that figuring out the item
number for buttons and menus etc. is easier than understanding
AppleScript dictionaries. Maybe we can open an app up in a mode similar
to FileMaker's Layout mode, with interface items numbered. That would
be terrific.
Regardless, I'm excited about the possibilities.
Let the education begin...
--
Christian Boyce
310-452-3720
http://www.christianboyce.com
Fifteen minutes of fame: hear my MacWORLD Expo report on KPFK, 90.7 FM
in Los Angeles, January 11th, 2003 at 10:00 A.M.
_______________________________________________
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.