Find and replace string in a selection of notes

Let’s say I’ve searched for and selected some notes in which I want to replace a string with another string. How would that be done in a script? Preferably an interactive script.

Thanks for replies.

Why not just use the built-in Find / Replace function when you have the RTF selected?

Because I want to edit multiple notes, maybe hundreds.

Please provide more information about what you want to do. Step-by-step, if possible. Thanks.

Let’s say I have 500 formatted notes that contain the string “President Obama”. I’ve searched for and selected those notes. I need to replace the string “President Obama” with “President Trump” in all the notes, without destroying the format. My only option now is to do the replacements one at a time. I’d like to automate that process.

This is my situation scenario: I have hundreds of annotations for which I need to change the citation key from let’s say {Baker, 2008, #28418} to [Baker, 2008, #28418].

I am not quite sure but I seem to remember that TextWrangler was capable of doing just that, but my notes are in rtf and inside a DT database, therefore not available from the same folder. Can you recommend any other app capable of doing it?

I understand this is not possible within DT now, and no Applescript has been developed for it so far, therefore I second this posting’s request.