3

I created a workflow to move items from one folder to another and I want to get a notification when it's done. I could create the workflow without problems but now I would like to show the number of moved files on the notification pop-up.

How can I get the number of files?

Basically I'm copying downloaded files to a "Downloads" folder on iCloud Drive. After the files are copied, I would like to show a notification saying "{NumberOfFiles} moved successfully."

enter image description here

  • Can you add a screenshot of your workflow? – nohillside Oct 10 '14 at 18:28
  • Are you thinking of something like Apple Script (as action in Automator) that counts the files and displays the result in Notification ? – Ruskes Oct 10 '14 at 20:51
  • That could be, but I don't know how to create the script. – Danilo Moreira Oct 10 '14 at 21:38
2

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:

enter image description here

  • This nice, but missing the part how to show the result in the notification pop-up – Ruskes Oct 11 '14 at 1:13
  • @Buscar웃: uhm. how do you mean? – user94148 Oct 11 '14 at 16:28
  • Thanks! I guess that I just need to add the item_count variable to the displayed text on notification pop-up and it's done. I will try and let you know. Thanks again man. – Danilo Moreira Oct 11 '14 at 21:04
1

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

Count number of items in Automator with AppleScript.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .