Automate Archiving Bank Statements to Evernote in macOS

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.

Demo video

When I drag the downloaded statement files into the “Dropbox” folder, they get automatically archived to Evernote and then deleted from the folder.

The solution

… 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.

Then here’s the slightly more tricky part. AFAIK, AppleScript is not particularly good at processing strings. And because I know JavaScript better, I decided to parse the statement filename in JavaScript.

What I need is the date info in the filename and make sure the filename looks like what I’m expecting. That’s what parseFilename in 2 - Parse filenames and save to evernote.js is doing.

So why do I need 1 - Get paths and filenames from aliases.scpt at all? Well, this is embarrassing. Half way into the JavaScript I realized that I can’t use 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 "thePath".

The Automator Workflow

The code

Meteor: Publish Empty Collection for Inserting Only

I’m writing a meteor app and ran into a problem where I only need a collection reference to be able to insert new documents into it. I don’t need to read any data from the collection. I think by publishing an empty collection would save the effort in synchronizing data between the server and the client which would make the app more efficient. I couldn’t find anything helpful by Googling so I came up with something myself and so far it seems to be working just fine.

Here’s how:

(Code clip removed)

I’m simply adding a filter that’s always going to get me nothing. I guess I would never have attribute undefined defined on any documents, so that would work for me.

Hope you find this helpful. 🙂

Actually you don’t even need a subscription in order to insert, as long as the server side has the same collection defined as the client side. Didn’t know that.

Full Screen Clock Update 1

Changelog

added 24/12 hour mode switch
added displaying date switch
added displaying week day switch

On-page to-do list will be remove once everything is done.

Previews

To-Do List

  • switch for 24/12-hour mode
  • switch for displaying date
  • switch for displaying week day
  • change foreground/background color
  • customizable font family
  • user theme
  • timer and stopwatch
  • save settings with html5 local storage

Web Full-screen Clock

A few days ago I found this Chrome Plugin Digital Clock. You can also use it directly with this link. Pleased by its amazing effects, however, I don’t like the advertisements on that page and the fact that it only supports Google Chrome for some reason. So I decided to make my own, without advertisements, with better compatibility and hopefully richer features.

Here’s a screen shot of what’s done so far.

You can find the developing version here.

To-Do List

  • switch for 24/12-hour mode
  • switch for displaying date
  • switch for displaying week day
  • change foreground/background color
  • timer and stopwatch
  • save settings with html5 local storage

Javascript Porter Ver 2.0

Source Code

Instructions

This program search under the preset folder (JSFILEFOLDER) for requested files and send them in order.
This program accepts 3 arguments: l(link list), duplicate and compress.

Arguments

  • link list

    A list of names of Javascript files needed to be gathered. Do not include file extension (.js), separate with commas.

  • duplicate

    Allow duplication or not (i.e. when the request is “A,B,A”, if duplication is not allowed, the last duplicated A will be ignored). Acceptable values are true | yes | false | no, default is no.

  • noheader

    disable header. Acceptable values are true | yes | false | no, default is no.

  • compress

    Level of compression. Add 1 to remove comment blocks; add 2 to remove comment lines; add 4 to remove indents; add 8 to remove line breakers. i.e. if need to remove all comments, use value 3 (Add 1 and 2). Default value is 0 (no compression).

Request Example

js.php?l=jquery-latest,yui-latest&duplicate=true&compress=15&noheader=true

jquery-latest.js and yui-latest.js are requested, allowing duplication, at compression level of 15 and disable header

Change Log

  • Now supports file inclusion, which implements “file dependency” functionality.
    Add single-line inclusion commands to include necessary files. Its syntax is:

    //#include <filename>
    //#include_once <filename>

    filename is the name of the Javascript to be included, without extension .js.
    When using “#include_once”, the file will only be included when that file has not yet been included before.

    If loading file A, B and C, while A and B both need to include D, when processing the “#include_once” command in file B, D will not be included again.

    The inclusion command is find recuisively; if the file being included needs to include other files, those file will be loaded first.
    If any file that is need by one file fails to be loaded, either not existing or unreadable, the whole file is considered failing to be loaded.

  • Change the header to console commands.
  • Added a switch to disable header.

Known Issues

  • It is not recommended using pending in-line comments. In-line comments should take their own lines. Otherwise do not use compression.

Javascript Porter Ver 1.0

Ver 1.0(Source Code

This program gathers and sends multiple Javascript files on demand, which benefits webpage loading speed in the way of avoiding unnecessary requests and reduces the amount of Script tags on pages.

Instructions

This program search under the preset folder (JSFILEFOLDER) for requested files and send them in order.
This program accepts 3 arguments: l(link list), duplicate and compress.

Arguments:

  • link list

    A list of names of Javascript files needed to be gathered. Do not include file extension (.js), separate with commas.

  • duplicate

    Allow duplication or not (i.e. when the request is “A,B,A”, if duplication is not allowed, the last duplicated A will be ignored). Acceptable values are true | yes | false | no, default is no.

  • compress

    Level of compression. Add 1 to remove comment blocks; add 2 to remove comment lines; add 4 to remove indents; add 8 to remove line breakers. i.e. if need to remove all comments, use value 3 (Add 1 and 2). Default value is 0 (no compression).

Request Example

js.php?l=jquery-latest,yui-latest&duplicate=true&compress=15

jquery-latest.js and yui-latest.js are requested, allowing duplication, at compression level of 15.

Known Issues

  • A simple compression function is used which may cause unexpected damage to the document causing the whole script file to fail. It is recommended not to use the compression feature until this issue is fixed.