Re: Adding AETE resource
Re: Adding AETE resource
- Subject: Re: Adding AETE resource
- From: email@hidden
- Date: Wed, 7 Nov 2001 14:52:32 -0500
On Tue, 06 Nov 2001 10:10:29 +0000, From: Simon Topliss <email@hidden>
asked,
>
Does anyone know it it is possible to add an AETE resource to an Illustrator
>
plugin to make it scriptable?
The 'aete' resource doesn't make it scriptable, it merely prevents you from
having to say, "<<event xyzzyfoo>> x given <<class plgh>>:8", allowing you to
instead write "frobnicate x to shoe size 8". To actually be scriptable, the
program's event loop has to receive and respond to the <<event xyzzyfoo>> event.
And that's done with the code.
>
We are beta testing a plugin for Illustrator (can't give details) and was
>
going to request that the author adds AppleScript support, but I'm not sure
>
if this is even technically possible.
Plugins are tricky. When you write the script, you'll address the Apple Events
to the Illustrator application, not the plugin. The official sanctioned way to
make the plugin terminology available to the script is for the Illustrator to
say it has dynamic technology, and when a script sends it the "get terminology"
Apple Event, Illustrator polls its current plugins and consolidates the list.
Then, when the Apple Event arrives, Illustrator dispatches it off to the
appropriate plugin, receives the result, and send the reply Apple Event back to
the script.
For a workaround that doesn't use dynamic terminology, you could put an 'aete'
resource in the plugin, and then in your script use a construct like,
tell applications "Adobe Illustrator"
using terms from application "Your plugin"
frobnicate x to shoe size 8
end using terms from
end tell
Of course, this is completely untested. I'm not sure if the "using terms from"
should be inside or outside the "tell" block. And you'll have to have the
'aete' resource in "Your plugin" and be using a version of AppleScript that
supports "using terms from".
An alternative would be to use a "terminology-only osax". You write a Scripting
Addition with only an 'aete' resource, and it defines your terminology. It has
the drawback of applying globally, so you could successfully compile,
tell application "Finder"
frobnicate x to shoe size 8
end tell
but you'll only get an error like, "Finder doesn't understand the <<event
xyzzyfoo> event." It also supersedes any application's use of the terms
"frobnicate" or "to shoe size", breaking those functions.
In any case, these approaches only provide terminology, to make it easier to
write the script. The *code* has to handle the Apple Event. Otherwise, you are
just falsely hoping that a "Beware of Dog" sign will turn a Chihuahua into a
Doberman. In this case, the plugin will have to give Illustrator the ability to
handle the event that your terms in the AETE encode for. That's an issue for
Illustrator's plug in architecture. There is no way to target the plugin for
the message--if its a plugin, its running inside the Illustrator application,
and Illustrator will get the Apple Event.
So, before you can say if this approach is possible, you have to see if
Illustrator's plugin architecture allows you plugin to register, saying,
1. "I handle the following Apple Events: <<event xyzzyfoo>>, ...."
2. "My terminology is...."
It should be possible. Apple has defined the dynamic terminology mechanism
specifically so that plugin architectures can be scriptable, and implementors
have used them. But Illustrator's specific plugin architecture has to permit
it.
--
Scott Norton Phone: +1-703-299-1656
DTI Associates, Inc. Fax: +1-703-706-0476
2920 South Glebe Road Internet: email@hidden
Arlington, VA 22206-2768 or email@hidden