General XMetaL Discussion

  • Sebastian

    Search and Replace

    Participants 3
    Replies 4
    Last Activity 11 years, 7 months ago

    Hey,

    we have had some trouble with the Selection_object.Find.Execute([“strFind”], [“strReplace”], [“strConstraintString”], [boolMatchCase=false], [boolMatchWholeWords=false], [boolMatchPatterns=false], [boolForward=true], [boolWrap=true], [intFindReplaceAction=1], [boolSetFindDialogOptions=false]); function.

    Our example: Performing a ReplaceAll action for the document content, “hello Hello”, replaceing all “hello” by “cu” case sensitve.

    Selection_object.Find.Execute(“hello”, “cu”, “”, true, false, false, true, true, 3, false);

    Perfoming this action XMetall/XMax replaces both “hello” and “Hello” by “cu” – it seems to ignore the case senstive flag for ReplaceAll?

    Reply

    Derek Read

    Reply to: Search and Replace

    We are aware of this issue. Affected versions that ignore the boolMatchCase parameter include:

    XMAX 5.1.1.049
    XMetaL Author (Enterprise and Essential) 5.1.1.017
    XMAX 6.0.0.149

    The issue was corrected with the release of XMetaL Author (Enterprise and Essential) version 6.0.1.030.
    The fix should be included with the next release of XMAX.

    Reply

    MrPaul

    Reply to: Search and Replace

    I am experiencing some problems with the “whole words” flag for replace all as well. Can you confirm if this is also an issue (in addition to match case)?
    In which version of XMAX has this been fixed? We are using XMAX version 6.0.0.159.

    Reply

    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

    MrPaul

    Reply to: Search and Replace

    The above code works! We just upgraded to version 7 and I couldn't figure out why the Find and Replace All wasn't working, until I remembered this post. Thanks!

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support