I thought this post would be better fit for this OmniFocus Extras forum, so pardon the double forum post.
http://forums.omnigroup.com/newreply...reply&p=128529
http://forums.omnigroup.com/newreply...reply&p=128529
Quote:
I have been using an AppleScript that selects an action name and copies it to the clipboard and then removes the priority number and puts another priority number back in. It only works on one task at a time and I am trying to get it to do this to multiple selected tasks. I am however stuck and wanted to know if anyone knew how to combine these two scripts together?
This lets me prepend text to the start of all the select actions. So I am trying to not only prepend a new action priority at the start of a task but also remove the old priority quickly on all the selected actions. Whpalmer4 helped me with this before. Code:
--Prepend text to select actions --http://forums.omnigroup.com/showthread.php?p=101754#post101754 tell application "System Events" to key code 49 --Spacebar which causes OmniFocus to duplicate task and mark as complete delay 0.3 property prependText : "[Dropped] " tell application "OmniFocus" tell front document tell document window 1 set theActions to selected trees of content set theActionCount to count of theActions if (theActionCount > 0) then --set actionPrepend to prependText repeat with actionCycle from 1 to theActionCount set actionName to value of (item actionCycle of theActions) set name of actionName to prependText & name of actionName end repeat else display alert "No content selected!" end if end tell end tell end tell Here is the code that works on one action at a time Code:
(* try set modifierkeysPressed to true repeat while modifierkeysPressed set modifierkeysPressed to (do shell script "/Library/Scripts/checkModifierKeys") is not "0" delay 0.2 end repeat on error display dialog "You do not have 'checkModifierKeys' installed. " end try *) tell application "OmniFocus" to activate --this makes it jump to the next field if it is in a field or go to the first one to clear it out so we always start from the action name. delay 0.4 tell application "System Events" to key code 48 --Tab delay 0.2 tell application "System Events" to key code 53 --Esacape delay 0.2 tell application "System Events" to key code 48 --Tab delay 0.2 tell application "System Events" to keystroke "c" using {command down} -- Copy to clipboard --http://macscripter.net/viewtopic.php?pid=163971#p163971 --set omniFocusAction to the clipboard delay 0.3 set _text to (the clipboard) do shell script "<<<" & quoted form of _text & " sed -E 's/\\{[0-9]+\\} //'" set the clipboard to the result (* Old way but works set theBarNumber to the clipboard set the clipboard to (characters 1 through 5 of theBarNumber) as text *) tell application "System Events" to keystroke "v" using {command down} tell application "System Events" to key code 126 using {option down} --Up arrow tell application "System Events" to keystroke "{1} " Code:
--Prepend text to select actions --http://forums.omnigroup.com/showthread.php?p=101754#post101754 tell application "System Events" to key code 49 --Spacebar which causes OmniFocus to duplicate task and mark as complete delay 0.3 property prependText : "{2} " tell application "OmniFocus" tell front document tell document window 1 set theActions to selected trees of content set theActionCount to count of theActions if (theActionCount > 0) then set actionPrepend to prependText repeat with actionCycle from 1 to theActionCount set actionName to value of (item actionCycle of theActions) --I need to some how get the action name fist and then do the shellscritp and replace the action name with the result set name of actionName to actionPrepend & name of actionName --I don't quite understand how this line is working do shell script "<<<" & quoted form of actionName & " sed -E 's/\\{[0-9]+\\} //'" --set the result to theNewPriority end repeat else display alert "No content selected!" end if end tell end tell end tell |