Re: Identifying app by creator code??
Re: Identifying app by creator code??
- Subject: Re: Identifying app by creator code??
- From: Chris Nebel <email@hidden>
- Date: Wed, 03 Jan 2001 16:38:50 -0800
- Organization: Apple Computer, Inc.
Jolly Roger wrote:
>
on 1/3/2001 2:31 PM, Michael Kern wrote:
>
>
> The problem is the script won9t compile this way. I keep getting an error
>
> at the 2nd to last line 3make...2 on the word window.
>
>
You've struck on a problem that has plagued us for a long time. Welcome to
>
AppleScript. :)
>
>
Since you are using Outlook Express terminology outside of a standard "tell
>
application "Outlook Express"" block, AppleScript has no idea which
>
application owns the terminology, and therefore cannot resolve the
>
terminology to compile the script.
>
>
Luckily, there are ways around this problem. You can aleve this problem in
>
two ways:
>
>
METHOD 1 (the "double-tell" method): ...
>
>
METHOD 2 (the "raw event code" method): ...
And, if you're using Mac OS 9...
METHOD 3: (the "using terms from" method): AppleScript 1.4 (in Mac OS 9)
introduced a new block called "using terms from" that was designed to solve
precisely this problem. It's similar to the double-tell method, but is
guaranteed to never ask you for the application at run time. It looks like
this:
-- compute appOE somehow
tell application appOE
using terms from application "Outlook Express"
-- OE-specific commands here
end
end
"Tell" does two things: at compile time, it tells AppleScript where to get
terminology, and at run time, it tells it where to send commands. "Using terms
from" only does the first -- it does nothing whatsoever at run time. The
"tell", therefore, will direct the commands to appOE, wherever it turns out to
be, while the "using terms from" will fetch terminology from your local copy of
Outlook Express when you compile the script, but after that it gets out of the
way.
I believe that scripts that use "using terms from" will work on older systems
*if* they're saved as run-only applets. (Or if they don't use write-back
properties.) I say "believe" because I've tried a few scripts and they worked,
and I've never seen one fail, but it hasn't been thoroughly tested. If all
your clients have Mac OS 9, of course, then it isn't an issue at all.
--Chris Nebel
AppleScript Engineering