So to serialize "Apple" in this text: The apple doesn't fall far from the Apple tree.
You want to see The Apple 1 doesn't fall far from the Apple 2 tree. ?
A script that loops through all the text in a field one word at a time could be used to do this, though it won't happen instantly with a 100 page document loaded into a field
This is what I want to do, it does not matter how long it takes. So i would loop the script? I could not get the original function to work, but I will try it again.
It took some testing and tinkering, but this script works:
Set Variable [ $Size; Value:Length ( LoopingFindReplace::Word ) ]
Set Selection [ LoopingFindReplace::TextField; Start Position: 0; End Position: 0 ]
Set Variable [ $I; Value:$I + 1 ]
Perform Find/Replace [ Find: LoopingFindReplace::Word; Search operation: Find Next; Search settings: Forward, Match whole words only;
Search across: Current record/request; Search within: Current field ] [ No dialog ]
Set Variable [ $Start; Value:Get ( ActiveSelectionStart ) ]
Exit Loop If [ IsEmpty ( $start ) ]
Set Field [ LoopingFindReplace::TextField; Left ( LoopingFindReplace::TextField ; $start + $size - 1 ) & " " & $I &
Right ( LoopingFindReplace::TextField ; Length ( LoopingFindReplace::TextField ) - ( $start + $size ) + 1 ) ]
Set Selection [ LoopingFindReplace::TextField; Start Position: $start + $size + Length ( $I ) + 1; End Position: 0 ]
The key detail I had to work out is that Perform Find/Replace with the current field option requires that the cursor be in the field to be searched, but the step also exits the field each time it executes. Thus, the Set Selection step is required to put the cursor back into the field and in the correct location in order to continue searching out instances of the text entered into the LoopingFindReplace::Word field.
Well... You are definately a master at scripting. Once again, thank you for an awesome response. I wish I had your skills.