Statement Download part 2

So I am trying to get another Statement Download Macro working
Here's what I have so far...

Everything works up until the last step. Note that it's searching for an image but it didn't work so I tried using "Click Safari link" and using the text: "Online Statement Ready To View" but that fails too so I went back to the image method. I can't figure out why it's failing.

My question: If there are two links with the same text will the "Click Safari Link" fail? This is the only reason I can think of that would make it fail. Usually there's only one text link. It's also javascript so maybe I need to use some other method to select the linked javascript?

The element looks like this:

<a href="javascript:printVersion()"><img border="0" src="/images/icons/printer.gif">Printable Version</a>

Another question: On this particular site Saved Passwords doesn't work. They have it disabled somehow. So I have to login every time. As you can see from my macro I have elected to paste my user name and password which isn't very secure. Is there a more secure way to do this?

Thanks in advance!

Hey John,

Can you not post the actual log-in page?


Sure… it’s here:

Hey John,

You'll have to change your username and password to suit.

You'll also want to shorten the 'For at least' pause lengths from 3 second to whatever works consistently.

This method should be much more efficient than what you were doing. Give it a go, and let me know how it turns out.

Safari Log-In.kmmacros (7.1 KB)

If you want more security you can use Keyboard Maestro's ability to access the keychain, instead of setting variables to text.

NOTE: I'm deleting the variables at the end of the macro.

NOTE: The form-field-discovery menu:

Clicking the Safari v pop-up menu produces that menu IF there are form fields to be found. If there are NO form fields found it does absolutely nothing.

Peter – I really think it should say No Forms Found… or some such when no form fields are found. It's disconcerting when the button just seems dead and gives no feedback whatsoever.


Hi Chris,
Finally getting around to debugging the script from my end. I couldn’t figure out why it wasn’t working so I finally threw in the towel and installed your script so I could compare side by side. I thought I had typed things more accurately but apparently I didn’t. I had a small “i” where a capital “I” needed to be. I also put a period “.” where a hyphen was actually needed.

Do you mind if I ask what you use to read the JavaScript on the page? Do you just use the Developer menu in Safari and choose “Show Page Source” or do you have an alternative method or application that snags the JavaScript for you? Being able to copy the elements easily would probably reduce pilot errors.

On my list of things to do this year is to take a JavaScript course somewhere. Amazing how easy this stuff becomes if you are willing to put in that time.

Part 2 of sorting this out…

Once I get logged in and go to the appropriate page for statement downloads, the downloads are listed with any statements that haven’t been viewed. In this case there are two statements I haven’t viewed and the link html reads as the following:

<a href="/cowww5/viewers/viewdoc.asp?AppID=128&amp;PrimaryKey=10958024">Partners Online Statement Ready to View</a>

How do I click the link or send the command to click the link titled “Partners Online Statement Ready to View”?

I have two statements sitting there. It reads like this on the page:
“Partners Online Statement Ready to View”
“Partners Online Statement Ready to View”

so I can likely test at least once but after that the text will disappear since it clears after all the statements are downloaded. It will reappear next month when the next statement is available.

I'm not sure if this will meet your needs/requirements, but you might want to checkout this service which is designed to download statements from a wide variety of sources:


I am aware of the site and I am a member. My goal is not to have my financial documents on anyone’s cloud. As it is, I already use ShoeBoxed but just for receipts because there aren’t Address and Account numbers listed on receipts. Bank and Credit Card Statements however are a different thing altogether. They have your name, your address, and often enough of an account number that the rest can be culled from other sources. If I were ok with having all that data out there I would probably just go for Mint which also does the same thing.

In addition they also scrape your account information to sell a profile to banks and financial services about you. :smiley:


This would be great. I am just not sure how to complete the fields for the Set Variable To Keychain Password panel.

I had no idea they did this. I am investigating, and if I can confirm then I will cancel my account. Do you have a source for this information?


I was referring to Mint which is rumored to be doing this and it makes sense because of the type of offers I am now getting spammed with because of signing up only one account on Mint.

If you would like to discuss this further, please message me. I would rather not muddy up this thread with discussions that are off the topic of the Statement Download script I am working on. I am happy to discuss it further if you like. It just doesn’t seem relevant in a thread others may reference to help solve their issue. Does that make sense?

Hey John,

Open the Keychain

Get-Info on the password you want to use.

Use the Name and Account specified in the Get-Info panel.

When you first run your macro you'll be asked to permit Keyboard Maestro to use the KeyChain for that item.


1 Like

Hey John,

In post #4 I'm using Keyboard Maestro's built-in form-field-discovery menu.

Otherwise I use the developer tools in Safari, Chrome, or Firefox.

Once those are active you can use the Contextual-Menu to Inspect Element and save yourself the trouble of parsing the entire source.


Sorry, I violated one of my own rules to stay on-topic. It makes sense and I agree. Will PM you with response I got from FileThis.

I actually got that far. (How was that possible for me?) :smile:
Where I am confused is what to do with the stuff that's pre-populated. In this case:
"Set variable to: Variable"
"To Keychain Password named Password Name [in this case the link ] "" [then] "(JohneDoe)", [my userID in parenthesis]
with the remaining line "account:" populated with %UserLoginID%

So do I need to do enter anything in the Variable field or is that just a user defined description or does it require some absolute value? I assume what I put on the second line was correct [ (JohnDoe) ], am I right?

Then... I will hazard to guess that %UserLoginID% requires no modifications on my part and it will snag the UserLoginID and populate the field. Or would I need to change it to %JohnDoe%

Or have I got all of this munged into abstract wall art? :sunglasses:

Ah, I see... So nothing exotic then. I am guessing your built-in form-field-discovery menu looks different because you're using version 7.x of Keyboard Maestro. I haven't installed 7.x yet because I haven't upgraded OS X.

01/21/2016 4:07 PM UPDATE: I installed Yosemite today and see that my newer version of Keyboard Maestro which I just installed does looks like yours now.

No apology necessary JMichael... I really do appreciate your contributing the service link. Someone will get something out of it for sure!

Ok so here’s the latest. The bank whose statement I was trying to download finally fixed the page so that after I click login, it calls the keychain and autofills the password. So I no longer need to fill the password in. does it for me.

Chris’ script worked great but I elected to re-type just so I could sort out what was happening and learn from it.

Chris mentioned being able to use and that seemed like a better idea rather then putting the password in the macro so I tried to implement that part.

I couldn’t get it to work though when I was doing the typing so in the process of reading the documentation and then finally finding Peter’s examples on using Keychain manager, I completely re-wrote everything.

So now when the macro runs when the user ID is entered the password auto fills.

Next, I was able to use the “Click Safari Link” to get to the ‘eStatements’ page. Then I was able to use it again to click on the ‘Oniine Statement Ready To View’ link on the subsequent page. (If I miss a month there is more than one link called ‘Oniine Statement Ready To View’ which will not be a problem once I get the script working but for testing it’s a pain because once I test, the link goes away).

The last page I arrive on is the actual statement but it doesn’t display as a PDF nor does it provide a “download statement” link. Instead, They provide a “Printable Version” link, along with 3 other links to print each section (IRA, Savings and Checking).

They all appear to be running javascript to initiate the print dialogue. When I “inspect Element” by right clicking the print link I want, it gives me the following:

<a href="javascript:printVersion()"><img src="/images/icons/printer.gif" border="0">Printable Version</a>

I also note that it’s part of a table:


So how do I got about referencing this for the click?

Hey John,

No idea.

I think you can call JavaScript functions on a page, but I don't know how.

@ComplexPoint would have a better idea of what's possible there.


My first experiment would be to run an action like this from Keyboard Maestro:

Thanks @ccstone. @ComplexPoint: I tried it. It didn’t work. There are lots of frames/tables. Is it possible this could be complicating things?