Jump to content

How to run other workflows from a workflow


Recommended Posts

I would like to have a workflow which when triggered, calls multiple other workflows. Is there a way to do this? 

 

I'm using the SmartThings workflow, which enables me to turn on/off lights. I want to be able to have a "shortcut" where it turns on/off multiple lights.

 

So currently i run: 

"st Hue Lamp on"

"st Hue Lamp 1 on"

"st Hue Lamp 2 on"

"st Hue Lamp 3 on"

 

What i want to do is run:

"st_hue"

 

 and in the background it runs all four of these.

Link to comment

You can either call Alfred with your queries, waiting a wee bit between calling each one. That's the simple way.

The better way is to figure out the script and arguments that your target workflow runs and call them from a bash script. Something like:
 

#!/bin/bash

../UUID-OF-TARGET-WORKFLOW/some_script "Hue Lamp 1 on"
../UUID-OF-TARGET-WORKFLOW/some_script "Hue Lamp 2 on"
# etc.
# etc.
Link to comment

I would like to have a workflow which when triggered, calls multiple other workflows. Is there a way to do this? 

 

I'm using the SmartThings workflow, which enables me to turn on/off lights. I want to be able to have a "shortcut" where it turns on/off multiple lights.

 

So currently i run: 

"st Hue Lamp on"

"st Hue Lamp 1 on"

"st Hue Lamp 2 on"

"st Hue Lamp 3 on"

 

What i want to do is run:

"st_hue"

 

 and in the background it runs all four of these.

 

 

 

You can either call Alfred with your queries, waiting a wee bit between calling each one. That's the simple way.

The better way is to figure out the script and arguments that your target workflow runs and call them from a bash script. Something like:

 

#!/bin/bash

../UUID-OF-TARGET-WORKFLOW/some_script "Hue Lamp 1 on"
../UUID-OF-TARGET-WORKFLOW/some_script "Hue Lamp 2 on"
# etc.
# etc.

 

If you are familiar with creating/building workflows, a simple alternative also may be to just use external triggers within your workflows. This would allow you to trigger a specific part of a workflow, from another, and even pass it data. These are triggered through AppleScript. You could have a single workflow keyword that executed N number of workflows or specific parts of workflows using AppleScript and their external trigger. I've used this several times to simulate "steps" in a workflow. You use one keyword, when it completes, calls an external trigger and launches the next step, and so on.

Link to comment

If you are familiar with creating/building workflows, a simple alternative also may be to just use external triggers within your workflows. This would allow you to trigger a specific part of a workflow, from another, and even pass it data. These are triggered through AppleScript. You could have a single workflow keyword that executed N number of workflows or specific parts of workflows using AppleScript and their external trigger. I've used this several times to simulate "steps" in a workflow. You use one keyword, when it completes, calls an external trigger and launches the next step, and so on.

Don't any external triggers you've added to a workflow get deleted when it's updated?

Link to comment

They shouldn't do! I just did a quick export and import of a workflow and the external trigger was intact.

 

That's not exactly what I meant.

 

If you've installed one of my workflows, but added your own External Trigger(s) to it. When I release a new version and you install it, your External Triggers will be deleted.

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