Jump to content

How to call workflow A in between workflow B?


Recommended Posts

Posted

Hello, I'm quite new to Alfred and am struggling with the following: I have a Workflow (A) that creates a one-time link and copies that to the clipboard.

Now I need to call that workflow from another one (Workflow B ) where I want to create an Email content where that one-time link is being used. I found out about External Trigger and I'm able to start the workflow A from the second one (B) but currently I don't see how I can proceed with the outcome from A within B.

Any ideas, links, examples welcome!

 

Thank you very much, McAlm

Posted

You can’t have Workflow A be completely independent from Workflow B if you need information to flow in that direction. In other words, just like you’re using an External Trigger from B to A, the solution is to add another from A to B, with the argument or some variable filled out.

 

Or, since the result of A is saving to the clipboard, you can just add a delay in B then check the clipboard. Slightly hacky, but unlikely to fail and you should notice if it ever does.

Posted
12 hours ago, McAlm said:

but currently I don't see how I can proceed with the outcome from A within B.

Any ideas, links, examples welcome!

 

I think you have the wrong mental model of how it works. External Triggers are one-way, fire-and-forget. In some circumstances, you'll get an error if you try to call an External Trigger that doesn't actually exist (in others, you won't), but that's it. You can't get anything back. The call doesn't even wait for the workflow to run before returning.

 

So the only way workflow A can get something from workflow B is if B provides a way for A to tell it to call A back with the data. Or write it to somewhere A can read it. My Firefox workflow implements both of these methods so other workflows can call it to get info about the active Firefox tab.

 

The way Vítor suggests is much easier, but it can be improved on by monitoring the clipboard for changes instead of just waiting for a bit and hoping.

 

Put that script in workflow B and edit it to run workflow A (instead of simulating ⌘C). It will wait till A changes the clipboard, then continue.

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