Doug McNutt wrote Thu, 9 Oct 2003 05:40:58 -0600:At 10:46 +0100 10/9/03, Alan Fry wrote:I have a MacPerl script I am trying to transfer from OS9 to OSX. There are two problems: cron
cron needs to point, with a full path, to an executable, That is, something with the x permission bit set. That can be /usr/bin/perl with arguments pointing to a perl script as text or it can be to the script itself if it begins with a #!/usr/bin/perl line and has been made executable with a chmod. Remember that your .login and other initializations, $PATH in particular, will not be set up for you by cron.
cron can "open" an AppleScript APPL (man open) but if all it is used for is to start up MacPerl you won't need it. Except for GUI things that involve Finder like drag and drop you'll be better off replicating the AppleScript tasks in a shell script. Osascript is available for simple AppleScript-like things from a shell.
Many thanks Doug for your comments, which I have carefully filed against the day I shall understand what you're saying.
My personal problem is total ignorance of Unix and all its manifold works. I have a learning curve to negotiate, to say the least. At the moment I am merely chipping away like Fred Flintstone at a paleolithic Terminal window, getting nowhere fast.
What I miss most is the MacPerl droplet, on which you could drop a file, extract the path (into ARGV) and do something with the file. For instance I have a droplet to decode Base64 -- drop and bingo there is the decoded file. And similarly with more complicated issues like translating a 'pod' file to 'pdf'.
Is there anyway one can get back to this functionality in MacOS X? Experiments with AppleScript have not been rewarding. Sure, you can write an applet which will extract the full path name from a file dropped on it. But the path is the old Mac-style colon separated directory path. What can you do with that?
Even assuming you could translate the Mac-style path to a Unix-style path (in AppleScript!), how can you pass the path to a Perl script? I have tried "telling" application "Terminal" to do a perl script pushing a valid path into @ARGV and then to run a second perl script to see what is in the ARGV list. The answer is always nothing.
This is one way to do it:
on open these_items
repeat with this_item in these_items
set the_path to POSIX path of this_item
set result to do shell script "/Users/james/backatcha.pl \"" & the_path & "\""
display dialog result
end repeat
end open
Save as an application.
And /Users/james/backatcha.pl is:
#!/usr/bin/perl
print "I got: $ARGV[0]";
--
Thanks,
James Reynolds University of Utah Student Computing Labs [EMAIL PROTECTED] 801-585-9811