Try using double quotes around EOMP instead of single quotes... my $mp = compile_applescript(<<"EOMP") or die $!;
Also, although I don't think it matters, I noticed that in the first example your path ends with a colon...
"OS9:Desktop Folder:"
but in the second example the path doesn't...
my $path = "OS9:Desktop Folder";
I hope this helps.
David Seay http://www.mastercall.com/g-s/
use Mac::OSA::simple;
my $mp = compile_applescript(<<'EOMP') or die $!; with timeout of 300 seconds tell application "OS9:Applications (Mac OS 9):CMacTeX 4.2:binaries:mpost" activate quit end tell end timeout EOMP
$mp->execute;
and it works fine, i.e. it starts the Metapost application from Tom Kiffe's CMacTeX and quits it immediately. If i try to use a command line like
exec "mpost test.mp" in the folder alias "OS9:Desktop Folder:"
between 'activate' and 'quit' it works fine too, i.e. Metapost processes the file and i get the resulting eps-file.
But if i try to put two variables instead of the explicit file and path it is not working. Of course the two variables are defined before.
The following script:
#!perl
use warnings; use strict;
use Mac::OSA::Simple;
my $mpcommand = "mpost text.mp"; my $path = "OS9:Desktop Folder";
my $mp = compile_applescript(<<'EOMP') or die $!; with timeout of 300 seconds tell application "OS9:Applications (Mac OS 9):CMacTeX 4.2:binaries:mpost" activate exec $mpcommand in the folder alias $path quit end tell end timeout EOMP
$mp->execute;
leads to:
# OS9:Desktop Folder:simpletest.pl syntax OK # Operation not permitted. File 'OS9:Desktop Folder:simpletest.pl'; Line 11
Line 11 is the compile_applescript statement.
Of course all this does not lead to a big decrease in processing time. So the final goal would be to compile a script which reads two arguments when it is executed, in this case the filename and the path. And then execute it several times at runtime with different files. Is this possible?
Best regards, Martin
-- (1) Never draw what you can copy. (2) Never copy what you can trace. (3) Never trace what you can cut out and paste down.