Problem: 1666886

Title: (Scripting) multiple objects for an AE

Received: Jul 7 1997 2:41PM


I'm trying to implement something like:
tell application "MedScanII"
	tell first document
		delete {model "PlastikFRONT.pict", model "PlastikSEIT"}
	end tell
end tell
In my application. First I thought there will be support for this easy AppleScript script in MacApp. Unfortunately after a lot of testing and discussion on the AppleScript implementors mailing list I figured out that MacApp's AppleScript implementation can't handle multiple objects for an Apple event.

The following was a reply to my message (Look at the paragraph with "Generally this is done in the framework, if you are using one."):

>>Do I have to write two different implementations for the Open Apple
>>event. First for "open object 1" and second for "open {object 1, object
>>2}"? Or even a third one for "open every object" ?
>
>You don't have to write seperate handlers, in fact you can't, but you do
>have to handle the various cases.  The best way to do this, IMHO, is to
>resolve the direct object into some C++ (or whatever) object and dispatch
>the event to it.  In the case of multiple objects, your resolution will
>return a list and you can either try dispatching to the container of the
>objects in the list (in order to batch the operation) or dispatch the event
>to each object in the list.
>
>Generally this is done in the framework, if you are using one.
>
>
>>What is "an ordered set of object"? What kind of order?
>
>Any kind.  All scripting objects are ordered by their index.  Everything
>else is optional, but every object must be accessible as "foo 1".  This
>means that any group of objects is essentially ordered.  For example,
>"every foo" resolves to a list of foo tokens which are ordered 1,2,3,etc.
>Things like "every foo whose bar = baz" return some specific ordered list
>of objects, whatever that order is. The order may or may be important to
>your implementation, but that's for you and your users to decide.
Do I do something wrong? Do I have to write my own TOSADispatcher class for such an easy task?