andy4222 Posted July 24, 2022 Share Posted July 24, 2022 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
andy4222 Posted July 24, 2022 Author Share Posted July 24, 2022 (edited) 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 July 24, 2022 by andy4222 Link to comment
vitor Posted July 25, 2022 Share Posted July 25, 2022 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
andy4222 Posted July 26, 2022 Author Share Posted July 26, 2022 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? vitor 1 Link to comment
vitor Posted July 26, 2022 Share Posted July 26, 2022 8 minutes ago, andy4222 said: I didn't need `Split Argument`. You will only if you want to do it to multiple images at once. 9 minutes ago, andy4222 said: I also wanted to check if there is any documentation or guideline on how to create/contribute Automation Tasks? https://github.com/alfredapp/automation-tasks/issues/1#issuecomment-1169951134 Link to comment
andy4222 Posted July 26, 2022 Author Share Posted July 26, 2022 35 minutes ago, vitor said: You will only if you want to do it to multiple images at once. You are correct, it does not work on multiple files. I tried fiddling around but can't figure out the format on how to split it, save it and send it to automation task. Any help would be appreciated Workflow: https://www.dropbox.com/s/qxem2p2bamp5yqw/Image Operations - COPY.alfredworkflow?dl=0 Link to comment
vitor Posted July 26, 2022 Share Posted July 26, 2022 Fixed Workflow, with annotations. Do ask if anything is unclear. Screenshot for object reference: Link to comment
andy4222 Posted July 26, 2022 Author Share Posted July 26, 2022 This works! I didn't think the args passed in by the Universal Actions are split by `Tab`. I thought they'd be new line or comma as that is what it was showing in the debugger logs. Thanks Vitor! Link to comment
vitor Posted July 26, 2022 Share Posted July 26, 2022 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: Quote 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. andy4222 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now