Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
apple script to export all money money account data of the last 90 days as OFX to $HOME/Dropbox/MoneyMoney
#!/usr/bin/osascript
set backTo to ((current date) - 90 * days) as string
set now to (current date) as string
tell application "MoneyMoney"
set exported to export accounts
end tell
set tempDir to (path to temporary items as text)
set tempFile to tempDir & "accounts.xml"
set myFile to open for access tempFile with write permission
write exported to myFile
close access myFile
tell application "System Events"
set accounts to value of property list item "name" of every property list item of contents of property list file tempFile
end tell
repeat with i from 1 to count of accounts
set acc to item i of accounts
set newFileName to (acc & ".ofx")
try
tell application "MoneyMoney"
set result to export transactions from account acc from date backTo to date now as "ofx"
end tell
tell application "Finder"
set exportedFile to duplicate file result as POSIX file to folder "MoneyMoney" of folder "Dropbox" of folder (path to home folder)
delete (every item of folder "MoneyMoney" of folder "Dropbox" of folder (path to home folder) whose name is newFileName)
set name of exportedFile to newFileName
-- open result as POSIX file
end tell
end try
end repeat
return "all done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.