Re: Calling other OSA Scripts
Re: Calling other OSA Scripts
- Subject: Re: Calling other OSA Scripts
- From: Nigel Smith <email@hidden>
- Date: Thu, 24 May 2001 17:15:44 +0100
g3pb wrote:
>
tell application "MacPerl"
>
Do Script "iMac:Desktop Folder:test.pl" -- path to perl script file
>
end tell
And I've just found something else (though it may be obvious to anyone with
more than my 10 minutes of MacPerl experience :-) ).
A simple MacPerl script:
$a = $ENV{myVar};
MacPerl::Reply($a)
And a simple AppleScript:
tell application "MacPerl"
set myResult to Do Script scriptPath environment {"myVar", "Banana"}
end tell
return myResult
If you save the MacPerl script and replace "scriptPath" in the Applescript
with the path to the MacPerl script, then run the AppleScript, it will
return "Banana".
OK, not the most exciting result in the world, but it's made my day :-)
And I've just found that you can go on, listing more variables in the form
{varName1,value1,varName2,value2,varName3,value3, ... ,varNameN,valueN}
I always thought you could use MacPerl in a way similar to Unix, assign a
command line argument when you run the script. Looks like I was wrong,
thanks to AppleScript...
Nigel (the easily pleased!)