[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Re: Get AETE



At 10:38 PM -0400 9/30/98, Chris Nandor wrote:
>OK, if we want to grab the aete data from extensions and plugins in the
>app, the best way is to grab the data with the Get AETE event.
>
>    use Mac::AppleEvents::Simple;
>    my $getaete = do_event('ascr', 'gdte', $appid, "'----':0");
>    my $aelist = AEGetParamDesc($getaete->{REP}, keyDirectObject);
>    foreach (1 .. AECountItems($aelist);
>        $aeteHandle = AEGetNthDesc($aelist, $_)->data;
>        # do stuff
>    }
>
>So now the handle is from the Apple Event instead of actually reading the
>resource.  This is how Script Editor does it, I believe.
>
>David, when you are doing your module, could you experiment with
>getting the data this way?  There is little else that would need to
>be changed, that stuff above is pretty much it.
>

I spent some time earlier this evening playing with this earlier while 
trying to do something else. It will work, but the app has to be running. 
The app also has to have a 'scsz' for it to have any benefit over reading 
in the 'aete' resource directly. So here's what I'll do:

  If the app is already running, I'll bounce the GetAETE event off of it. 
That also solves the problem of directly reading the resource when the file 
is running, which can be really bad.

  If the app isn't running, but it has a 'scsz' resource, I'll launch it 
and bounce the GetAETE event off of it.

  Otherwise, I'll just read in the resource as I do now.

A couple of other notes:

Merging the proper suites from the aeut in the AS dialect works. It's 
currently kind of slow since I have to go hunting for the proper file, but 
it'll do for now.

Most people seem to be using aeteconvert to get the information needed for 
sending Apple events instead of recompiling aete resources, so I created an 
additional output format that is more human-readable. The old format is 
still available.
Here's an example from the English AS dialect:

============================================================
Suite: Required Events, Terms that every application should support
============================================================
Suite ID: 'reqd'

Event: open, Open the specified object(s)
   Class: 'aevt'
   ID: 'odoc'
   Reply:
      Type: 'null'
      Flags: optional, single, non-enum
   Direct Object: list of objects to open
      Type: 'alis'
      Flags: required, list, non-enum, change

Event: quit, Quit application
   Class: 'aevt'
   ID: 'quit'
   Reply:
      Type: 'null'
      Flags: optional, single, non-enum
   Direct Object: no direct parameter required
      Type: 'null'
      Flags: optional, single, non-enum, change

Event: run, Sent to an application when it is double-clicked
   Class: 'aevt'
   ID: 'oapp'
   Reply:
      Type: 'null'
      Flags: optional, single, non-enum
   Direct Object: no direct parameter required
      Type: 'null'
      Flags: optional, single, non-enum, change

Event: print, Print the specified object(s)
   Class: 'aevt'
   ID: 'pdoc'
   Reply:
      Type: 'null'
      Flags: optional, single, non-enum
   Direct Object: list of objects to print
      Type: 'alis'
      Flags: required, list, non-enum, no-change

============================================================

later,

---Dave---


=========================================================
David C. Schooley              | "Success is how high you
Ph.D. in progress              |  bounce after you hit
Georgia Tech Electric Power    |  bottom.
mailto:schooley@ece.gatech.edu |   - General George S. Patton
http://www.ee.gatech.edu/users/schooley/

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch