At 8:44 +0200 2004.06.29, Bart Lateur wrote:
>If you know of a (easy) way to embed the compiled Applescript into the
>resource fork of this applet itself, and run it from there, I'm all
>ears, even if the embedding is not done using MacPerl itself (though I'd
>prefer that... :))
Using the initial example of Mac::OSA::Simple from the previous email, to
save a compiled AppleScript in the resource fork of an app, you can try:
#!/usr/bin/perl
use strict;
use warnings;
use Mac::OSA::Simple;
my $app = '/Users/pudge/Desktop/Shuck';
my $resid = 999;
my $script = load_osa_script($app, $resid);
# compile and save script if not yet loaded
if (!$script) {
$script = compile_applescript(<<EOS);
on \xC7event abcd1234\xC8 (filepath)
tell application "Finder"
set this_app to get application file id "R*ch"
open file filepath using this_app
end tell
end
EOS
$script->save($app, $resid);
}
$script->call(qw[abcd 1234], 'Bourque:Users:pudge:bin:happening');
__END__
Make sure you make a copy of the app to test on first.
--
Chris Nandor [EMAIL PROTECTED] http://pudge.net/
Open Source Development Network [EMAIL PROTECTED] http://osdn.com/