Last active
April 6, 2017 15:43
-
-
Save rnmp/598389bfa8e43e8cac81dc9aafc8463b to your computer and use it in GitHub Desktop.
Append Notes Count to Task Folders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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