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

Last edited:

Tim-Ellis

Well-known member
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
 

Stephen Marsh

Well-known member
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:

Stephen Marsh

Well-known member
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
 

Tim-Ellis

Well-known member
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.
 

Color Optimized?

Ink
by Noel Ward, Editor@Large
Color is in demand in all types of documents, making color management a critical part of Digital Printing 5.0. Managing color on one device/press can be an easy task with the correct tools and processes. But managing color to ensure printed pages are consistent and repeatable across the different substrates and color gamuts of toner and inkjet can be a much bigger challenge. Properly implemented color management workflows can help achieve consistent color results across multiple devices. Although many end-customers are claiming satisfaction with “pleasing color,” two challenges are still in play. Link to Article

 
Top