February 2015

02/14/2015 13:56:27

Automating Invoices With Hazel

I’ve been working on a new way to automate my invoicing system for a while now. It’s been annoying me that I have to do so much stuff by myself where I could just have the computer handle it for me. It may be discouraging to some because one might feel they miss out on an invoice, but honestly I haven’t because I still see every invoice.


Hazel is obviously the key to the system.

I don’t think I have talk about my invoice naming scheme, but TextExpander and Hazel are able to help me here:

%filltext:name=Invoice Date(YYYYMMDD):width=8% - %fillpopup:name=Payee:MasterCard:VVS:default=%%fillpart:name=Non-Predefined Payee?:default=yes%%filltext:name=Name:width=30%%fillpartend% %filltext:name=Invoice Number:width=15%%fillpart:name=Invoice Period% - %filltext:name=Start Date:width=8%-%filltext:name=End Date:width=8%%fillpartend%

In pseudo-blocks this means:

{{Invoice date in YYYYMMDD}} - {{Payee}} {{Invoice Number}} - {{Invoice Period Start}}-{{Invoice Period End}}

The good thing is that Hazel is able to do almost everything by itself. I would recommend that you check out my Hazel tutorial for the basic and other workflows, but this goes beyond my tutorial screencast.

I have a folder for invoices, named Filed Documents. Hazel is watching this folder for new documents coming in. I have several folders created for parties I receive invoices monthly, and I will only highlight one or two, as example. The others follow the same principles.

Invoices That Have All Information in Their Filename

When an invoice has all the important in the filename, it’s easy. Just setup a Hazel rule where:

NamematchesToken for invoice number - Token for payee - Token for …

Tokens allow to re-use text elements from the conditions, in the actions below. With a text token that matches 6 consecutive digits, labelled invoice number, you can use the rename action to use the invoice number token to set the new filename.

Note that you can also do a lot more stuff, as you can see in the picture:

Invoices That Have No, Or Almost No, Information in Their Filename

Thank you, everyone, for these by the way!

If I wouldn’t have Hazel, this would be much more complicated. Hazel is awesome in the way it can handle these types of documents, because Hazel has a condition where it can match the contents of a file.
As we’ve just learned, when Hazel can match something, we can make tokens out of it.1

In the worst case the filename only contains a 12 string long cryptic filename. (Kabel BW, you are the most awesomest folks of all!) Luckily the text inside the PDF is not as cryptic. Normally a payee would write things like:

Invoice Number: 23894239-W30

Hazel can search for this entire text, but it can also match it. Create a condition that matches for:

Invoice number{{anything}}{{8 digits, followed by "-", followed by 1 letter and 2 digits}}

Hazel will match this text and we are able to use it as an action. Of course the same works for invoice month, and year, too. You can get very creative here!

Invoices Where Hopfen And Malz is Verloren

The German saying “da ist Hopfen und Malz verloren” means “it’s hopeless”. Where it’s hopeless to auto-file, I have one more rule at the very bottom that looks for a {{4 digit}} token as year, and a {{2 digit}} token for the month. If Hazel find these, then I can at least sort them into the year and month subfolders. Oh well.

More on the workflow

This workflow is more elaborate as it looks, because my tax accountant needs to get new invoices regularly. This is why I also have a Copy action at the end. This copies all new invoices to a folder where I keep everything new, temporarily. Every 1st of the month I move everything to a new folder that gets auto-uploaded to my consultant, so she can work with it. (This goes beyond this post, but I’ll give you a glimpse on this auto-copying thing.)

It’s really not complicated. I watch this folder, and every first of the month at a specific time I sort everything into a subfolder. Another action runs a couple of minutes later and does the uploading.

  1. Want something even more powerful? Hazel has an option for “everything” this contains all the information Spotlight indexes, you can create tokens out of almost everything. 

02/11/2015 19:00:10

Replacing Slogger with IFTTT

This year I’ve been experimenting with an alternative to Slogger that, I think, looks more promising for the time being: IFTTT. IFTTT can pull from a lot of sources, providing enough metadata. Where IFTTT falls short because there’s no integration yet, or no API exists, we can fall back to RSS feeds.

That said, my current solution built on IFTTT is nowhere near perfect. What my version lacks is some sort of viewing capability. I merely record the most meaningful data in a somewhat standardized way.

Sidenote: If you are looking for an app that records all your activties from a couple of the most common social networks, then I would recommend to give Momento a shot. It’s been rocking social activity recording ever since it was released in 2011. An alternative would be ThinkUp, but you have to run this on your own server.

Also, have a look at Saga. The app is clumsy and ugly, but it does log quite nicely. It also integrates with Moves, and it has an IFTTT channel from which you can create new diary entries.

Where an Integration Is Available

When IFTTT has an integration, we can just use that integration to record everything to text file. The template is esentially like this:

some content
maybe some more metadata

I’ve done this for:


When the API is down, so is this solution. IFTTT is pretty dumb about its integrations. Meaning that when it can’t reach a service, it doesn’t try to “catch up”, i.e. it doesn’t fill in the holes in between. The YouTube API is really finicky. I don’t know why exactly, but for whatever reason, Google changes that particular API constantly, making clients break almost every month. IFTTT works very unreliably with it. Just saying.

I also had similar issues with RSS feeds. IMDb doesn’t care too much about their check-ins. The Watchlist is more important to them. Both have an RSS feed, but only one seems to be actively maintained.1
Same thing goes for GoodReads. RSS, yes, but doesn’t work so well with IFTTT. I presume though, that in this case, it is IFTTT’s fault, since I checked with curl and got an XML file back.

Anyway, I hope this helps some folks. It’s not perfect, nor is it beautiful. I hope I have a much better version for you soon, but we’re still trying to come up with it.

  1. Hint: It’s not check-ins.