Hello,
I wrote:
Nobumi Iyanaga wrote:Related to your script, I think it is still necessary to read the raw rtf code, for instance for grabbing images. But with the new macro, it would be much easier -- or faster to do that. You would do:
Code: Select all
Find All '^.+', 'E'
$doc = Document.active
$paragraphs = Array.new
$paragraphs = $doc.selectedSubtexts
ForEach $paragraph in $paragraphs
$rtf = Encode RTF $paragraph
# prompt $rtf or any other commands...
End
It is much faster to work with variants (here, "$paragraphs" and "$paragraph") than with:
Code: Select all
While Select Next Paragraph
$currentParagraph = Read Selection
....
way.
Related to this "Find All '^.+', 'E'", I found that if you have notes in your file, this would not work as expected.
I made a document like the following:
aiueo[footnote1] sashisuseso[endnote1]
naninuneno[footnote2]
----
1 kakikukeko
2 hahifuheho
-------
1 tachitsuteto
With the wildcard expression ".+", and Find All, I highlight:
aiueo sashisuseso[endnote1]
naninuneno
and
kakikukeko
hahifuheho
-------
tachitsuteto
Thus, ".+" finds, no footnote references, but an endnote reference.
If I use "^.+", it matches only:
aiueo
naninuneno
And if I use "^.+$", it matches nothing at all...
This last behavior is probably understandable: if "^.+$" must match all the paragraphs, and note references are considered as "non-characters", there is no paragraph without any note references. But if note references are "non-characters", why ".+" can match an endnote reference...??
Anyway, it is very inconvenient that note references cannot be selected with "."...
So, for the time being, I think we should use the code
Code: Select all
While Select Next Paragraph
$currentParagraph = Read Selection
....
End
although it is certainly much slower than the other code.