Home Forums General XMetaL Discussion Search and Replace Reply To: Search and Replace

Derek Read

Reply to: Search and Replace

Assuming the following concrete example for XMAX 6.0.0.159, where a document contains the following text (doesn't matter where in this example):

foo test footest testfoo fotesto

The following will both replace all occurences of “test” with “blah”:
Selection.Find.Execute(“test”, “blah”, “”, true, true, false, true, false, 3, false);
Selection.Find.Execute(“test”, “blah”, “”, true, false, false, true, false, 3, false);

So, I think the answer to your question is yes. If that isn't what you are testing then please provide an example.

However, a new bug first noticed with 7.0.0.111 breaks the intFindReplaceAction argument. If you upgrade to the current release and wish to use that argument you will need to work around it with code similar to the following:

//XMetaL Script Language JScript:
var rng = ActiveDocument.Range;
rng.MoveToDocumentStart();
var found = true;
while(found) {
    found = rng.Find.Execute(“text to find”, “”, “”, false, false, false, true, false, 0, false);
    if(found) {
          rng.TypeText(“replacement text”);
    }
}

The 4 and 5th arguments work here, while the intFindReplaceAction argument is broken.

Reply

Products
Downloads
Support