Jump to content

Dynamic Input for Automation Tasks?

Recommended Posts

Hi Alfred team, thanks for making Automation Tasks. These modules are so good and have replaced multiple workflows for me very quickly. l ❤️ them.


I was trying to make a workflow that converts the image format based. I was trying to to use "Convert Image Format" Automation Task. Basically, the user enters the image format and it should be an input to this Automation Task and tell it to set that as the output format. How can I achieve this? Right now, I have to set it manually for each type.


Also, noticed there are other Automation Tasks that have the same barrier. Would be great if we can pass in the input to them. 




Link to comment

I figured out one hurdle after looking at other workflows by Vero and Vitor. Seems we can add a JSON config and set the desired variables.  The only problem I am facing right now is that I want to save the file in the same directory where it is now. I tried adding `save_in` to the below config, but it didn't do anything


  "alfredworkflow" : {
    "arg" : "{var:image}",
    "config" : {
      "tasksettings" : {
        "save_in" : ".\/",
        "out_format" : "{query}"


Edited by andy4222
Link to comment
20 hours ago, andy4222 said:

I tried adding `save_in` to the below config, but it didn't do anything


It did. It set the directory relative to the automation task itself. You need to give it the full path to the directory to save to.

If you need the path to be dynamic, in version 2022.8 of the Automation Tasks (just released, you can update now), I’ve added a Get Path Dirname which will allow you to pass it the path to a file and only get its directory path. You’ll need to make use of the Argument and Variables Utility and Split Argument to save them beforehand and restore as different arguments for the conversion.

Link to comment

Superb. It works!! The `Get Path Dirname` was enough. I didn't need `Split Argument`. Screenshot below


Automation Tasks are so good. Thanks for blazing fast releases @vitor


I also wanted to check if there is any documentation or guideline on how to create/contribute Automation Tasks? Seems they are basically a config that Alfred reads internally and I opened a bunch of them but some contains a minified shell script and some contains a different script. Any possibility of a different language like JS or Python?




Link to comment
2 hours ago, andy4222 said:

I didn't think the args passed in by the Universal Actions are split by `Tab`.


They’re not—they are separate arguments in an array. But environment variables can only be strings, so to save the list of files in a way that is parseable by a Run Script down the line you need a join character to later split on. Check the second line of the top help text in an Arg and Vars object:



If the input is of type array, {query} will be converted to a tab separated string.


It’s the Arg and Vars making it tab-separated, not the Universal Action.

Link to comment
  • 1 year 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...