Running Scripts in Text Format
  • Is there a way to make FastScripts recognize .applescript files as executable scripts? Right now, it opens them in my script editor instead of running them. I prefer not to use compiled scripts because the text format works better with version control.
  • Hmm - good question. It hasn't come up before, believe it or not :)

    I will take it as a feature request to have FastScripts automatically notice and run .applescript files. In the mean time, if you are willing to modify the script, you could add the typical shell script header to make it run as an AppleScript shell script, e.g.

    #!/usr/bin/osascript

    tell app \"Safari\" to activate

    The #! line at the beginning of the file tells FastScripts to run it as a shell script with the osascript tool, which executes AppleScripts.

    Daniel
  • (Also - I had to just confirm this myself - but it looks like AppleScript is willing to treat the # prefix as a comment, so these scripts will continue to operate as expected in Script Editor, etc.)
  • Daniel Jalkut said:
    In the mean time, if you are willing to modify the script, you could add the typical shell script header to make it run as an AppleScript shell script

    Cool—thanks. I actually thought about doing this (since I know FastScripts supports shell scripts), but I thought it would make my scripts uncompilable. It turns out that AppleScript 2.0 (introduced with Leopard) adds # as a comment character, so it works after all.

    Note: This doesn’t work if the script uses CR linebreaks, which is the default in Script Debugger.
Start a New Discussion

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!