![]() ![]() However, using this method, if the \ is omitted before the EOF, then shell variable expansion will be done on the AppleScript text before it is passed to osascript, and this is enough for most command line parameter usage. Trivial example: exec osascript <<\EOF tell app "Safari" activate end tellNow, it is difficult with osascript to pass command-line parameters to the AppleScript. ![]() Voila, a seemingly direct execution of an AppleScript file. The most basic idea is to use a first line containing: exec osascript <<\EOFand then follow it with an arbitrary AppleScript. ![]() This allows considerable flexibility for use with AppleScript. However, there is a convention in unix that executable files that do not have a recognizable header (of which #! is one) are passed to /bin/sh for execution. I wanted this functionality for AppleScript (which I am trying to learn), but AppleScript accepts only (*.*) and - as its comment markers, so it is basically incompatible with the shebang method. This allows the file-inital shebang sequence ( #!) to be used to automatically exec the interpreter on a script. In unix, most scripting languages accept line-initial # as a comment marker. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |