NAME
Mac::AppleEvents::Simple - MacPerl module to do Apple Events more simply
SYNOPSIS
#!perl -w
use Mac::AppleEvents::Simple;
use Mac::Files;
$alias = NewAliasMinimal(scalar MacPerl::Volumes);
do_event(qw/aevt odoc MACS/, "'----':alis(\@\@)", $alias);
DESCRIPTION
This is just a simple way to do Apple Events. The example above was previously done as:
#!perl -w
use Mac::AppleEvents;
use Mac::Files;
$alias = NewAliasMinimal(scalar MacPerl::Volumes);
$evt = AEBuildAppleEvent(qw/aevt odoc sign MACS 0 0/,
"'----':alis(\@\@)", $alias) or die $^E;
$rep = AESend($evt, kAEWaitReply()) or die $^E;
AEDisposeDesc($rep);
AEDisposeDesc($evt);
The building, sending, and disposing is done automatically. The function returns an object containing the parameters, including the AEPrint()
results of AEBuildAppleEvent()
($event->{EVENT})
and AESend()
($event->{REPLY})
.
The raw AEDesc forms are in ($event->{EVT})
and ($event->{REP})
. So if I also used the Mac::AppleEvents
module, I could extract the direct object from the reply like this:
$dobj = AEPrint(AEGetParamDesc($event->{REP}, keyDirectObject()));
So you can still mess around with the events if you need to.
FUNCTIONS
- [$EVENT =] do_event(CLASSID, EVENTID, APPID, FORMAT, PARAMETERS ...)
-
Documented above. More documentation to come as this thing gets fleshed out more.
- $EVENT = Mac::AppleEvents::Simple->new(CLASSID, EVENTID, APPID, FORMAT, PARAMETERS ...)
-
This is for delayed execution of the event. Build it with
new()
, and then send it withae_send()
method. Not sure how useful this is yet. - $EVENT->ae_send();
-
I will probably add ways to change the sending parameters (REPLY, PRIORITY, TIMEOUT) through this method, so if you need to send it a special way, you'll be able to. You can send an event constructed with
new()
, or re-send an event constructed and sent withdo_event()
. - get_text(STRING);
-
This basically just strips out the curly quotes. It returns the first text in curly quotes it finds in scalar context, and all of them in a list in list context.
EXPORT
Exports functions do_event()
, get_text()
.
HISTORY
AUTHOR
Chris Nandor <pudge@pobox.com> http://pudge.net/
Copyright (c) 1998 Chris Nandor. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Please see the Perl Artistic License.
SEE ALSO
Mac::AppleEvents, Mac::OSA, Mac::OSA::Simple, macperlcat.
VERSION
Version 0.02 (19 May 1998)