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

PressWise

A 30-day Fix for Managed Chaos

As any print professional knows, printing can be managed chaos. Software that solves multiple problems and provides measurable and monetizable value has a direct impact on the bottom-line.

“We reduced order entry costs by about 40%.” Significant savings in a shop that turns about 500 jobs a month.


Learn how…….

   
Back
Top