Hazel Automatically Setting Reminders for Evernote Notes

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

Moderator: Mr_Noodle

I am in need of some AppleScript wizardry.

This requires a bit of Hazel and a bit of Evernote Applescript knowledge. I thought I would try here before the Evernote forum.

I would like to use Hazel to read a due date for a PDF bill, send the bill to Evernote and add a reminder to the note for the due date.

I am not skilled with AppleScript but I know how to copy and paste! My current Evernote AppleScript is limited only to setting notebook and taging, I don't know how to pass variables to the script. Has anyone done this?

I am fine pulling out the [Payment Date] from the bill using Contents contain match. In fact, I have been able to do everything except setting the reminder. As a workaround currently I use Hazel to send the file to evernote, tag it, then it displays a message "Set reminder on note [Payment Date -1d]" then I go into evernote and manually set that date. Its the last part I want to automate. An AppleScript ninja should be able to do this!

These are the Evernote note properties pertaining to reminders which can be used in AppleScript
reminder time (date or missing value) : The reminder time for the note.
reminder done time (date or missing value) : The time the reminder for the note was marked completed.
reminder order (date or missing value) : The reminder order time for the note. When not empty, this is what indicates the note has a reminder. To add a reminder to a note, typically set its reminder order to the current date.

I got that from here.

Here is my current AppleScript
Code: Select all
tell application "Evernote"
   activate (create note from file theFile notebook {"Statements"} tags {"Tag1", "Tag2"})
   synchronize
end tell
matthewp
 
Posts: 4
Joined: Sun Jan 24, 2016 5:51 am

You'll need to use "Contents contain match" and a custom date attribute to grab the date. Check "match patterns" in the help for more info on how to do that.

Once you have the custom attribute, in the AppleScript action, you can specify it as an input parameter. You can then access that in the script. You'll have to go to the Evernote side to figure out how to deal with it from there. Check the AppleScript chapter in the manual on how to do the input parameter.
Mr_Noodle
Site Admin
 
Posts: 8110
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks for the hints. I'll have a go at this and see how I go!
matthewp
 
Posts: 4
Joined: Sun Jan 24, 2016 5:51 am

matthewp wrote:Thanks for the hints. I'll have a go at this and see how I go!


I made an attempt and was helped over at the Evernote forum.

Firstly in the embedded script action, I have set the "contents contain" date due match as an input attribute. There is a photo on the evernote forum post.

Here is the script that works.
Code: Select all
set dueDate to ((item 1 of inputAttributes) - 1)
tell application "Evernote"
   activate
   set theNote to create note from file theFile notebook "Statements" tags {"Tag1", "Tag2", "Tag3"}
   set reminder time of theNote to dueDate
   synchronize
end tell


The "minus 1" in the first line is to set the reminder date to the day before the bill is due.
matthewp
 
Posts: 4
Joined: Sun Jan 24, 2016 5:51 am


Return to Support