Tapatalk

IfFound help

IfFound help

3
NewbieNewbie
3

    Mar 17, 2006#1

    I am running the macro

    Find "-=-"
    Replace All "="

    to ensure all -=- will be replaced with = before other process is made. However, sometimes, there maybe no -=- in the document so the Find command will prompt a message and quit the Macro

    I try to capture the "not found" message by

    Find "-="
    IfFound
    Replace All "="
    EndIf

    But the message is still there. How can I suppress the "Not found" window?

    Thanks in advance.

    206
    MasterMaster
    206

      Mar 17, 2006#2

      When you create or modify a macro, check the option box that says:

      "Continue if a find with replace not found"
      Software For Metalworking
      http://closetolerancesoftware.com

      3
      NewbieNewbie
      3

        Mar 17, 2006#3

        Oh, I c. Thx

        6,685587
        Grand MasterGrand Master
        6,685587

          Mar 17, 2006#4

          Find "-="
          IfFound
          Replace All "="
          EndIf

          This will not work! Find and Replace is in real 1 command. It's not possible to place an IfFound between the 2 commands. You have 2 possibilities:

          Find "-="
          IfFound
          Key RIGHT ARROW
          Key RIGHT ARROW
          Find "-="
          Replace All "="
          EndIf

          or

          Find "-="
          Replace All "="
          IfNotFound
          :
          :
          EndIf

          First solution has the problem that the cursor is set to the position of the first string found which does not happen on second solution where the cursor will not change it's current position.

          The second solution replaces every -= or does nothing if -= does not exist. After replace all you can use IfFound and IfNotFound to evaluate if at least 1 find string was really present in the file before all were replaced or not. Well the IfFound and IfNotFound after a Replace could be also called IfReplaced and IfNotReplaced. I use always the second solution.
          Best regards from an UC/UE/UES for Windows user from Austria

          3
          NewbieNewbie
          3

            Mar 17, 2006#5

            Mofi, thanks.

            BTW, can I show a dialog with macro?

            6,685587
            Grand MasterGrand Master
            6,685587

              Mar 17, 2006#6

              GetString and GetValue are the only dialogs which can be opened by a macro. See help of UE for details about these 2 macro commands. It's not possible to show a simple info dialog.
              Best regards from an UC/UE/UES for Windows user from Austria