Adding a Reminder to pay those Bills

From your noodle to other noodles. Talk about ways to get the most from Hazel. Even exchange recipes for the cool rules you've thought up. DO NOT POST YOUR QUESTIONS HERE.

Moderators: Mr_Noodle, Moderators

Adding a Reminder to pay those Bills Wed Jun 29, 2016 9:11 pm • by laurie_lewis
I have been trying to get Hazel to add a Reminder so I don't forget those bills that I scan and destroy upon receipt. I don't want to pay them straight away all the time so a reminder is essential.

Step 1.

Create filters so you can identify your biller for naming of the file etc
Part of this process is using the:
Contents contains match - Create a Custom Date (this should identify a due date or issue date normally)
Give this Custom Date an appropriate name

Step 2.

Create rules as you would normally to place & rename the file as you would.
Next create a rule to run an embedded AppleScript
Click on edit script
In the top right corner of the box that appears click on that icon and a new window will come up.
In the left hand box that appears click the + and add the Custom Date name you created earlier. This can now be accessed by the script as a "inputAttributes".
You can add addition items - I believe they are numbered from top to bottom (1 to xx) as "inputAttributes"
This then brings the date you created into the AppleScript. As I only add the date it will be "item 1 of inputAttributes"
Click outside the boxes to close them

Now for the embedded AppleScript

Code: Select all
set myList to "The List Name You Wish to Use"
set myName to "Name of Reminder You Wish to Use"
set DueDate to item 1 of inputAttributes
set DueDate to (DueDate + (30 * days))
tell DueDate
   set {its hours, its minutes, its seconds} to {9, 0, 0}
end tell
set myBody to "The Message I Want With It" as string


tell application "Reminders"
   set newremin to make new reminder in list myList
   set name of newremin to myName
   set remind me date of newremin to DueDate
   set body of newremin to myBody
end tell


You will see the line
Code: Select all
set DueDate to item 1 of inputAttributes


If you have added a number of variables to import then the item number will be the number of the date you wish to use. Numbered top to bottom. If you only import the date as I do then it remains as item 1.

Code: Select all
set DueDate to (DueDate + (30 * days))


This line tells the DueDate variable to add 30 days to the date imported. In my case the biller gives me 30 days from the date of issue of the bill to pay. Obviously the date I am importing is the date the bill was issued. If you import the Due Date of your bill you could change the "+ (30 * days)" to "- (4 * days)" so you are not late in making the payment.

Now the time of the reminder. I was finding this was set at the time that Hazel processed the file, which was not good for a reminder. I wanted them at a consistent time. So

Code: Select all
tell DueDate
   set {its hours, its minutes, its seconds} to {9, 0, 0}
end tell


Edit the Hours, minutes, seconds fields to put the time you want the reminder for.

And that should be it.

A Reminder should be created for you to pay your bills or whatever you have. I am no programmer and it took me a while to figure it out but I hope it helps.

All the best
laurie_lewis
 
Posts: 19
Joined: Thu Mar 14, 2013 11:53 pm

Re: Adding a Reminder to pay those Bills Wed Jun 29, 2016 11:30 pm • by laurie_lewis
Been doing a bit more playing after my original post. I have a couple of bills that come in for utilities that are due for the last day of the month for the next month after the bill was issued. I believe the following code is working, though I am sure it could have been done far more elegantly.

Code: Select all
set myList to "Name of Your Reminder List"
set myName to "Name of Biller"

set InvDate to item 1 of inputAttributes

# Set the time for the Reminder
tell InvDate
   set {its hours, its minutes, its seconds} to {9, 0, 0}
end tell

# Make DueDate the last day of next month
set DaysInMonth to (32 - ((InvDate + (32 - (InvDate's day)) * days)'s day))
set DueDate to (InvDate + ((DaysInMonth - (InvDate's day)) * days))
set DueDate to (DueDate + (4 * weeks))
set DaysInMonth to (32 - ((DueDate + (32 - (DueDate's day)) * days)'s day))
set DueDate to (DueDate + ((DaysInMonth - (DueDate's day)) * days))

# Build the body of the reminder with Issue and Due Dates
set myBody to "Bill Description: issued " as string
set myBody2 to short date string of (InvDate)
set myBody3 to " Due: " as string
set myBody4 to short date string of (DueDate)
set myBody to myBody & myBody2 & myBody3 & myBody4

# Set the reminder to go off 2 days before DueDate
set DueDate to (DueDate - (2 * days))

# Build the reminder
tell application "Reminders"
   set newremin to make new reminder in list myList
   set name of newremin to myName
   set remind me date of newremin to DueDate
   set body of newremin to myBody
end tell


All the best

Laurie
laurie_lewis
 
Posts: 19
Joined: Thu Mar 14, 2013 11:53 pm

Re: Adding a Reminder to pay those Bills Sun Nov 24, 2019 11:37 pm • by marcom
Hi
I've been using this script for years, but since upgrading to Catalina and upgrading the reminders app. This has stopped working.

Basically the Reminders app just times out.

Any help or thoughts is appreciated.

Thanks
marcom
 
Posts: 1
Joined: Sun Nov 24, 2019 11:34 pm


Return to Tips & Tricks - DO NOT POST QUESTIONS

cron