Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old May 19, 2005, 09:11 AM   #1
sigamy
macrumors 65816
 
Join Date: Mar 2003
Location: NJ USA
Get Bank Balance with Automator and AppleScript

One of my first ideas for Automator was to have it login to my online banking site, get my account balances and then speak the current balance out. Privacy isn't an issue in my house

This would make my wife happy, she could just click one button and have the balances spoken out to her.

After finding out about some of Automator's missing features (can't input into forms, Safari actions didn't want to download from pages with frames) I determined that I needed an AppleScript to do most of the work. I borrowed some code and now I have it all working, except for logging off of the online banking site. I'll work on that part tonight.

My Workflow is:
1. Call AppleScript that: goes to URL, inputs UserID & Password, clicks 'login' button, waits a few seconds, then copies all text in appropriate frame.
2. TextEdit action to create a new document, paste text in from clipboard
3. TextEdit action to search for "$" (there is a bunch of junk at beginning of file)
4. System action for Text to Speech to have Vicki read my account balances.


It's not perfect but it works.
sigamy is offline   0 Reply With Quote
Old May 19, 2005, 07:37 PM   #2
snkTab
macrumors 6502a
 
snkTab's Avatar
 
Join Date: Nov 2004
Location: Cincinnati, OH
Just wait till your wife wants the computer to shop for her too. Then you are really in trouble. Make the computer tell your wife your balance is really half what it should be.
snkTab is offline   0 Reply With Quote
Old May 26, 2005, 03:58 PM   #3
swindmill
macrumors 6502a
 
swindmill's Avatar
 
Join Date: Mar 2005
Location: KY
I'd like to create a workflow that does this, but I have no idea how to create the script needed. Where can I quickly (as possible) learn how to do this?
__________________
27" iMac i3 3.2GHz | 11" MBA i5 1.7GHz | 20" ACD | TV2 | iPhone 5S 32GB Black | iPhone 5 64GB White | iPad 2 64GB 3G | iPad Air 32GB
swindmill is offline   0 Reply With Quote
Old May 26, 2005, 08:07 PM   #4
wheezy
macrumors 65816
 
wheezy's Avatar
 
Join Date: Apr 2005
Location: Alpine, UT
I like this, and I'm going to try this...but, Applescript, that's the problem. How do I write an Applescript to fill in the fields, and then press the login button?
__________________
MacBook Pro 17" 2.4 i7, 16GB, OWC 120GB SSD+750GB HDD * iPhone 4S 16GB White
Canon 7D * 17-40 F4L, 135 F2L, 50 1.4 USM * PCB Einstein
personal / 500px / web design
wheezy is offline   0 Reply With Quote
Old May 28, 2005, 08:23 PM   #5
sigamy
Thread Starter
macrumors 65816
 
Join Date: Mar 2003
Location: NJ USA
All,

Here is what I did. My online banking site uses forms so I had to do a bit of trial and error to find the correct form. You should be able to view the source of your bank's site to find out the function you need to call to mimic clicking the logon button.

here is my workflow:

1. Automator--Run Apple Script. Here is the script:

on run {input, parameters}

tell application "Safari"
-- go to appropriate URL for your bank
open location "https://www.mybank.com"
delay 3
-- need to fill in the form with User ID and password
do JavaScript "top.frames[1].document.forms[0].userId.value = \"" & "myUserID\"" in document 1
do JavaScript "top.frames[1].document.forms[0].password.value = \"" & "myPass\"" in document 1
delay 3

-- now click the Login button, view source of bank page to see what function to call
do JavaScript "top.frames[1].doStart()" in document 1
delay 8

activate -- not needed unless you want to watch
-- grab all the text from the current web page
set page_source to the text of front document
end tell

-- now tell TextEdit to paste the text
tell application "TextEdit"
activate -- not needed unless you want to watch
set newDoc to make new document at end
tell newDoc
set paragraph 1 to page_source
end tell
end tell


return input
end run


2. TextEdit -- Get Contents of TextEdit Document
this just reads the text into memory

3. TextEdit -- Filter Paragraphs
When I log into my bank there is a bunch of "hi, how are you" text at the top of the page. I didn't want Vicki to read this text so I search for "$". She starts reading after the "$" and just yells out my current balance.

4. System -- Speak Text
sigamy is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Can't stop an Applescript with Automator Niouky Mac Programming 18 Apr 20, 2014 03:46 AM
Automator and/or AppleScript Help jbsmithmac Mac Programming 6 May 5, 2013 05:02 PM
Automator and/or Applescript Help downingp Mac Programming 2 Oct 24, 2012 08:35 PM
Applescript and Automator Mix anton1s Mac Programming 0 Oct 20, 2012 08:02 PM
Applescript application not working within Automator Jeshua Mac Programming 0 Aug 3, 2012 07:41 PM

Forum Jump

All times are GMT -5. The time now is 01:37 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC