Adding & removing a prefix to multiple items

Anyone know how to do this ?

Are you conversant with AppleScript?

I have a script that would drop/add tasks by adding/dropping a suffix.

I no longer use this now that we can drop tasks. It can be modified to put / add prefixes.


JJW

Unfortunately, not in the slightest. Pretty new to it. I’ve been trying to tinker some script I’ve found online and I’ve managed to get one that adds the prefix to the task, but I can’t figure out how to remove it +_+

also thank you very much for the reply!

Ha! You need REGEX parsing for the latter option! (not really)

Perhaps you can tackle your need in a different way. Have you considered adding/removing a special tag? The method to automate adding/removing tags via AppleScript is significantly easier to do.


JJW

Oh man. I have no idea what that is still… The extent of my coding knowledge equals fancy excel spreadsheets, ahha. I really don’t want to use the tagging option. I was able to tweak another script to get it to do that, but I like to view my tags in the combined tag grouping method and can’t stand how it creates so many lists, or makes the groupings too bulky.

I think if I could make an in-line preference to the item, it would be so much easier for me to process the stuff in my lists. I’m trying to do this as an alternative to the “Today” tagging method. Below is what I’ve been able to figure out. Know any shortcuts to make it work ?

disclaimer… it looks like Frankenstein put it together still lol

set itemTitle to missing value
tell application “OmniFocus”
tell front document
– Gets target context

try

set theTagID to id of item 1 of ( complete waitingForTag as tag )

set theWaitingForTag to first flattened tag whose id is theTagID

on error

display alert “No context found whose name contains “” & waitingForTag & “””

return

end try

tell content of document window 1

set theSelectedItems to value of every selected tree

if (( count of theSelectedItems) < 1) then

display alert “You must first select an item to complete.” as warning

return

end if

repeat with anItem in theSelectedItems

set itemTitle to name of anItem

if (itemTitle does not start with waitingPrefix) then

set name of anItem to waitingPrefix & itemTitle

else

set itemTitle to text 5 thru -(1 + (length of waitingPrefix)) of itemTitle

end if

set repetition of anItem to missing value

end repeat

if ( count of theSelectedItems) > 1 then

set itemTitle to multipleItemsCompleted

end if

end tell

end tell

end tell

if itemTitle is not missing value then

my notify(“Completed and Awaiting Reply”, itemTitle)

end if

(*

Uses Notification Center to display a notification message.

theTitle – a string giving the notification title

theDescription – a string describing the notification event

*)

on notify(theTitle, theDescription)

display notification theDescription with title scriptSuiteName subtitle theTitle

end notify

OK. Look here.

Perhaps this is where you got your starting script. In any case, as I understand, you want to append/remove a “waiting for” prefix as a way to signify a change of status. If so, I think you are trying to hammer a finishing nail with a sledgehammer. You are also tying yourself to the macOS version and will miss this option entirely on any iOS version.

I recommend that you will do yourself a great favor by using one of these two approaches instead:

  • write an AppleScript to add/remove a tag “Waiting For” (this can eventually be converted far more easily to the new script language that will work across macOS and iOS).

  • use a two-step sequence as below:

    • –> request final report from Jack [call]
    • –> get final report from Jack [Waiting For: Jack]

I use the second method.

The greatest benefit I have gotten in my many years of using OF is the time that I have taken to learn how to tailor workflows and tune Perspectives to fit exactly to my needs. Those benefits far outweighed the ones from the many hours I spent tweaking AppleScripts to add/remove suffix text or to muck around with tags (contexts in those days).

So, have at it but even in the best case of an immediate, working script to add/remove prefixes … I think this option goes down a path of diminishing long-term RoI.


JJW

Thanks for the detailed reply! The script I posted was a combination of the waiting for one, with pieces from the verify missing action one. I’m not necessarily trying to end up with a waiting for status. Really I’m just trying to create a prefix for a character on IOS that is a circle with a T inside of it. I’m trying to adapt that as a way to use the “Today” script without actually using a tag.

You are definitely correct that I am wasting too much trying to make these things work. A system is no good if you never use the system. That’s always been my downfall with GTD - trying to tweak it too much, I guess. I’ll give workflows a look through!

Hi, just seen this question. I’ve started to use OF just recently and was reading through the guides, forums, etc…

Found this automation just today which could be of help for you:

The creator of the automation has a few more automations on her Github page. I’ve been trying them and the ones that help my flow are working for me.

Not sure if you’re into automation, but for me it was a bit not that quick to get into their installation.
The creator also has a handy guide for installing automations:

The automation linked here, adds either a prefix or a suffix on multiple selected items. It does not allow to remove a prefix or a suffix though.

Hope that helps.

Cheers