Re: GUI scripting 101
Re: GUI scripting 101
- Subject: Re: GUI scripting 101
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 01 Jan 2003 13:29:25 -0800
On 1/1/03 1:14 PM, "Christian Boyce" <email@hidden> wrote:
>
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?
It's a supplement, like OneClick and KeyQuencer and QuicKeys were/are, for
when real scriptability is not available. Naturally, in apps with good
scriptability, that will always be preferable, for the reasons you mention,
than fiddling about with buttons in the interface of an app which has to be
in the front.
>
>
2. If I understand the big picture, the idea is that Cocoa user
>
interface items become "reachable" through GUI AppleScripting.
Not just Cocoa, Carbon apps too.
>
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.
Most should be available. You probably have to poke about getting every UI
element in order to see how to call them. there may be some unfathomable
reasons why certain controls may not be available.
--
Paul Berkowitz
_______________________________________________
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.