Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
TaskPaper Cycle Tag Script
property cycleTags : {"low", "medium", "high"}
tell application "TaskPaper"
tell front document
set selected to selected entries
repeat with t in selected
if entry type of t is task type then
set tagged to false
set item_count to number of items in cycleTags
repeat with i from 1 to item_count
set tagName to item i of cycleTags
set alreadyTagged to exists tag named tagName of t
if alreadyTagged then
set tagged to true
delete tag named tagName of t
if i is not item_count then
set newTagName to item (i + 1) of cycleTags
tell t to make tag with properties {name:newTagName}
end if
exit repeat
end if
end repeat
if not tagged then
set newTagName to item 1 of cycleTags
tell t to make tag with properties {name:newTagName}
end if
end if
end repeat
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment