Rename pdf (bills) and add to quicken

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

Moderator: Mr_Noodle

Rename pdf (bills) and add to quicken Sun Nov 18, 2018 12:44 am • by mevans
I find lots of help on how to rename a pdf based on date content within the file, however I can't find any information on how to record the financial transaction (bills, checks, etc.) in Quicken (2017).

I'd like to be able to download bills, credit card statements, paychecks, to a folder, then have Hazel rename and move the file(s), and add a transaction to Quicken.

Any suggestions? Thanks.
mevans
 
Posts: 9
Joined: Sat Nov 17, 2018 9:50 pm

Re: Rename pdf (bills) and add to quicken Mon Nov 19, 2018 1:00 pm • by Mr_Noodle
You'll need to use AppleScript to interact with Quicken. Or possibly Automator if Quicken provides any Automator actions.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rename pdf (bills) and add to quicken Wed Nov 21, 2018 2:46 pm • by mevans
I got it working with AppleScript, starting Quicken then pressing keys to enter data. Timing was tricky but got it to work.

HOWEVER, I'd like to use a single AppleScript file across multiple rules. This requires that I pass a constant to the apple script. I can see how to pass just about any dynamic field of data (exif, dates, image widths, etc) EXCEPT for a simple constant string.

How do I pass a constant string from Hazel to AppleScript?

Thanks!
mevans
 
Posts: 9
Joined: Sat Nov 17, 2018 9:50 pm

Re: Rename pdf (bills) and add to quicken Wed Nov 21, 2018 10:22 pm • by mevans
I figured out a workaround to setting string constants in Hazel. I can run an AppleScript that returns constants to Hazel. (Be sure to configure Hazel to save the return parameters.) Then I can call my generic AppleScript that adds a transaction to Quicken. (Be sure to configure Hazel to pass the appropriate parameters to the AppleScript.) This allows me to use the "add new transaction" script for multiple bills/statements without copying the bulk into multiple rules.

Here's my "set constants" AppleScript:
Code: Select all
-- Return two constants: the payee and the category.
return {hazelStop:false, hazelOutputAttributes:{"Small Town USA Trash Company", "UtilitiesTrash"}}


Then I have an external AppleScript that runs Quicken, creates a new transaction, and enters the data. Note that the account to which the new transaction is entered must be the default account. Also, the account must be configured for the correct number of columns. Otherwise this script would need to add or remove the extra tabs that skip over unused columns.

Code: Select all
-- theFile contains the file that matched the rule
-- inputAttributes 1: dueDate
-- inputAttributes 2: payee
-- inputAttributes 3: category
-- inputAttributes 4: charges
on hazelProcessFile(theFile, inputAttributes)
   tell application "Quicken 2017" to activate
   delay 1.0
   
   -- Without delay, text is typed too fast for Quicken. (MINIMUM 0.3 with a large Quicken file)
   set myDelay to 0.4
   
   set myDueDate to item 1 of inputAttributes
   set myPayee to item 2 of inputAttributes
   set myCategory to item 3 of inputAttributes
   set myCharges to item 4 of inputAttributes
   
   -- Read date attributes and create a string we can enter as text
   set myMonth to month of myDueDate as integer as string
   set myDay to day of myDueDate as string
   set myYear to year of myDueDate as string
   set myDueDateStr to myMonth & "/" & myDay & "/" & myYear
   
   -- List of data to enter into transaction.
   set myList to {myDueDateStr, tab, "EFT", tab, myPayee, tab, myCategory, tab, tab, tab, myCharges, return}
   
   -- New transaction in quicken.
   tell application "System Events" to keystroke "n" using {command down}
   delay 1.0
   
   repeat with myItem in myList
      tell application "System Events" to keystroke myItem
      delay myDelay
   end repeat
   
   -- Quit quicken.
   tell application "System Events" to keystroke "q" using {command down}
   
   -- Give quicken a chance to quit before we jump into another rule possibly with quicken.
   delay 1.0
end hazelProcessFile


I guess this morphed from a Support to a Tips & Tricks.
mevans
 
Posts: 9
Joined: Sat Nov 17, 2018 9:50 pm


Return to Support

cron