If you recently upgraded your Apple Mac to the latest Sierra versions of the OS you might be from the unlucky once with Applescript applications which does not launch anymore. And if you tried without joy any of this:
- saving the apps in the Application folder;
- manually creating executable applet within the Applescript app;
- disabling SIP;
- disabling Gatekeeper /GUI or via Terminal/;
- signed the app with developer ID;
PANIC NOT! ๐ There is still hope, thanks to the good old Terminal, bash shell and the handy command osascript!
Basically the idea is this, with the osascript command you are able to run a Applescript without triggering the launch of Script Editor, so if you type in Terminal
osascript /path/to/script/YourScript.scpt
the script will be executed nicely and without a hassle.
But what if you happen to have just the Applescript app, not the code of the script itself? Luckily osascript command can handle this as well! You simply have to dig a bit in to the app and point to the compiled script in it, something like this:
osascript /path/to/Applescript.app/Contents/Resources/Scripts/main.scpt
Luckily in Sierra this bypasses all the clutches the OS offers. ๐
This can be used in a bash script for convenience, something like that as an example:
#!/bin/bash
osascript /path/to/Applescript.app/Contents/Resources/Scripts/main.scpt &&ย trap ‘/usr/bin/osascript -e “tell application \”terminal\” to quit”‘ 0
I think that’s pretty much it, hope you will find it helpful.