Alright. After months of not-doing-anything-about-the-problem, I have a perl script that will allow documents to be plucked from Mozilla with a single button push. This should also work with IE, but I think there's already a method to do that. All the relevant files are attached. Constructive feedback is welcome. Requires: Cygwin Perl (with a working knowledge if you want to help me fix some bugs) Windows Registry Plucker-build.exe (Desktop 1.2) I've yet to figure out how to make this work with Plucker-desktop 1.4. Suggestions? Here's how it works: bookmarklet.txt contains a javascript. Make a new bookmarks, and copy the javascript into the location. Every time you call the bookmark, it should activate the Pluck script. plucker registry.reg needs to be merged into the registry to enable the plucker:// protocol in web browsers. the script will do this itself eventually, but I don't have all the bugs worked out yet. Windows and cygwin do not play well together. mozpluck.pl is the perl script that does the work of parsing the URL and calling plucker-build. Please be aware that you may need to do some editing of paths in mozpluck.pl as well as in plucker registry.reg. I'm working on the problem... I hope this helps. Let me know.
-- Eugene "Gman" Vasserman [EMAIL PROTECTED] http://www.y3k.org/eugene/
javascript:this.document.location.replace("plucker://"+escape(document.location))#!/usr/bin/perl -w
# Perl code by Eugene Vasserman
# (thanks to David A. Desrosiers from plucker-dev for first version)
# Licence: Free, graits, speech, beer, public domain.
# WARRANTY: None. Don't even ask.
use strict;
use Cwd;
use URI;
#use POSIX;
#use File::Temp qw/ mktemp /;
use File::Which;
use String::Random qw(random_string);
use Win32::TieRegistry(Delimiter=>"/");
#use Win32::Palm::Install::UsersDat::UserEntry;
#die "Only cygwin is supported at this time. Sorry.\n"
# unless $ENV{'OSTYPE'} =~ /cygwin/;
#the above is NOT true if run in a DOS box
# if no arguments, check whether plucker:// is a registered protocol
# (register it otherwise) and exit
my $url = shift @ARGV || do {&checkRegistry()
unless &checkRegistry(); exit;};
my $ext = '.pdb';
my $pl_build = 'C:\Handheld\Plucker\plucker-build.exe';
my $pl_install = 'C:\Handheld\Palm\Instapp.exe';
my @pl_args = (
'--zlib-compression',
'--stayonhost',
'--maxdepth=1',
'--backup',
'--beamable',
'--noimages',
'-V1'
);
my ($scheme, $auth, $path, $query, $frag) = &convpl($url);
#this should hit something eventually...
print "$auth, $path, $query, $scheme, $frag\n";
my $title = $query || $path || $auth || $scheme;
#my $filename = mktemp($ENV{'TEMP'}.'mozpluckXXXXXX');
#my $filename = mktemp('mozpluckXXXXXX');
#my $filename = File::Temp::tempnam($ENV{'TEMP'}, 'mozpluckXXXXXX');
#my $filename = tmpnam();
#none of the crap above (for temp files) works under windows....
#we'll have to write our own. Curse Bill!
#my $filename = $ENV{'TEMP'} . random_string('......');
my $filename = 'mozpluck' . random_string('CCCCCC');
while (-e $filename)
{
$filename = 'mozpluck' . random_string('CCCCCC');
}
# of course, Mr. Bond, you understand that we can not guarantee that the file
# will not exist by the time you want to use it!
#print $filename, "\n";
push @pl_args, '-f' . $filename;
push @pl_args, '-N '. $title;
my $exitCode;
system $pl_build, @pl_args;
$exitCode = $? >> 8;
die $pl_build.' failed with exit code '. $exitCode ."\n" if $exitCode;
system $pl_install, $filename.$ext;
$exitCode = $? >> 8;
die $pl_install.' failed with exit code '. $exitCode ."\n" if $exitCode;
warn "Could not remove temporary file $filename: $!\n"
unless unlink $filename.$ext;
exit;
sub convpl {
# mine
# /^\s*plucker\:\/\/(https?)\:\/\/(www\.)?(.+)\.(.+)(\..+)*(\/.*\/)*(.*)\s*$/o
# official
# $uri =~
# my($scheme, $authority, $path, $query, $fragment) =
# m|(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?|;
my $u = URI->new(shift @_);
return ($u->scheme, $u->authority, $u->path, $u->query, $u->fragment);
}
sub checkRegistry
{
### check registry keys ###
my $key = 'HKEY_LOCAL_MACHINE/SOFTWARE/Classes/plucker';
$Registry->{$key} = {
'/' => 'URL:Plucker Protocol',
'/URL Protocol' => '',
'DefaultIcon/' => {},
'shell/' => {
'open/' => {
'command/' => {
'/' => '"'. which('perl.exe') .'"' . '"'. getcwd() .'/'. $0 .'" "%1"'}
#not clean, but works...
}
}
};
return 1;
}
plucker registry.reg
Description: Binary data
