How to get the amount of selected files in automator
Solution 1:
You can use the following Apple Script to set a variable (named item_count
) to the number of items returned from the previous action:
on run {input, parameters}
set (value of variable "item_count" of front workflow) to (count of input)
return input
end run
The list of items is simply passed through.
You could use it like this:
Solution 2:
Not sure if the way Automator handles variables in Apple scripts has changed since @hop answered in '14, but setting the item_count
variable as an action seems to work better.
on run {input, parameters}
return count of input
end run