Bert Van Elsacker wrote:
> 
> We need a macro which does some operations on all occurences of a
> specified string and then returns the caret to its original position.
> I wrote a macro which works fine (recursively calling itself), but in
> order to return the caret, I need to understand when the search
> command fails. For the moment, I get the impression the command is
> always executable. Is this the case? 

Yes, the search command is always executable, unless the document
contains no text at all.



> If so, how could I test if the
> result of the search command is nothing?

* If the caret has not been moved.

* More simply, in a sequence, the command after command search will not
be executed.

---
<sequence>
  <command name="search" parameter="XXX" />
  <command name="alert" parameter="found XXX" />
</sequence>
---

In the above sequence, if the search fails, you'll not see the alert
dialog box.



Reply via email to