General macro problem when starting from CMD?

General macro problem when starting from CMD?

5
NewbieNewbie
5

    Apr 12, 2005#1

    Is there a general problem when starting UE macro processing from the command line?

    I have several macros which i use every day, but some of them do not work when they are started from the command line. When i run the same macro when UE is open, then it works.

    The problem only exists, when the macro has multiple "Loops" and "Ifs".
    When a loop has a find command, followed by "IfFound" and "else", then "IfFound" and "else are not processed in the same way as when the macro is started from the command line.

    My UE Version is 10.10c

    6,675585
    Grand MasterGrand Master
    6,675585

      Apr 27, 2006#2

      A general rule for loops: Nesting of loops is not possible.

      What is nesting loops?

      The following is OK because the 2 loops are not nested:

      Loop
      :
      :
      IfFound
      ExitLoop
      EndIf
      EndLoop
      Loop
      IfEof
      ExitLoop
      EndIf
      :
      :
      EndLoop

      The following macro code will not work because the 2 loops are nested.

      Loop
      :
      :
      IfFound
      Loop
      IfEof
      ExitLoop
      EndIf
      :
      :
      EndLoop
      Else
      ExitLoop
      EndIf
      EndLoop

      If you need a loop inside a loop, write the inner loop into an additional macro which is a submacro for the main macro and run it with the PlayMacro command as shown below.

      Code of the submacro named "SubMacro":

      Loop
      IfEof
      ExitLoop
      EndIf
      :
      :
      EndLoop

      Code of the main macro:

      Loop
      :
      :
      IfFound
      Loop
      PlayMacro 1 "SubMacro"
      Else
      ExitLoop
      EndIf
      EndLoop

      Note: The name of the macro in the PlayMacro command is case-sensitive.


      A general rule for IfFound and IfNotFound usage: Whenever you use a Find command and the macro execution should not automatically stop when a search string is not found, you must enable the macro property Continue if a Find with Replace not found.

      Well, the correct name of this macro property should be Continue if a Find not found because it controls the macro exit for all finds and not only the finds with replace.

      And last make sure, you have always an EndIf for every If/Else command. If you forget an EndIf in a loop, the loop maybe does not what you expect.
      Best regards from an UC/UE/UES for Windows user from Austria