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

Re: [MacPerl] Apple Event examples



At 12.16 7/11/97, Chris Hector wrote:
>Does anyone have some sample perl scripts that use
>AppleEvents?
>
>I'm looking into a couple of experiments:
>
>Controlling Netscape via Perl
>Controlling Clip2Gif via Perl

        http://pudge.net/macperl/

I have four modules there that control various apps with AppleEvents.

I also have the following scripts that, in conjuction with Cliboard.XCMD,
opens the contents of the Clipboard with Netscape (writing to a temp file
first).

#!perl
#-----------------------------------------------------------------#
#  showhtml.pl
#  pudge
#
#  Created:       Chris Nandor (pudge@pobox.com)         05-Jun-97
#  Last Modified: Chris Nandor (pudge@pobox.com)         06-Jun-97
#-----------------------------------------------------------------#
package Dartmouth;
&MacPerl::LoadExternals('clipboard.XFCN');
package main;

use Mac::AppleEvents;

($dir = $INC[0]) =~ s/lib$/$1/;
$temp = $dir . time;
open(T,">$temp") || die "can't create temp file: $!\n";
print T &Dartmouth::Clipboard();
close T;

$temp =~ tr|:|/|;

$be =   AEBuildAppleEvent('WWW!','OURL',typeApplSignature,'MOSS',0,0,
                "'----':TEXT(\@)","file:///$temp") || die "$!\n";
AESend($be, kAEWaitReply) or die $^E;

sleep(5);
unlink $temp;
__END__

--
Chris Nandor             pudge@pobox.com             http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])



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