• Best Wishes to all for a Wonderful, Joyous & Beautiful Holiday Season, and a Joyful New Year!

Apple Automator + Multiple Variables?

Stephen Marsh

Well-known member
Using Automator, I can run a shell script (bin/bash) as arguments and have a single text variable dialog box appear to be populated by ONE input value.

I have attached a screenshot.

Is it possible to enter in multiple inputs, perhaps separated by a comma? Example:

Keyword 1, Keyword 2, Keyword 3 etc?

How I currently have things setup, if I enter comma separated values a single keyword is created that reads:

Keyword 1, Keyword 2, Keyword 3

However, there should be three separate, individual keywords applied:

Keyword 1
Keyword 2
Keyword 3

I was hoping to avoid hard-coding in multiple variables, as it would vary, one image may only need a single entry, while another image could use more or less variables.


Thanks in advance,

Stephen Marsh
 

Attachments

  • auto.jpg
    auto.jpg
    290.6 KB · Views: 455
Last edited:
Hello Stephen,

​I think that this is do-able but Automator lacks the "if /then" logic to handle the variety of multiple input strings for this task.

I think you will need to add some AppleScript into the Automator Workflow to manipulate the input strings so that they suit your bash script.

The only other way round this would be to create a looping Automator Workflow which writes the input strings to individual text files. When you exit that Workflow then you automatically trigger a second Workflow that uses a filter to select the text files and then manipulate the contents to create the bash script.

You still require some AppleScript to do this, but not as much. The cleanest way is to use AppleScript but maybe you could prepare your input strings in a text file or excel file instead of using the.input text box?

It has been a long day, so I do hope that makes some sense to you.

Cheers

Tim
 
Thanks Tim, this is not a big deal, just looking to tighten things up a bit if at all possible. I was happy enough to work out how to turn ExifTool CLI commands into Services for the GUI, then I thought, hey – how about adding a variable. That worked great with some experimentation. So I then I thought – how about multiple inputs? This is as far as I could take things with my limited knowledge.


Stephen Marsh
 
Last edited:
The answer was “easy” in the end, I was trying too hard to do this via automator, when it appears that ExifTool already has the ability to split an input string that uses comma separator! Same end result, different approach!

So all I needed to do was add a simple -sep , -sep ', ' switch at the end of my existing command line code and ExifTool will automatically split a comma separated keyword input string into multiple, separate keywords.

So, “keyword 1,keyword 2, keyword 3 etc” will appear as separate keywords, rather than as a single string:

keyword 1
keyword 2
keyword 3



Stephen Marsh
 
Hey....well that worked out well in the end. I will have to check out the ExifTool and see what it offers. Thanks for posting the outcome.
 

InSoft Automation

InSoft Automation Unveils Imp Version 14

Revolutionizing Layout Planning and Automation

InSoft Automation announces the launch of Imp Version 14, the latest iteration of its industry-leading cost-based layout planning software. Packed with cutting-edge features, this release redefines efficiency, automation, and workflow optimization for printing and finishing processes.


Learn more…….

   
Back
Top