Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A TaskPaper script that makes it easier to delete tags. Check out http://www.hogbaysoftware.com/wiki/DeleteTags for more info.
(*
Delete Tags script
By Ryan Oldford
This script is used with TaskPaper to make it easier to delete tags,
since they currently can't be selected with the mouse to delete them.
The script gives a list of the tags for the currently selected entry
(i.e. whichever entry has your cursor in it). Multiple tags can be selected.
Settings:
useQuicksilver - used when this script is called from Quicksilver (i.e. using a trigger)
messageForNoValues - used to determine if a message is given when the entry has no tags
*)
property useQuicksilver : false
property messageForNoTags : true
tell application "TaskPaper"
tell selected entry
-- START - Get list of tags for selected entry
set theTagTitles to {}
set theTags to every tag
repeat with aTag in theTags
set aTagTitle to ((name of aTag) as rich text)
copy aTagTitle to end of theTagTitles
end repeat
-- END
-- START - Display list of tags to user in dialog
-- This makes sure that the dialog shows up immediately if you run this script through Quicksilver
if useQuicksilver then activate application "Quicksilver"
if theTagTitles is {} then
if messageForNoTags is true then
display dialog "No tags for this entry"
end if
else
set theChoiceList to choose from list theTagTitles with title "Tags To Delete" with multiple selections allowed and empty selection allowed
-- END
-- START - Delete chosen tag(s) from the entry
if ((theChoiceList is not false) or (theChoiceList is not {})) then
repeat with aChoice in theChoiceList
delete tag named aChoice
end repeat
end if
-- END
end if
if useQuicksilver then activate application "TaskPaper"
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment