Calling AppleScripts With Arguments

pudge on 2003-06-06T01:43:52

This works now (in my local code, I won't release it for a couple of weeks probably):

use Mac::OSA::Simple;

my $script = compile_applescript(<<"EOS"); on \xC7event abcd1234\xC8 (trackname, foo) tell application "iTunes" play (first track of library playlist 1 whose name is trackname) return [artist of current track, foo] end tell end \xC7event abcd1234\xC8 EOS

print join "|", $script->call('abcd', '1234', ["I Hung My Head", "garble!"]);


Of course, you could load a compiled AppleScript from disk instead of compiling one in memory, but it is easier to demonstrate it like this.