On Feb 28, 2007, at 8:42 PM, Christopher Jett wrote:

> I know how to control the other application with AppleScript, and I
> already have AE Monitor (great app!) so I know the commands needed.
> The application I am controlling can potentially respond with an
> AppleEventRecord.  I was hoping to make a generic method that could
> parse this result into a RB dictionary and then also make another
> method that can take a dictionary and make an AppleEventRecord.
> However, it does not appear there is a way to iterate over the
> elements in an AppleEventRecord.  You apparently already have to know
> what element names are in it as well as what format the data is in.

Well - yes, you do! :)

If you look at the application's AppleScript dictionary, you'll see  
that each possible command has a return type (text, number, object,  
etc). So the command

tell application "Finder" to get startup disk

...always returns a reference to a volume, so you know what to  
expect. You can use AE Monitor to figure out how the AppleEventRecord  
is structured - inspect the Reply to whatever event you've sent, and  
you'll see what kind of response is generally sent.

Keep in mind that an Apple Event Record can represent a group of  
items, such as what you'll get if you do this:

tell application "Finder" to get every folder of startup disk

You should be prepared to parse through every potential response,  
because there's really no knowing what might happen.

Eric Williams
Oxalyn Software
http://software.oxalyn.com/

AE Monitor
http://software.oxalyn.com/AEMonitor/


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to