Page 1 of 1
Perl Header: Send Text as RTF
Posted: 2007-07-18 00:21:17
Can you pass on any references or guidance in terms of how the #Send Text as RTF header might be used as a means of manipulating attributed text within a Perl block. I'm wondering if I could build some commands around these to make up for the aspects of attribute-sensitive PowerFind Pro that are not working (as delineated in a bug report submitted on 7/17).
The manual makes an intriguing reference to it, but offers no details.
Posted: 2007-07-18 01:13:31
Once you start passing text to Perl as RTF you're in for some real work on the Perl side. Basically your Perl code will need to parse/understand whatever RTF codes NWP uses to encode the formatting you're interested in. Sometimes it can be simple, like "\b" indicating some text is bold. Other times it's hard, like "\f3", where the 3 is an index into a font table that appeared earlier in the RTF.
You'll probably have to experiment and see if the task you want to accomplish is feasible. One tip: you can use the Encode RTF
and Decode RTF
macro commands to selectively encode/decode text.
An example macro that inspects the RTF used for the currently selected text:
Code: Select all
$text = Read Selection
$rtf = Encode RTF $text
Insert Text $rtf