set _text to (the clipboard)
do shell script "<<<" & quoted form of _text & " sed -E 's/\\{[0-9]+\\} //'"
This simply cuts numbers in curly brackets and the following space. It’s possible to specify that the group comes at the beginning of a line, or that you want anything before it cut too.
set theText to the clipboard
the clipboard --> "one} two "
tell application "ASObjC Runner"
set theSplits to split string theText as text with string "}"
set theResult to modify string (item 2 of theSplits) so it is trimmed
end tell
set the clipboard to the theResult as text
the clipboard --> "two"
Maybe it is because I am using key commands to get contents and there is probably a better way to do it.
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.5
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
set theText to the clipboard
tell application "ASObjC Runner"
set theSplits to split string theText as text with string "}"
set theResult to modify string (item 2 of theSplits) so it is trimmed
end tell
set the clipboard to the theResult as text
delay 0.5
set the clipboard to the result
tell application "System Events" to keystroke "v" using {command down}
tell application "System Events" to key code 126 using {option down} --up arrow
Yes, it’s probably to do with the clipboard being passed to the app you’re using the paste with. A few well-aimed activates might do the same thing a bit quicker.