[SOLVED] Check if there's a new note in Notes

Can I have a macro that runs every hour and checks if there's any note in Notes.app?
So every hour it will run a macro that checks if the Notes "folder" inside Notes.app contains 1 or more notes and if it does, it shows me a notification.

For context:
I stopped using Notes.app and started using Obsidian only.
I love that on my iPhone I can quickly add a new note by swiping the screen and clicking the icon, even with a locked screen. I just don't want to forget that I added notes there, so it would run every hour and it would show me a notification if there's at least 1 note so I can go and check it and then convert it to Obsidian

I had no idea if this was possible or not, so I looked at the AppleScript Dictionary for Notes, and was surprised to find that it not only has one, but it's relatively complete. Then it was just a matter of counting the notes in the Notes folder.

As usual with me and AppleScript, I had to fall back to ChatGPT to get the proper syntax, as my first attempt failed with some message about objects and text and who knows what else :).

Count Notes.kmmacros (4.8 KB)

Screenshot of macro

This seems to work in my testing, though I didn't let it run for an hour to see for sure :).

Edit: The first version forgot to cancel the macro if there weren't any notes, so you'd get an annoying notification with an empty text block when there weren't any notes.


1 Like

You can do something similar with a somewhat simpler AppleScript; no need for Keyboard Maestro actions (other than calling the AppleScript).

tell application "Notes" to set theCount to count of notes of folder "Notes"
if theCount is not 0 then display notification "You currently have " & theCount & " notes" with title "Apple Notes Hourly Checker"

Thanks for taking the time to check it and sharing your macro.
Since @cdthomer mentioned his version was simpler, I decided to test it first and it worked as expected, using just 1 action.

Truly appreciate you both for helping with this macro! :muscle:
Happy New Year, by the way!

1 Like