Trying to pass file path from a.s. droplet to MacPerl code in the droplet
Trying to pass file path from a.s. droplet to MacPerl code in the droplet
- Subject: Trying to pass file path from a.s. droplet to MacPerl code in the droplet
- From: Matthew Galaher <email@hidden>
- Date: Wed, 25 Jul 2001 09:08:37 -0700
Please forgive me if this has been covered.
I am trying to write an applescript droplet that passes the content of the
file dropped on it, to the MacPerl I've put in the a.s. droplet. This code
works when I have the path to the document as a string e.g. open(IN,
'Macintosh HD:Desktop Folder:my_doc.html') but does not work when I try and
use a variable. If this has something to do with @ARGV, might someone be
kind enough to write simple example? Any help would be much appreciated.
Thanks
on open file_list
set number_dropped to length of file_list
if number_dropped > 1 then
display dialog "Please drop one document at a time."
else
set file_path to item 1 of file_list as string
display dialog file_path
tell application "MacPerl"
activate
(Do Script "
open (IN, file_path) || die \"cannot open file\";
undef $/;
$file = <IN>;
print \"Your file contains.\\n\" . $file ;
")
end tell
end if
end open