Finally got it to work! I made five of these in the attached zip file to make it easy for anyone interested.
Code:
property prependPriority : "{5} " --Set the priority for your task here
tell application "OmniFocus"
-- Target the content of the front window
tell content of front window
-- Retrieve every selected task
set theTasks to value of every selected tree
-- Notify the user if no tasks are selected
if theTasks = {} then
display alert "Unable to apply priority to selected task names" message "No tasks were selected. Please select one or more OmniFocus tasks and try again." as warning
return
end if
-- Begin looping through the tasks
repeat with currentTask in theTasks
-- Initialize counting variable
set tasksProcessed to 0
-- Begin looping through the tasks
repeat with currentTask in theTasks
-- Target the current task
tell currentTask
-- Retrieve the name of the current task
set theTaskName to name
do shell script "<<<" & quoted form of theTaskName & " sed -E 's/\\{[0-9]+\\} //'"
set thePriority to the result
set name to the "" & prependPriority & "" & thePriority & ""
-- Increment the number of tasks processed
set tasksProcessed to tasksProcessed + 1
end tell
end repeat
end repeat
-- Notify the user how many tasks were processed
set theAlert to "" & tasksProcessed & " tasks were set to the priority: " & prependPriority & ""
display alert theAlert
end tell
end tell