Jump to content

Keyword that "calls" other keywords within the same Workflow (Workflow cheatsheet)


Recommended Posts

I have a workflow that contains multiple keywords, each one performs a small/quick action and/or opens an internal tool in my company. There's around 20 keywords at this moment.

One of my peers asked if I can implement a "cheat sheet" of sorts, where they don't have to remember the keyword for a specific tool, but can search for it. For example:
 

  • Cheat sheet keyword: wfl
  • Tools:
    • tl1 - Tool1
    • tl2 - Tool2
    • tl3 - Tool3

 

They would like to type "wfl Tool1" and when pressing enter, activate/autofill/substitute what they have typed with the "tl1" keyword, so they can type the argument and execute the workflow for that keyword. If Alfred was able to fuzzy search keyword/hotkey input Titles, it would do what they expect already, but alas it is not the case at the moment. I know about ?keyword, but actioning it, goes to the workflow, doesn't copies the keyword (and also doesn't search the Title)

At first I can easily create a script filter, parsing a csv (or variable) that contains tool,description, and pass that as a {query} to the next action, but the I don't know what is the best approach after that. I though about two possibilities here:

 

  1. Have a giant conditional block that receives query, exact matches it and links to every other keyword in the workflow. (Ugly, messy and a pain to maintain)
  2. Don't call anything, just copies the keyword to the clipboard and expect the user to open alfred again, paste the keyword and continues with the desired workflow action.

 

Is there another, more elegant, way to reach the same or similar goal?

Link to comment

Hi @MetalRufflez that should be possible by parsing the info.plist file. I have a couple of questions:

1. Are all the 'tools' part of the same workflow, or in different workflows? 

2. What do you have after the keyword? A script filter? 

3. When you mention 'Tool1' as the name of the action, which text are you referring to? The text in 'Placeholder Title', if the tool is a script filter? 

4. Are the various keywords set in the workflow objects, or in Workflow Configuration? 

Link to comment

1. All the "tools" are part of the same workflow. As it is easier to distribute this tool amongst my organization
2. Depends on the "tool", most open URLs with an item selected from a filter or passed by the user, others to external scripts or filters

3. Either "Placeholder Title" for Script Filters or "Title" for Keywords

4. Workflow objects. I thought about setting variables for each one to make it more customizable, but decided against it (for now).

 

The screenshot below is a part of the workflow and each keyword or script filter that starts a "flow" is what I consider a "tool".

Sorry if I'm not using the correct terms to describe what I'm trying to explain here, long time user, first time workflow developer :) (also, ignore the loose script in there, I was debugging stuff and forgot to delete it).

 

alfred_workflow_blurred.thumb.png.d35db068df4b3234e9375dbf9219006a.png

 

Generating a list of all available keywords/tools is the lesser issue, as I can always just keep it updated manually (although that's suboptimal). I don't see how I can start one of these "flows" from an item selected in a list or a script filter.

Link to comment
40 minutes ago, MetalRufflez said:

Generating a list of all available keywords/tools is the lesser issue,

if you don't mind creating and maintaining a list filter with all the object names and keywords, you can do the following:

  1. for each of the 'tools' you want to launch, right click to set an external identifier in 'Inbound Configuration...'
  2. create a Call External Trigger object. Use the trigger Id of any of the 'tools' in your Workflow you set in #1
  3. right click on the Call External Trigger object and select 'Copy Configuration' 
  4. create a JSON config object
  5. replace the JSON text with your clipboard (which should have the 'Copy Configuration' string you copied earlier)
  6. within the new JSON text, replace the tool name you selected in #2 with {query}
  7. connect your list filter (which will have the keyword as Titles and all the object names as arguments) to the JSON config object
  8. connect the JSON config object to the Call External Trigger object, like this:

image.thumb.png.43efcf6053561a25e349a3b5878c6d8c.png

 

Now, actioning one of the keywords from the list filter will launch the corresponding 'tool'. 

Next, if you want to generate the list filter automatically from the info.plist file, this can be done with a Python script. 

 

I hope this makes sense! Let us know if you run into trouble.

 

Edited by giovanni
Link to comment
  • 1 month later...

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