bigplume Posted November 9, 2023 Share Posted November 9, 2023 Alfred has a great "call external trigger" function, my question is, can its trigger ID be programmed, I have a script that wants to call different external triggers depending on the situation, and if it can't be programmed, I need to connect a "call external trigger" for each situation, that's a bit scary.. Link to comment
Andrew Posted November 9, 2023 Share Posted November 9, 2023 @bigplume There are a few different ways to programatically call an external trigger. If you add an External Trigger object, and pop in a trigger id, then you'll get some example AppleScript of how to call this programatically. tell application id "com.runningwithcrayons.Alfred" to run trigger "textident" in workflow "com.alfredapp.andrew.testing" with argument "test" You can programatically call this AppleScript from anywhere, the macOS AppleScript Editor, or from a Run Script workflow object in Alfred. Note: You'll notice that you can also enable an external identifier to be available via a URL Scheme, but I prefer AppleScript. Alternatively, you could use a variable, e.g. {var:externalid}, for the Trigger ID in the Call External Trigger, and set this variable upstream in the workflow. Let me know if this answers your question Link to comment
bigplume Posted November 9, 2023 Author Share Posted November 9, 2023 (edited) @AndrewNice and thanks for the information. {var:externalid} is the way I am looking for. Apple script works, but the advantage of the call external trigger, as the document mentioned, is "By not using AppleScript". URL scheme is actually a little bit problematic, it makes my front most application lose focus, so after running the command (via hotkey e.g.) I need to click on the front most application again with the mouse, which can be annoying when I'm writing code. Edited November 9, 2023 by bigplume 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