The new Folder Trigger seems a nice addition (v 7.0). But I’m still having difficulties bending it to my will. Question: Is there a way to access a collection of added files to work with in a For…Each loop.
My concrete use case: I want to add a tag to each file that gets added to a certain folder (without having to loop through all the old files that are already there).
(I know about Hazel but perhaps KM7 is capable of that too?)
Any hints are welcome.
There is no collection of files because the macro is triggered once for each file.
Here is an example:
Just use the Set File Attribute action and the %TriggerValue% as the path.
Wow, thanks for the fast reply and the helpful answer. I missed the %TriggerValue%. Just to make your hint a bit more clear and to help other people coming to this thread: In the Set File Attribute action you have to enter:
/path/to/watched/folder/%TriggerValue% as %TriggerValue% alone seems to return only the filename without the path and aborts the macro execution as it doesn’t find the file.
Sorry - thus proving even I don’t know everything about Keyboard Maestro ;-). Yes, just the name of the file. I could change it, possibly even should change it, maybe even might change it, but for now its definitely just the name, and so it will probably remain.
For the record, I did change this in 7.1 - from version 7.1 onwards, the full path of the Folder trigger is given in the TriggerValue token.