Q: Automator: use variable & selected files as parameters for shell
I rarely use Automator, but it's useful for creating services.
I have a shell script that tags files, and in a service it iterates over selected files in Finder.
What I can't get my head around is how to ask the user for the tag to be applied (either as a literal or select from list) and then pass this as well as the file list to the shell as a parameter.
MacBook Pro (13-inch Late 2011), OS X El Capitan (10.11.3)
Posted on Feb 10, 2016 4:38 AM
Just tested and looks like the Text is the last item.
Also, my counting was off.
This script should work:
count=0
for f in "$@"
do
file[$count]="$f"
let count++
done
let count--
j=0
while [ $j -lt $count ]
do
echo Text is "${file[$count]}" and File is "${file[j]}"
let j++
done
Here's the Automator Workflow I tested with:
Posted on Feb 10, 2016 7:24 AM




