about Find/Replace command in macro

about Find/Replace command in macro

2
NewbieNewbie
2

    Mar 25, 2005#1

    macro 1:
    InsertMode
    ColumnModeOff
    HexOff
    UnixReOff
    Top
    Find "[CaptorGroup]"
    Replace "[Group]"

    macro 2:
    InsertMode
    ColumnModeOff
    HexOff
    UnixReOff
    Top
    Find "[CaptorGroup]"
    IfFound
    Replace "[Group]"
    EndIf

    Question: Macro 1 can be run and no problem , but Macro 2 will reports "replace wrong". Who can tell me why ? thanks.

    206
    MasterMaster
    206

      Mar 25, 2005#2

      Good question.

      Ask at [email protected] - let us know.
      Software For Metalworking
      http://closetolerancesoftware.com

      6,684586
      Grand MasterGrand Master
      6,684586

        Mar 26, 2005#3

        That's easy to answer for me. The Replace command must follow immediately a Find command. Use this modified macro 2, which moves the cursor back to begin of search string, if found once:

        InsertMode
        ColumnModeOff
        HexOff
        UnixReOff
        Top
        Find "[CaptorGroup]"
        IfFound
        StartSelect
        EndSelect
        Key Ctrl+LEFT ARROW
        Key Ctrl+LEFT ARROW
        Key LEFT ARROW
        Find "[CaptorGroup]"
        Replace "[Group]"
        EndIf

        Of course, better is this macro:

        InsertMode
        ColumnModeOff
        HexOff
        UnixReOff
        Top
        Find "[CaptorGroup]"
        IfFound
        "[Group]"
        EndIf

        The find command already selects the string, so it can be directly replaced by the new string in your case, where no regular expression is used.
        Best regards from an UC/UE/UES for Windows user from Austria

        2
        NewbieNewbie
        2

          Mar 27, 2005#4

          Thanks Mofi. Your says the right, and I just got this answer by IDM service support. Also thanks for your idea, that's very good :lol: