One of the things I do to keep up with my expenses is to always save my receipts. Well, truthfully, I’m pretty bad about it when it comes to actual physical paper. But receipts in the form of bits I can handle.
For a long time, I did this by hand. Back in my PC days, I would save a web archive or whatever its called when you all of the images and formatting are saved locally as a single entity. But it’s kludgy. After I got my first Mac back in 2001, I was thrilled to use all of the PDF capabilities that are built right in. For example, anything you can print, you can also save as a PDF. This made saving receipts really easy. Checkout from Amazon type Cmd-P to print, and select Save as PDF from the drop down menu. Easy peasy.
But this process really lacks grace. Every time I save a receipt I have to remember where I keep them, navigate to the folder, and then save. Plus, I have 3 different types of receipts that I save - deductible, expensable, and other.
Automator to the resuce!
To solve my woes I turn to Automator, Apple’s built in, powerful, visual scripting tool for the Mac. I don’t want to have to navigate folders and remember where I keep each kind of receipt. Plus, I want all receipts organized by day. But I don’t want to have to remember what day it is or to have to type the date in. I’m using a computer for goodness sake. These are simple problems to solve.
- Fire up Automator.
- Choose Finder > Get Specified Finder Items and drag it into a new workflow
- Choose Automator > Run Shell Script and drag it into the same workflow
- Open the Run Shell Script expand arrow and select:
- Shell: “/bin/sh”
- Pass input: “as arguments”
Now paste this script into the shell script window. (Remove the space between “i” and “r” on line 5 - wordpress doesn’t like for me to even mention making directories in code)
# Figure out where to save the file. Expenses organized by day.
DATE=`date +%Y%m%d`
FOLDER=~/ESC/Expenses/$DATE
# If the folder doesn't exist, create it
if [ ! -d $FOLDER ] ; then
mkdi r -p $FOLDER
fi
# The name of the PDF file is passed as command arguments
mv "$*" $FOLDER
Now save it as a PDF Workflow.
This little Automator action makes life so much easier. I have 3 of them, one for each kind of expense. Whenever I want to save a receipt, I just print and choose “Save to Expenses”. A directory for the date is created if it doesn’t already exist, and a PDF is saved in the proper folder without any intervention on my part. I love it!
Filed under osx, mac, hacks | No Comments »