How to create an executable file for an AppleScript?
Solution 1:
-
Write your AppleScript in Script Editor.
-
Choose File → Save and select Application as File Format.
This gives you an .app which will run your AppleScript when opened.
Solution 2:
-
Write your shell script in a text file, including the shebang.
If you're just using AppleScript, you can use osascript as the shebang:
#!/usr/bin/osascript tell app "Finder" to display dialog "message"
-
Set the executable bit on the file.
chmod +x /path/to/file
This gives you a file which will run your shell script when opened.
Solution 3:
You can save it as a script by putting this in a plaintext file and save it as something like dialog.sh:
#!/bin/bash
osascript -e 'tell app "Finder" to display dialog "message"'
Then making the file executable in the terminal by running chmod +x /path/to/dialog.sh
.
Execute in terminal by running /path/to/dialog.sh