Help with automation to download and submit invoices to work reimbursement

Hi,

I created an automation that mostly works, but there are a couple of very small bugs that I would very much appreciate some help with.

Every month, I need to go to the Verizon and T-Mobile web sites to download my bills. At which point, I want to rename them by date and store them in a folder. And then automate the creation of an email to be sent to a person at my work with the bills as attachments so I can get reimbursed.

Here’s what I did:

  1. Hazel looks in my downloads folder.
  2. When it sees a PDF named in a certain way, it renames the PDF and moves it to a folder
  3. Then, Hazel kicks off an automator workflow (see screenshot)
  4. The automator workflow creates a new email, ready for me to hit send, but it has two bugs: 1. it attaches the bill two times instead of once. 2. The font color for the text is grey instead of white (I use dark mode). I’ve tried a bunch of obvious stuff to fix the two bugs, but nothing seems to work.

Thanks in advance for any help!

Have you tried running the Automator workflow manually rather than via Hazel? i.e. disable the Hazel rule temporarily, Put an appropriate file in the folder, select it in Finder, and run the workflow. Does it still generate both of your issues? I’m just wondering if that could help you isolate whether the workflow is the issue or the calling from Hazel?

Some other things you could try in terms of swapping out the Automator workflow are utilising an AppleScript instead (example on StackOverflow) or via a terminal command (another fine example courtesy of Stack Overflow).

Hope that helps.

Thank you so much for the help in debugging. I did as you suggested and it looks like there’s an issue in both the Hazel and Automator parts of the automation.

With Hazel stopped and running Automator manually, I get a single copy of the attachment (which is good) but the weird font color (which is bad).

If you guys have any ideas, I’m all ears! Otherwise I’ll try the AppleScript option (never used that before).

Thanks

I recreated your process and it worked fine (I am using the Hazel 5 beta). Only suggestion would be to try adding a pause in the process, either after renaming the file or moving it to the new location.

Iain

Hi,

Thanks for the help. An update.

It turns out that the only automator action you need is New Mail Message. Somehow, with the rest of the actions disabled, the workflow knows to attach the PDF that Hazel just renamed and moved. I have no idea why.

Also, I’m thinking the text color thing is a dark mode bug. When I run the workflow in light mode, it works fine (black text on white background). But when I run it in dark mode, it changes the color to grey (on black background), and I have no idea why.

So if I can live with changing the font color manually, I think I’m good.