Tapatalk

How do you run a macro on all open files?

How do you run a macro on all open files?

5
NewbieNewbie
5

    Dec 21, 2004#1

    Hopefully this is a simple question:

    How do I just run a macro for only and all open files, is it a batch process?

    Thank you.
    --Todd

    6,685587
    Grand MasterGrand Master
    6,685587

      Dec 22, 2004#2

      With the help of a second macro, which executes your macro on all open files. Here is this macro code:

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOff
      Top
      "
      MacroFirstFileMarker"
      Loop
      PlayMacro 1 "
      case-sensitive name of your macro"
      NextWindow
      Top
      Find MatchCase "
      MacroFirstFileMarker"
      IfFound
      Delete
      SaveAll
      ExitLoop
      EndIf
      EndLoop


      Remove the SaveAll command if you do not want to save all files after macro execution or you already save it during execution. Make sure, that your macro does not close the file at end of execution or you have to modify this macro.

      The macro command UnixReOff is UltraEditReOn since UltraEdit for Windows v14.20.1.1006 and UEStudio v9.00. Loop is in newer versions of UltraEdit/UEStudio Loop 0 for a loop with indefinite number of loop iterations.

      Here is an alternate solution which can be used if
      • all opened files should be modified by 1 or more macros, and
      • each file should be saved and closed after called macro(s) finished, and
      • there are surely no unsaved and therefore unnamed new files opened on start of macro execution.
      InsertMode
      ColumnModeOff
      HexOff
      UnixReOff
      Loop
      IfNameIs ""
      ExitLoop
      EndIf
      PlayMacro 1 "
      case-sensitive name of first macro"
      PlayMacro 3 "
      case-sensitive name of second macro"
      CloseFile Save
      EndLoop


      This simple macro runs the first specified macro once and second specified macro three times on each opened file. The loop exits if there is no file opened anymore (or the active file is a new file with no file name).

      Attention: All macros must be stored in same macro file. The commands Macro - Load and Append to Existing and Macro - Save All can be used to copy macros from several macro files into one macro file.
      Best regards from an UC/UE/UES for Windows user from Austria

      3
      NewbieNewbie
      3

        Feb 09, 2006#3

        Mofi,

        I tried your advise but I get an error: "Search string not found!"

        What do I have to change in your script? Everything between the quotes ""?
        Is "MacroFirstFileMarker" a macro or a function?

        344
        MasterMaster
        344

          Feb 09, 2006#4

          JiTS_NL wrote:I tried your advise but I get an error: "Search string not found!"
          Set the macro property (checkbox) "continue search if nothing found".
          JiTS_NL wrote:What do I have to change in your script?
          Just the red text with your macro name.
          JiTS_NL wrote:Is "MacroFirstFileMarker" a macro or a function?
          It's just a STRING, a marker. You could replace it (both!) with "ABCXYZ" and it would work too. It just should be a unique string.

          rds Bego

          3
          NewbieNewbie
          3

            Feb 09, 2006#5

            Yes, I got it now... :)

            Next question:
            Is it possible to write "MacroFirstFileMarker" somewhere else in the first file, because during my other macro I delete the first row.
            So at the end 'your' macro delete a piece of my data... :(

            6,685587
            Grand MasterGrand Master
            6,685587

              Feb 09, 2006#6

              The marker string can be placed anywhere, for example at the end of the first file.

              Bottom
              "
              MacroFirstFileMarker"
              Top
              Best regards from an UC/UE/UES for Windows user from Austria