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

Re: [MacPerl] Apple Events with complex parameter objects



At 07.33 -0500 1998.06.01, William B. Birkett wrote:
>Process("Finder").SendAE "core,clon,'----':
>
>[obj {form:name, want:type(file), seld:"Hard Drive:Projects:OPI->APR:Test
>Pages:PE Pg  4:MPI 3510", from:'null'()},
>
>obj {form:name, want:type(file), seld:"Hard Drive:Projects:OPI->APR:Test
>Pages:PE Pg  4:PR 7521", from:'null'()},
>
>obj {form:name, want:type(file), seld:"Hard Drive:Projects:OPI->APR:Test
>Pages:PE Pg  4:TM 176DYP", from:'null'()},
>
>obj {form:name, want:type(file), seld:"Hard Drive:Projects:OPI->APR:Test
>Pages:PE Pg  4:WW 0010", from:'null'()},
>
>obj {form:name, want:type(file), seld:"Hard Drive:Projects:OPI->APR:Test
>Pages:PE Pg  4:WW 007", from:'null'()},
>
>obj {form:name, want:type(file), seld:"Hard Drive:Projects:OPI->APR:Test
>Pages:PE Pg  4:WW 014", from:'null'()},
>
>obj {form:name, want:type(file), seld:"Hard Drive:Projects:OPI->APR:Test
>Pages:PE Pg  4:WW 0012", from:'null'()}],
>
>insh:
>
>obj {form:name, want:type(cfol), seld:"brisque8.1.0:HiRes:90234",
>from:'null'()}, &subj:'null'()"

You can do something like this:

#!perl -w
use Mac::AppleEvents::Simple;
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'()";

print $param;  # to see what you have now

my $evt = do_event(qw/core clon MACS/, $param, @files, $fold);

print $evt->{EVENT};  # to see what you sent
print $evt->{REPLY};  # to see what you got back

__END__

That should work, and it did in my first test.  Of course, you need my
Mac::AppleEvents::Simple module (which is on CPAN and my site).

--
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