Calling AppleScripts With Arguments
This works now (in my local code, I won't release it for a couple of weeks probably):
use Mac::OSA::Simple;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.
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!"]);
Leave a comment