I have some short applescripts that I want to use as utility functions inside shell scripts-- for example, one returns the name of the frontmost application. The scripts reside in a personal scripts directory that is on my $path$path
. When in another directory, I can just run
$myscript.applescript
And, because the scripts directory is on the path, this file will be found and executed (at the top is #!/usr/bin/env osascript
). However, when I run
$myscript.scpt
To try and run the compiled version, I get:
zsh: exec format error: get_front_app_name.scpt
I would like to use the compiled version but would also like to be able to run these like any executable on my $path$path
, that is, without having to specify the interpreter name (osacompile
) or the path to the file. As of now, the only way I can see to execute the compiled .scpt applescript is to do both:
$osascript path/to/myscript.scpt
Is it possible to run the compiled form without this baggage?