I’ve been manually archiving bank statements (PDF files) to Evernote for a while. And frankly it’s taking me a fair amount of time to do it “properly”. By that I mean:
- One statement saved in a single note.
- Note name should reflect which card/account the statement is from.
- Note name should reflect which period the statement is from.
- Note should have proper
Creation Date matching the statement. It helps sorting.
- Note should have proper tags to help searching.
So it’d take much longer than just using Evernote to clip the PDF files.
And finally I got tired of it and decided to automate this.
When I drag the downloaded statement files into the “Dropbox” folder, they get automatically archived to Evernote and then deleted from the folder.
… is fairly straightforward.
Step 1: create a
Folder Action in
Automator to watch new files for a particular folder.
Step 2: for each of the new files, create a new note in an Evernote notebook with that file as the attachment.
Since this is a pretty generic step, I created a
Script Library for it. See
Evernote.scpt in the code below.
In my case I want all statements to be in the
Finance notebook and tagged with the bank info and some extra tags to help searching. I want the name of the note to be some identification of the card and the date of the statement.
What I need is the date info in the filename and make sure the filename looks like what I’m expecting. That’s what
2 - Parse filenames and save to evernote.js is doing.
So why do I need
nodeJs modules like
path to help me with parsing the input file paths. Manually splitting the string looks messy. Eventually I learned that getting the filename from the path is very easy so I added this extra step to convert the list of aliases to a list of descriptors that have both the path info and the name info.
I encountered a strange exception here: when I tried to save the original alias into the
path property of the descriptor,
Automator simply crashes.
Another caveat is, given the way of reading a property from a descriptor is
propName of descriptor, the property name can’t be some pre-defined keywords, such as
path. So I had to change it to