One of the things that has always bugged me about VisualBasic and
VBScript is its 'looseness' (in VB there's the case of parentheses
around the arguments to a procedure). Although it's very nice to see
how English-like AppleScript can be, I wonder if all its synonyms might
not be more troublesome than helpful.
After a while, you get to know them. Some people find it helps just to stick
to one variation - there's nothing stopping you from doing that. I find that
a few of the synonyms seem so overdone (they seem to "try too hard") so I
avoid those. Otherwise, I like the degree of flexibility they offer, on
balance. You just need to learn _right away_ that the fact that there can be
three "right ways" rather than just one "right way" does NOT mean that
"anything works" - it doesn't. Very occasionally you'll run into someone who
thinks that they can just write ordinary English sentences and it will just
work - it won't. (And, yes, this mistaken notion is an unfortunate result of
AppleScript wanting to appear "user friendly", taken to extremes.) But you
don't have that problem. You'd prefer that there be just one right way, and
you'd learn it. You can still act as if that's true, if you wish.
Nevertheless, all in all, I still believe that the "Englishness" of
AppleScript makes it understandable and approachable to people learning
their first programming language with the aim of "getting something done"
rather than studying computer science. It's mostly only people who have long
passed that hurdle, especially those coming to AS from other languages, who
wish that AS was stricter an more like other languages.
Another question (while I have the attention of you two brilliant
guys...) -- unless I'm missing something, there doesn't seem to be any
sort of event handling provided by the Entourage object model. This
surprises me since such things are so common in Microsoft's Windows
products. Something like 'onMessageSend' would be extremely handy. Any
ideas why this is?
There are almost _no_ applications which have event handling in AppleScript
(outside of writing your own AppleScript Studio application, of course).
Technically, it is possible - it's called making an application
"attachable". I know only of a couple script editors which are attachable.
When I asked the then-Entourage lead developer, who also implemented
Entourage's scriptability, why you couldn't intercept the "Send" button to
make true "outgoing rules" (rather than "outgone rules") he said it was a
conscious decision. Attachability - event handling - would permit really bad
viruses from being developed. And of course it is indeed the event-driven
auto-macros in the other Office apps which permit viruses to have done
damage there, especially auto-open and auto-startup macros. (Even now, it's
the one big difference in the new 2004 AppleScript of Word, Excel,
PowerPoint: no event handling, no auto macros possible in straight
AppleScript, as opposed to VBA.)
As Matt says, mail rules are a special case of event handling (the event
being a new message arriving, or just sent), and schedules can be set to run
At Startup and On Quit, with both rules and schedules capable of running
scripts. That makes Entourage, and other email clients which have filters
too, _more_ event-driven than any other apps I know except those scriptable
script editors.
--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <
http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <
http://macscripter.net/scriptbuilders/>
Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.
PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.