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

Re: [MacPerl] Apple Events with complex parameter objects



At 17.42 -0500 1998.06.02, William B. Birkett wrote:
>One question - if I use do_event as a statement rather than a function,
>will MacPerl move on without getting a reply from the Finder? If not, how
>do you get that behavior?

You can get that behavior, but not with do_event (currently).  Instead, use
Mac::AppleEvents::Simple->new() to construct your event the same way, and
send it "manually" with AESend().

#!perl -w
use Mac::AppleEvents::Simple;
use Mac::AppleEvents;          # add this module
use strict;

my @files = @ARGV; # or whatever
my $fold  = 'PowerPudgeII:Desktop Folder:untitled folder:';

my $param = q"'----':[" .
  join(', ', map(
    q"obj {form:name, want:type(file), seld:TEXT(@), from:'null'()}", @files
  )) .
  q"], insh:obj {form:name, want:type(cfol), seld:TEXT(@), from:'null'()}, " .
  q"&subj:'null'()";

# mostly the same to here

# use new() instead of do_event(), which just constructs, not send
my $evt = Mac::AppleEvents::Simple->new(qw/core clon MACS/, $param,
  @files, $fold);

# send it with kAENoReply()
my $rep = AESend($evt->{EVT}, kAENoReply());

# since do_event did not handle it, you must dispose it yourself
AEDisposeDesc($rep);

__END__


There is an ae_send() method, so I think in the future I will support:

  $evt->ae_send([REPLY, PRIORITY, TIMEOUT]);

I just did not add that in previously.  Well, now I did.  I'll make a new
archive soon.  So where now we do above:

  my $rep = AESend($evt->{EVT}, kAENoReply());
  AEDisposeDesc($rep);

In the next version, we'll just do:

  $evt->ae_send(kAENoReply());

I think I will also change new() to be build_event(), and EXPORT it.  Oh,
and I am going to change ae_send() to send_event().  Yeah, that sounds
right.

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])



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