Jump to content

Do we have programable call external trigger?


Recommended Posts

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..

 

Xnip2023-11-09_11-29-33.thumb.jpg.65c90d2d6033ad97634cecd1b4db7323.jpg

Link to comment

@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

@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 by bigplume
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...