Best way to "double open" files in application?

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Hi all,

I am trying to automate importing of downloaded OFX bank data into my financial application Moneywell. I have file associations set up so that OFX files open Moneywell, and Moneywell will add the transactions to the currently opened file.

The rub is that I have a number of different accounting files, eg. personal and business. Since the OFX file gets imported into the file that is open now, I need to ensure that I have the correct file opened before Hazel uses the Open action on the downloaded file. I am able to identify by Content Rules whether the OFX file is personal or business.

What I need to automate is:
1. Detect which account the OFX file contains data for (Done)
2. Open Moneywell and load the appropriate account file.
3. Use an Open With Application rule on the OFX file being handled by Hazel

Available tools:
* Keyboard Maestro
* Applescript (note that Moneywell has no AppleScript dictionary)
* ???

Any suggestions would be greatly appreciated!
GeekNeck
 
Posts: 27
Joined: Sat Aug 11, 2012 7:26 am

Maybe try Automator where you record your interaction with MoneyWell to set up the correct file? A bit tricky but not sure what else you can do if it doesn't have AppleScript support.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Just in case anyone else has this issue, I have solved by doing the following:

Define a rule in Hazel that does
1. Shell script to open the accounting document
Code: Select all
open "/Users/paul/Documents/Accounting/Personal/Personal Finances.moneywell"

2. Run a Keyboard Maestro macro that waits for the accounting document to be fully opened
Code: Select all
tell application "Keyboard Maestro Engine"
   do script "Wait for Moneywell to be open"
end tell

3. Open the banking data OFX file in it's default application (which I have set to be Moneywell) via shell script
Code: Select all
open "$1"


The Keyboard Maestro action simply does this
Code: Select all
Pause Until All Conditions Met
Application “MoneyWell” is at the front


Man, that was ugly! It does work, though...
GeekNeck
 
Posts: 27
Joined: Sat Aug 11, 2012 7:26 am

You might be able to do that all in a single AppleScript on MoneyWell itself. Even if it doesn't have its own dictionary, it probably has support for generic functions, like document handling and such.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support