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

[MacPerl] Fun With Clipboards (and AEs, and IC)



If you have the "clipboard.XFCN" file in your MacPerl path (available on
the web somewhere), then you can have Fun With Clipboards like me!

I wrote two useful scripts I thought I would share.  One takes a URL from
the Clipboard and uses Internet Config to launch it.  The other takes HTML
from the Clipboard and opens it in Netscape (good for HTML e-mail).  I keep
these (and other scripts) in OtherMenu for quick access.

--
Chris Nandor                 pudge@pobox.com                 http://pudge.net/
%PGPKey=('B76E72AD',[1024,'08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6'])


#!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;

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

sleep(5);
unlink $temp;
__END__


#!perl
#-----------------------------------------------------------------#
#  launchurl.pl
#  pudge
#
#  Created:       Chris Nandor (pudge@pobox.com)         24-May-97
#  Last Modified: Chris Nandor (pudge@pobox.com)         06-Jun-97
#-----------------------------------------------------------------#
package Dartmouth;
&MacPerl::LoadExternals('clipboard.XFCN');
package main;
use Mac::InternetConfig;
$icInst = ICStart;
ICGeneralFindConfigFile $icInst;
ICLaunchURL $icInst, "", &Dartmouth::Clipboard();
ICStop $icInst;



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