March 17, 2023, 9:30pm
I'm racking my brain on this one.
Here's my situation:
When I receive invoices in my email, I save to my downloads folder.
If it has "Invoice" in the file name, Hazel automatically moves it to my desired folder.
If it doesn't have "Invoice" in the name, I open my downloads folder, and re-name it.
Is there a way for Keyboard Maestro to re-name the latest file in downloads folder by a typed string trigger?
I appreciate any help I can get on this one.
March 18, 2023, 12:13am
How about if you
prefix the file name with "Invoice_", which will help avoid name clashes? Set up a hotkey trigger of your choice:
Prefix Last Downloaded.kmmacros (2.6 KB)
Another approach would be to do the renaming as part of a "save invoice from email" macro, which would mean just one operation for everything rather than sometimes saving, sometimes saving and then renaming. How you do that will depend on how you handle your email.
March 18, 2023, 11:09am
That's EXACTLY what I was looking to do. This macro worked perfectly. Thank you so much!
kind of files are the invoice files?
March 19, 2023, 12:55pm
@Nige_S's solution proved to work perfectly. I'm very grateful.
@Nige_S' solution is working for you.
But keep in mind that Hazel can look inside (readable) PDF files, so it should be able to determine if a file is an invoice and do all the work in one fell swoop.