Execute AppleScript without opening the editor
Solution 1:
How the script is saved has a big effect on how it will operate in Mac OS X. It sounds like your script is just saved as a script and that is what is causing the script editor to open every time you open the script.
To solve the problem, open the script in the AppleScript editor and save it as an application. That should to the trick.
The steps are (in the editor)
File > Save As > then set File Format to application then save.
Solution 2:
When saving the script, you can choose "Application" from the File Format dropdown; then you will be able to run it, and you will still be able to drag it to Script Editor to open the script; or you can choose Run Only so it won't save the editable version.
Alternatively, you can use the osascript
command in Terminal, either as osascript /path/to/script
or osascript -e "a short script here"
.
Solution 3:
Under macOS High Sierra 10.13 there is no File / Save as.
You must use File / Export / File Format: Application
Solution 4:
You can also place the script in your ~/Library/Scripts/Finder/ folder and run it directly from the Script menu.