I am relatively new to KM. I want a simple way to tag files with one or more Tags. After reading a little, I created the attached macro. It seems to work sometimes but the growl notification sometimes doesn't show the tags that have been added.
Is there a way to trigger the macro automatically when a file is added to a folder (similar to Hazel)?
Is there a way to process more than one file by choosing them and looping through them one at a time?
Thanks for any help.
Add Tags To File.kmmacros (4.6 KB)
1: Use display text briefly instead of Growl is an option
2: You could either add the files via Keyboard Maestro, in which case you know they have just been added
or if you started with and empty folder, you could setup a time loop to check if folder is non empty.
3: See Working with the Finder Selection
Instead of KM, You might consider using a Applescript Folder Action Script.
These type scripts are designed to trigger automatically as you requested.
You can also use the AS “display notification” command reliably.
Thank you. I’ll try that.
I agree. It seems like a natural application for a “Folder Action.” I tried to do this myself with no luck. Thinking it was a pretty common requirement, I thought someone might have already done it and posted on the Internet but no luck there either.
Thanks for the reply and suggestion.
The attached KM macro does what I want for a single finder selection. I'm posting here just to say thank you for your help. I know it's a very, very basic macro but with minor tweaks, it might help another newbie.
How would I modify this macro to handle more than one file? e.g. If two files are selected, prompt user for tags to apply to the first file. After tagging the first file, prompt user for tags to assign to the 2nd? etc. e.g. Don't assign the same tags to both files.
How can I trigger this macro to run automatically when a file is added to a specific folder? Automator Folder Actions seems like a natural choice (as MIichaelTX suggested) but so far, I don't see an Automator Action that will trigger this script.
Ultimately, I'd like to connect this to a document scanning workflow. I imagine two possible workflows:
- SINGLE FILE: After each scanned file is saved to a specific folder, this macro runs.
- BATCH: When one or more files are manually selected, this macro runs for each file in the selection. In this case, I'd probably want the option to view the file (Quick View) to help the user assign tags properly. The macro would loop through the selection - allowing the User to assign different tags to each file in the selection.
Thank you again for your help and suggestions.
Add Tags To File.kmmacros (4.4 KB)
The macro you sent handles multiple selected files. That is what the For Each part is.
Depending on whether you have the Prompt inside the For Each (like you do) or before the For Each will depend on whether you are asked for each file (like your macro does) or asked once.
Keyboard Maestro does not have any trigger for when a file is added to a folder. It is on the todo list. You will have to run the macro either manually, periodically, or via some other mechanism, or use a different tool like Hazel.
That is what your macro does now.