Apply Script Function – RTF Example
This example of the Apply Script function shows how the function may be used to handle plain text equivalents of upper ascii characters in rtf documents. If you were to search an rtf file for the characters “ä” or “ü” there would either be no search hits because these characters are coded as “\’e4″ and “\’fc” (no quotes) in rtf. Conversely, a direct replace involving “ä” or “ü” would likely corrupt the rtf. The Apply Script function can be used to process the search (or replace) string to quickly change instances of “ä” or “ü” to their rtf counterparts.
1. Begin by creating a script to perform the transforms using the Script Dialog or manually, using a text editor. A simple conversion script for “ä” and “ü” is:
[Script for Search and Replace]
Comment: Double \\ is needed because \ is a Search
and Replace reserved character. In the actual RTF
document, ä is coded with as \’e4.and ü is coded as \’fc
[End of Search and Replace Script]
This script can be any name. The name, “rtf tranform example.srs“, will be used here.
2. To use rtf tranform example.srs in the Apply Script function, open the Binary Mode dialog and enter the string “für komplexe oder häufig” (no quotes) into the dialog.
3. Click the Apply Script button, navigate to where rtf tranform example.srs is saved, and select it.
4. Click the “Open” button. rtf tranform example.srs will operate on the search (or replace) string and “für komplexe oder häufig” will be changed to “f\\’fcr komplexe oder h\\’e4ufig”
5. Click the OK button to use the transformed string to conduct your primary search (or replace).