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

Re: [MacPerl] send multiple urls to browser



At 23.17 -0500 1998.11.10, 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.

You can only do that with Apple Events, and it may be different for each
browser.  Well, I lied.  You could do it with JavaScript/MacPerl, too.  You
would create an HTML file with JavaScript that directed the browser to open
each in a new window, then send a GetURL command with Mac::InternetConfig.

This is a very simple matter with the glue, though.

I put these on the clipboard:

http://pudge.net/
http://www.perl.org/
http://www.ptf.com/


Then ran this:

#!perl -w
package Dartmouth;
MacPerl::LoadExternals('Clipboard.XFCN');

package main;
use Mac::Glue::Netscape_Communicator;
use strict;

my $n = new Mac::Glue::Netscape_Communicator;
my @urls = split /\n/, Dartmouth::Clipboard();
foreach my $url (@urls) {
    $n->make({new=>'cwin'});  # for now, put in 'cwin' instead of 'window'
    $n->GetURL($url);
}
$n->activate;
_END__

Make sure to use the latest glue, from Nov. 3 or something.

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