On Monday, Oct 20, 2003, at 17:03 Europe/London, Chris Nandor wrote:


In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Thane Norton) wrote:

One of my personal favorites is to use a "here document" to supply the code
for an applescript via osascript. i.e.

my $script = <<'APPLESCRIPT';
tell application "Finder"
    display dialog "Hello World"
end tell
APPLESCRIPT

local *script_to;
local *script_from;
local *script_error;
my $pid = open3(*script_to, *script_from, *script_error,
    "/usr/bin/osascript") or die "Couldn't open osascript";
print script_to $script;
close script_to;

A much more efficient method would be to use one of the XS AppleScript
methods, including MacPerl::DoAppleScript() in Mac::Carbon, applescript() in
Mac::OSA::Simple (requires Mac::Carbon), and RunAppleScript from
Mac::AppleScript.

Also "system('open', <applescript.app>)" seems to run a tad faster (?) than "RunAppleScript" although it is not AFAIK possible to take Perl variables into and out of AS that way.


In passing I suspect a minor bug with RunAppleScript: in the example given the Perl script dies even thought the AppleScript succeeds.

Coming back to the original question in this thread: "CronniX" is a very nice application which one would be hard pushed to better.

'CamelBones' looks attractive for the kind of GUI one used to be able to do so easily with MacPerl. I have not found any documentation apart from the three "How To's" on the CB site. Can anyone help?

Alan Fry



Reply via email to