The problem is that your hash $found
does not contain anything. You initialize it. But then you do the Find command in the GUI, which isn't going to have any effect on $found.
You can get the effect that you (perhaps) intend, by changing the code as follows:
Code: Select all
$doc = Document.active
$found = $doc.text.findAll "(AnyWord)", 'eau'
Show Find Results $found, "All Glossary Terms"
The Show Find Results
command is pretty cool, but it takes some getting used to. Basically the argument needs to be a collection object containing TextSelection
objects. It can be a 'simple' collection like in this example, or it can be a 'grouped' collection (using a Hash) where each group is labelled in some way; by document, or some other grouping.
, by the way, is just what it sounds like. It's an object that has two parts: a text object (for example the text of your document) and a range object (which specfies which characters of your document text are selected). You can get a TextSelection object (or a whole array of them) either using Selection commands, or using Find commands.
Hope this is not TMI, but feel free to ask if you need more help.