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

Re: [MacPerl] send multiple urls to browser



At 20:17 Uhr -0800 10.11.1998, Xah Lee wrote:
>Could somenoe show me a (MacPer) script that takes several url in the
>clipboard and open them in the browser?
>
>i.e. Suppose I have on my clipboard the following
>
>url1
>url2
>url3
>
>and I want my browser to visit each url in separate windows.


Extremly primitive approach, almost no error checking:

use Mac::AppleEvents;
MacPerl::LoadExternals("clipboard.XFCN");#Needs the Dartmouth clipboard
XCFN to be installed properly

@clip = split("\n", Clipboard());

sub viewURLinNewWin($){
 my $url = shift;

 $be =
AEBuildAppleEvent('core','crel',typeApplSignature,'MOSS',0,0,'kocl:type(docu)')
|| die "$^E\n";
 AESend($be, kAEWaitReply) || die "$^E\n";
 AEDisposeDesc $be;

 $obj = "'----':Ò$urlÓ, HWIN:obj{form:indx, want:type(cwin), seld:1,
from:'null'()}";
 $be = AEBuildAppleEvent('GURL','GURL',typeApplSignature,'MOSS',0,0,$obj)
|| die "$^E\n";
 AESend($be, kAEWaitReply) || die "$^E\n";
 AEDisposeDesc $be;
}

foreach $url (@clip){
 viewURLinNewWin($url);
}

Next time, however, you might want to come up with an idea of your own
first... ;)


__Peter Hartmann________

Ritsumeikan University, Kyoto, Japan

e-mail:
hartmann@mbox.kyoto-inet.or.jp (preferred)
phv00542@askic.kic.ritsumei.ac.jp




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