Hi guys,
I tried to suggest meta-tagging to the Omni guys... honestly, I'd prefer better printing onto 3x5 cards first, before meta-tags. ;) So, I hope they're working on printing...
But, I put together these two small scripts, which I hope to build upon over time. Basically these two scripts merely add the selected tag to the end of the notes for any single selected task. I decided to write one for Franklin type priorities, and one for Covey type time-Quadrants. [D. Allen has his own type of quadrant we could use instead...]
This may frustrate some people, merely because it's not very GTD, but I've already used it a few times to find higher priority tasks quite easily without using up Flags to mark them. Right now the scripts don't change the tags if you select a new one, they can only add tags from a note that isn't tagged with the same style of tag. [You can of course delete the tag yourself and start over.]
To find all your "A1" tasks, simply select "&A1" in the search window (or Q1,Q2 etc.)
Oh, they use Growl. You can see the code I had for non-growl use, but decided I was using it quickly enough without fault that I'd just run it in Growl instead.
Franklin Priorities:
Code:
set FranklinTasks to {"A1", "A2", "A3", "B1", "B2", "B3", "C1", "C2", "C3"}
set AddFranklinTask to (choose from list FranklinTasks with prompt "Mark this task with priority: " OK button name "Mark" without multiple selections allowed and empty selection allowed)
set alreadyTagged to ""
tell application "OmniFocus"
tell front document
tell document window 1
set theSelectedItems to selected trees of content
end tell
if ((count of theSelectedItems) = 1) then
set selectedItem to value of item 1 of theSelectedItems
set selectedNote to note of selectedItem
set I to number of items in FranklinTasks
repeat while (I is not 0)
set tempItem to item I of FranklinTasks
if selectedNote contains tempItem then
set alreadyTagged to tempItem
end if
set I to I - 1
end repeat
-- if alreadyTagged is not "" then
-- display dialog "This Task is marked: " & alreadyTagged & "Would you like me to change it?"
-- buttons ["No", "Yes"] default button 1
-- set changeTag to button returned of result
-- end if
if alreadyTagged is not "" then
-- display alert "This Task is marked: " & alreadyTagged & "Sorry, I cannot handle task-changing at this time."
do shell script "/usr/local/bin/growlnotify OmniFocus Tagging -s -m 'Sorry, this Task is already marked: " & alreadyTagged & " (I cannot handle task-changing.)' -p 1"
return
end if
if (alreadyTagged is "") or (changeTag is "Yes") then
-- display dialog "Mark this project:" buttons ["Q1", "Q2", "Q3"] default button 2
-- set selectedQ to button returned of result
-- display dialog "I will now mark this project " & AddFranklinTask buttons ["Ok", "Cancel"] default button 1
-- set tempresult to button returned of result
-- if tempresult = "Cancel" then
-- return
-- else if tempresult = "Ok" then
set newNote to selectedNote & return & "&" & AddFranklinTask
set note of selectedItem to newNote
do shell script "/usr/local/bin/growlnotify OmniFocus Task Tagged -m 'Task was successfully tagged as: " & AddFranklinTask & "' -p 1"
-- end if -- Cancel or Ok the set Q
end if -- if not already tagged
end if -- if we are only dealing with 1 item
end tell
end tell
Covey Quadrants:
Code:
set CoveyQuadrants to {"Q1", "Q2", "Q3", "Q4"}
set AddQuadrantResponse to (choose from list CoveyQuadrants with prompt "Mark this task with time-quadrant: " OK button name "Mark" without multiple selections allowed and empty selection allowed)
set alreadyTagged to ""
tell application "OmniFocus"
tell front document
tell document window 1
set theSelectedItems to selected trees of content
end tell
if ((count of theSelectedItems) = 1) then
set selectedItem to value of item 1 of theSelectedItems
set selectedNote to note of selectedItem
if selectedNote contains "&Q2" then
set alreadyTagged to "Q2"
else if selectedNote contains "&Q1" then
set alreadyTagged to "Q1"
else if selectedNote contains "&Q3" then
set alreadyTagged to "Q3"
else if selectedNote contains "&Q4" then
set alreadyTagged to "Q4"
end if -- already tagged if
-- if alreadyTagged is not "" then
-- display dialog "This Task is marked: " & alreadyTagged & "Would you like me to change it?"
-- buttons ["No", "Yes"] default button 1
-- set changeTag to button returned of result
-- end if
if alreadyTagged is not "" then
-- display alert "Sorry, this Task is already marked: " & alreadyTagged & "Sorry, I cannot handle task-changing at this time."
do shell script "/usr/local/bin/growlnotify OmniFocus Tagging -s -m 'Sorry, this Task is already marked: " & alreadyTagged & " (I cannot handle task-changing.)' -p 1"
return
end if
if (alreadyTagged is "") or (changeTag is "Yes") then
-- display dialog "Mark this project:" buttons ["Q1", "Q2", "Q3"] default button 2
-- set selectedQ to button returned of result
-- display dialog "I will now make this project " & AddQuadrantResponse buttons ["Ok", "Cancel"] default button 1
-- set tempresult to button returned of result
-- if tempresult = "Cancel" then
-- return
-- else -- if tempresult = "Ok" then
set newNote to selectedNote & return & "&" & AddQuadrantResponse
set note of selectedItem to newNote
do shell script "/usr/local/bin/growlnotify OmniFocus Task Tagged -m 'Task was successfully tagged as: " & AddQuadrantResponse & "' -p 1"
-- end if -- Cancel or Ok the set Q
end if -- if not already tagged
end if -- if we are only dealing with 1 item
end tell
end tell
Hope you like them! :) Sorry if it frustrates someone! ;) [Prioritization is of limited use... I hope to have a simple tagging applescript for client names etc., setup in the near future to handle multiple selected tasks. I also need to work on tag-changing...]
Cheers!
-Allen
ps- for those who may see some of their own code in the above scripts, speak up, I may have forgotten where I got the code-snippet from!