Jump to content

Trigger a workflow action from applescript


Recommended Posts

hey guys,

 

The actions that are displayed within a workflow is what I'd like to specifically execute from Applescript. Is this possible for alfred or should I look at a different approach.

 

Thanks

 

Depending on what your looking to accomplish, Alfred supports the "search" action and "run trigger". Telling Alfred to search simply displays him and populates the textbox with whatever you tell it to

 

Example:

tell application "Alfred 2" to search "this is a test"

You could also set up external triggers to make Alfred perform a direct call to an action using "run trigger". You would need to set up an external trigger in your workflow that connected to the action to be run. At that point, Alfred provides you with sample code for running that trigger via Applescript

Link to comment

Thanks guys. I am new to alfred so trying to make this work. The workflow is lifx.https://github.com/stroebjo/alfred-lifx/blob/master/README.md Using either the hotkey or the applescript generated from external trigger, I am able to list the resultant possible actions within the workflow but I am not sure how to nominate a pre-existing action without the use of gui scripting within applescript which would make it unpredictable.

Link to comment

Thanks guys. I am new to alfred so trying to make this work. The workflow is lifx.https://github.com/stroebjo/alfred-lifx/blob/master/README.md Using either the hotkey or the applescript generated from external trigger, I am able to list the resultant possible actions within the workflow but I am not sure how to nominate a pre-existing action without the use of gui scripting within applescript which would make it unpredictable.

 

I dont have a way to test this so I'm not sure what exactly I'm supposed to get from it but..With the external trigger or with just plain old applescript, if the results can be filtered to something that you KNOW is there.. you could just hard code passing that value into alfred in the script then using a hotkey to call that

Link to comment

Don't be afraid with a level of code duplication when it comes to this problem.

 

You can have the regular workflow, but you could also have an external trigger that leads to a workflow object that is a 'run script' that is also taken care of in the normal course of events. While this isn't the best option, it's by no means frowned upon (as long as I'm the one who tells people when to frown, which really isn't the case).

 

External triggers can be great to accomplish something, but if you've written most of the workflow in a script filter, then you should rewrite part of it as a different workflow object to accept an argument and carry out an action as necessary.

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