rounak Posted September 4, 2016 Share Posted September 4, 2016 (edited) I lost a considerable amount of time trying to run an applescript. This text below should clearly mention what kind of external scripts are supported. Any ideas how to run applescripts but keep them in an external file? External Scripts If you select the language as "external script", you can run an external script. If you don't specify an absolute path, Alfred will look relative to the workflow's folder. Ensure that you have the script's execute permission set. Edited September 4, 2016 by rounak Link to comment
deanishe Posted September 4, 2016 Share Posted September 4, 2016 (edited) External Script assumes you have an executable script or program that can be run directly (i.e. you can run it in a shell with /path/to/MyScript.py and don't need to pass it to another program, such as /usr/bin/python /path/to/MyScript.py). You can't do that with compiled AppleScripts (i.e. with .scpt extension). They have to be passed to /usr/bin/osascript. There are two options (I'd recommend the second): Make a directly-callable script. To do this, save the script in Text format (i.e. with extension .applescript), and use the shebang #!/usr/bin/osascript as its first line. Then run chmod +x MyScript.applescript to make it executable. Easiest way is to let Alfred create the file for you (it will set the executable bit for you). But remember to use the extension .applescript, to force Text format. Use the "traditional" method, and treat Alfred's Script box like a shell command line. Leave the Language set to /bin/bash, then call your script as you would from the command line: /usr/bin/osascript MyScript.scpt I say the second is better because it runs the compiled AppleScript, which should run faster. Does that help? Edited September 4, 2016 by deanishe rounak 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now