acroread2claws-mail.pl 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/usr/bin/perl
  2. # * Copyright 2005 Paul Mangan <paul@claws-mail.org>
  3. # *
  4. # * This file is free software; you can redistribute it and/or modify it
  5. # * under the terms of the GNU General Public License as published by
  6. # * the Free Software Foundation; either version 3 of the License, or
  7. # * (at your option) any later version.
  8. # *
  9. # * This program is distributed in the hope that it will be useful, but
  10. # * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. # * General Public License for more details.
  13. # *
  14. # * You should have received a copy of the GNU General Public License
  15. # * along with this program; if not, write to the Free Software
  16. # * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. #
  18. # acroread2claws-mail.pl helper script to send documents from
  19. # Adobe Reader 7 to claws-mail
  20. use strict;
  21. my $input = <>;
  22. my $pdf;
  23. my $output = $ARGV;
  24. if ($ARGV =~ m/^\//) {
  25. $pdf = $output;
  26. } elsif ($ARGV =~ m/^mailto/) {
  27. my @parts = split(/&[a-z]*=/, $output);
  28. $parts[0] =~ s/^mailto:\?attach=//;
  29. $pdf = $parts[0];
  30. } elsif ($ARGV =~ m/^to/) {
  31. my @parts = split(/,/, $output);
  32. $parts[3] =~ s/^attachment=file:\/\///;
  33. $pdf = $parts[3];
  34. } else {
  35. $pdf = $ENV{HOME}."/".$output;
  36. }
  37. exec "claws-mail --attach \"$pdf\"";
  38. ## if necessary, change the line above to point to
  39. ## your claws-mail executable
  40. exit;