Skip to content

Instantly share code, notes, and snippets.

@rnmp
Last active April 6, 2017 15:43
Show Gist options
  • Save rnmp/598389bfa8e43e8cac81dc9aafc8463b to your computer and use it in GitHub Desktop.
Save rnmp/598389bfa8e43e8cac81dc9aafc8463b to your computer and use it in GitHub Desktop.
Append Notes Count to Task Folders
<!-- Runs script every 5 minutes -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>notes-app-tasks-pending-count.job</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/osascript</string>
<string>[PATH_TO_SCRIPT]/notes_count.scpt</string>
</array>
<key>StartInterval</key>
<integer>300</integer>
</dict>
</plist>
tell application "Notes"
set taskFolders to every folder whose name contains "Tasks - Pending"
repeat with taskFolder in taskFolders
set originalName to taskFolder's name
set cleanName to (do shell script "sed -E 's/[ ]?\\([0-9].*)//' <<<" & quoted form of originalName)
set taskFolder's name to (cleanName & " (" & (count of taskFolder's notes) & ")")
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment