#!/usr/bin/perl -w # By John Russell # and hacked to work with thunderbird by Darrell # This script sends the selected file(s) with mozilla-thunderbird. use strict; my $attach_string="\"attachment='"; my @files = split("\n", $ENV{NAUTILUS_SCRIPT_SELECTED_FILE_PATHS}); my $count = 0; foreach my $file (@files) { if ( ! -f $file && ! -l $file ) { my @dialog = ("gdialog","--title","Error","--msgbox", "\nError: Can not send $file. \n\n Only regular files can be mailed. ","200", "300"); system (@dialog); } else { $attach_string = $attach_string . "file://" . $file . ","; shift; $count += 1; } } if ($count > 0) { $attach_string = $attach_string . "'\""; # replace spaces with '%20' as demanded by mozilla/thunderbird $attach_string =~ s/\s/%20/g; # invoke shell script to call thunderbird differently depending on whether it's running already or not my $command = ("~/scripts/thunderbird-email-attachments " . $attach_string); system($command); }