MACRO: Rename and move downloaded statements

As many of you do (I suspect), I download and file statements from companies we do business with—credit cards, banks, stores, utilities, etc. Doing this every month is an annoying task, as every site is different. I once created a complicated macro that fully automated this task…but it broke nearly every month, as the sites change their structure so often.

So I gave up on that, and I just manually download them each month. For some companies, this works fine: The statement download shows the standard macOS file picker, so I can both name and move the file in one action.

(I'm aware of Hazel, but prefer to use just one app to handle my automation. I could also watch the Downloads folder in Keyboard Maestro, but I download a lot of stuff and don't need the macro running on every download, even if only to check that it doesn't need to run.)

Sadly, most statements are simply downloaded when clicked, without any chance to set a filename or location. You wind up with files named like "statement.pdf" or "document1.pdf" etc. This macro handles those types of statements: It greatly eases the renaming task, and then moves the renamed statement to the proper folder. Here's how it looks in action:

GIF of renaming and moving statements

statement_filing2

The attached macro group contains two macros: A demo macro, and the real macro.

Macro

app-Finder Statement Renaming Macros.kmmacros (69 KB)

Macro screenshot

To test the macro, enable the demo macro, which creates a series of folders in the /tmp folder. Next, duplicate some small text files (or create empties in Terminal with touch file1.pdf etc.). Select one file, then run the macro.

You'll be prompted to pick the company name from a list, and then enter the statement date, which defaults to the current year and prior month number. The macro will then rename and move the file; to see the final result, in Finder select Go > Go to Folder and enter /tmp. Once that folder opens, open statement_demoRG to see the filed statements.

After testing, run the test macro once more, and you'll be prompted to delete the test folder setup (or just run the macro again, if you want to test more). Delete or deactivate the test macro, and activate the real macro. Edit the green boxes in the macro to reflect your setup.

The macro is set up to name things in the format of Company name - YYYY-MM. However, it can also handle custom formats, like adding the day (see the Schwab entry), as well as storing documents outside your normal Statements folder (again, see the Schwab entry).

The default shortcut key is Shift-Control-R, and it's in a group set to be active only when Finder is frontmost.

I'm still annoyed by downloading statements, but this macro does make it slightly less annoying :).

-rob.

3 Likes

Ditto. I alleviate that some by using repeating calendar entries for each statement with a hyperlink to a macro for logging in and downloading the statement. Then it's up to Hazel. :wink:

This is what I had before, but it seemed at least one of the companies changed their layout format every month, meaning I had to rework the macro. It should be a law that statement download URLs should be predictable and never-changing :).

-rob.

Be careful what you ask for, @griffman. :wink:

I worked in a highly regulated industry. You triggered some flashbacks. :triumph:

1 Like

I did not know that it was possible. How do you monitor the downloads folder ?

thank you

In theory, it's as easy as this:

In reality, I've had issues with macros triggering before files were completely copied into the destination. I worked around this by running a loop that gets the file size in Terminal, and stops the loop when the file size stops changing. See the AppAdd macro in my AppWatcher suite to see how I did that.

-rob.

1 Like

very sophisticated !!