Script to process and update document body

I’m looking for example scripts (preferably LotusScript) that will process the body of the current document, look for keywords or XML-like flags (eg, The Start) and update the body of the document with some interpreted results.

I’m prepared to write my own engine to do this but would love to see examples or get suggestions in an effort to avoid reinventing the wheel. :slight_smile:

Michael

Subject: RE: Script to process and update document body

Replacing one string with another is pretty simple – if you look in the Domino Designer help under “FindAndReplace method” there are a few examples. Note in particular the RT_REPL_ALL option flag.

Locating a range that starts with some and ends with some other is a little more complex; I don’t have an example handy, but you can use NotesRichTextNavigator.FindFirstString and FindNextString to locate the beginning and ending of a run, NotesRichTextRange.SetBegin and SetEnd to bracket the text in your sights, NotesRichTextRange.TextRun to get the text from inside it and Remove to clear it out. Then you can use NotesRichRextItem.BeginInsert to insert new text at the position of what you removed.

You will probably need to recreate your navigators and ranges after you delete and replace text, since they will be invalidated by changing the rich text they’re pointing into.

Subject: Script to process and update document body

Look into the NotesDOMParser… I’ve used that to load an XML formatted value and parse through it.