Jump to content

Calling a Workflow from another Workflow


Recommended Posts

Posted

Is it possible to call an external workflow from within a workflow then manipulate the external workflow's returned results before displaying them? For example, to have a global live search workflow that returns suggestions from several other live search workflows.

Posted

Is it possible to call an external workflow from within a workflow then manipulate the external workflow's returned results before displaying them? For example, to have a global live search workflow that returns suggestions from several other live search workflows.

 

Not exactly; you can include the other workflow's scripts in your collective workflow, but one workflow cannot call another.

Posted

Is it possible to call an external workflow from within a workflow then manipulate the external workflow's returned results before displaying them? For example, to have a global live search workflow that returns suggestions from several other live search workflows.

 

I prefer to use an osascript which tells Alfred to search for the workflow that I want.

 

Screen_Shot_2014_01_04_at_12_24_17_AM.pn

 

 

You can also specify a variable to your workflow search by adding 

 

& "{query}" 

 

to the end of your osascript.

 

So for example, if I wanted to call my QR code workflow and send a variable to the workflow, then I would do something like this...

 

tell application "Alfred 2" to search "qr " & "{query}" (qr is the keyword of my QR code workflow)

 

This would send my {query} to the QR workflow.

This might not be what your looking for, but it's a easy work around.

Posted

I prefer to use an osascript which tells Alfred to search for the workflow that I want.

 

 

You can also specify a variable to your workflow search by adding 

 

& "{query}" 

 

to the end of your osascript.

 

So for example, if I wanted to call my QR code workflow and send a variable to the workflow, then I would do something like this...

 

tell application "Alfred 2" to search "qr " & "{query}" (qr is the keyword of my QR code workflow)

 

This would send my {query} to the QR workflow.

This might not be what your looking for, but it's a easy work around.

 

Thanks for the reply! but no, this is not quite what I'm looking for. The main part I'm having trouble with is accessing the returned XML from one workflow in another workflow.

Posted

Thanks for the reply! but no, this is not quite what I'm looking for. The main part I'm having trouble with is accessing the returned XML from one workflow in another workflow.

 

In that case it depends if your script is for your personal use or for public use.

It's possible for you to gather the returned XML data from any workflow, but it requires using a lot of tricks and cheats.

It would be easier in the end to just copy what you need from the other workflow like Tyler suggested.

Posted

I agree with Ritashugisha.

 

However, you can also access the other workflow's files via the path "../uid/whichever-file-you-need." The problem is that the uids for each workflow are machine-dependent (I think), and so you'd have to write something to find the particular workflow's uid.

 

If you're planning on using it for yourself and not sharing the workflow, then you can hardcode the path.

 

However, if you want to make it available, then you should probably write a script to find the correct workflow file by dropping down the directory, scanning through all the workflows' info.plist files (look at PlistBuddy to help out). I'd recommend identifying it based on the bundleid, and I'd also recommend caching the path so that the workflow doesn't need to run the scan each time. Also, you'd probably want to put in a check so that if you can't find the other workflow on the system, it throws an error either in Alfred's window or in an Applescript pop-up and tell the user to download the dependency.

 

But, that's all convoluted. Just grab the files from the other workflow and integrate them into yours. Then you should probably give some credit to the other author as well.

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