Is it possible to use a progress bar for macro execution?

Is it possible to use a progress bar for macro execution?

5
NewbieNewbie
5

    Oct 16, 2015#1

    I have a macro that joins lines on massive (50 MB) mainframe files. All I get when I run my macro is the Cancel Operation window and a circling cursor. Anyone know how to add a progress bar to this operation?

    6,602548
    Grand MasterGrand Master
    6,602548

      Oct 16, 2015#2

      All available UltraEdit macro commands are listed in help of UltraEdit on page Edit Macro command which can be opened by pressing on button Help in Edit/Create Macro dialog or pressing key F1 with this dialog open. The macro commands are also documented in my macro reference file. That's it. So a progress bar is not available.

      I'm wondering about the requirement for a progress bar for joining lines in a file with a medium size of 50 MB. A regular expression Replace All can do that most likely in less than 10 seconds. I suppose you use a not so smart method which requires lots of display updates because of caret moving and recording lots of undo steps. You should think about changing the method to get the result you want. We can help on macro development if you post a block showing us file contents before macro execution (input data), another block with the expected result (output data), and explaining what are the criteria to get from input to output data.
      Best regards from an UC/UE/UES for Windows user from Austria

      5
      NewbieNewbie
      5

        Oct 23, 2015#3

        Hi, sorry for the delay - I've been on the road the last couple of weeks.

        Thanks for your kind offer. Here's is what I have:

        13 lines of data:

        Code: Select all

        1XXXXX
        2XXXXX
        3XXXXX
        4XXXXX
        5XXXXX
        6XXXXX
        7XXXXX
        8XXXXX
        9XXXXX
        10XXXX
        11XXXX
        12XXXX
        13XXXX
        that I want to make into one line:

        Code: Select all

        1XXXXX2XXXXX3XXXXX4XXXXX5XXXXX6XXXXX7XXXXX8XXXXX9XXXXX10XXXX11XXXX12XXXX13XXXX
        Here's the macro I am using:

        Code: Select all

        InsertMode
        ColumnModeOff
        HexOff
        Key DOWN ARROW
        Key BACKSPACE
        Key DOWN ARROW
        Key HOME
        Key BACKSPACE
        Key DOWN ARROW
        Key HOME
        Key BACKSPACE
        Key DOWN ARROW
        Key HOME
        Key BACKSPACE
        Key DOWN ARROW
        Key HOME
        Key BACKSPACE
        Key DOWN ARROW
        Key HOME
        Key BACKSPACE
        Key DOWN ARROW
        Key HOME
        Key BACKSPACE
        Key DOWN ARROW
        Key HOME
        Key BACKSPACE
        Key DOWN ARROW
        Key HOME
        Key BACKSPACE
        Key DOWN ARROW
        Key HOME
        Key BACKSPACE
        Key DOWN ARROW
        Key HOME
        Key BACKSPACE
        Key DOWN ARROW
        Key HOME
        Key BACKSPACE
        Key DOWN ARROW
        Key HOME
        Any help you can provide is greatly appreciated.

        Siegfried

        6,602548
        Grand MasterGrand Master
        6,602548

          Oct 23, 2015#4

          This can be done much faster with two Perl regular expression using backreferences Replace All.

          Code: Select all

          InsertMode
          ColumnModeOff
          HexOff
          Top
          PerlReOn
          Find MatchCase RegExp "^(.*)(?:\r?\n|\r)(.*)(?:\r?\n|\r)(.*)(?:\r?\n|\r)(.*)(?:\r?\n|\r)(.*)(?:\r?\n|\r)(.*)(?:\r?\n|\r)(.*)(?:\r?\n|\r)(.*)(?:\r?\n|\r)((?:.*(?:\r?\n|\r)){5})"
          Replace All "\1\2\3\4\5\6\7\8\9"
          Top
          Find MatchCase RegExp "^(.*)(?:\r?\n|\r)(.*)(?:\r?\n|\r)(.*)(?:\r?\n|\r)(.*)(?:\r?\n|\r)(.*)"
          Replace All "\1\2\3\4\5"
          Top
          
          If the line terminator type is always DOS/Windows, the search strings can be simplified:

          Code: Select all

          InsertMode
          ColumnModeOff
          HexOff
          Top
          PerlReOn
          Find MatchCase RegExp "^(.*)\r\n(.*)\r\n(.*)\r\n(.*)\r\n(.*)\r\n(.*)\r\n(.*)\r\n(.*)\r\n((?:.*\r\n){5})"
          Replace All "\1\2\3\4\5\6\7\8\9"
          Top
          Find MatchCase RegExp "^(.*)\r\n(.*)\r\n(.*)\r\n(.*)\r\n(.*)"
          Replace All "\1\2\3\4\5"
          Top
          
          (...) is a capturing group. The string found by the expression inside this group can be back referenced with \1 to \9. 9 is the maximum for capturing groups which is the reason why 2 replaces are necessary for joining 13 lines to 1 line.

          (?:...) is a non-capturing group as used in first macro for DOS/UNIX OR MAC line termination and in both macros to apply multiplier {5} (exactly 5 times) to a non-capturing group finding a single line with line termination put into a capturing group.

          The last line of the file must have also a line termination for this macro. It would be possible to change the expression to work also for last line of file independent on existence of a line termination and end of file.

          Example input data used for testing:

          Code: Select all

          1XXXXX
          2XXXXX
          3XXXXX
          4XXXXX
          5XXXXX
          6XXXXX
          7XXXXX
          8XXXXX
          9XXXXX
          10XXXX
          11XXXX
          12XXXX
          13XXXX
          1YYYYY
          2YYYYY
          3YYYYY
          4YYYYY
          5YYYYY
          6YYYYY
          7YYYYY
          8YYYYY
          9YYYYY
          10YYYY
          11YYYY
          12YYYY
          13YYYY
          1ZZZZZ
          2ZZZZZ
          3ZZZZZ
          4ZZZZZ
          5ZZZZZ
          6ZZZZZ
          7ZZZZZ
          8ZZZZZ
          9ZZZZZ
          10ZZZZ
          11ZZZZ
          12ZZZZ
          13ZZZZ
          
          Modified with first Replace All to:

          Code: Select all

          1XXXXX2XXXXX3XXXXX4XXXXX5XXXXX6XXXXX7XXXXX8XXXXX9XXXXX
          10XXXX
          11XXXX
          12XXXX
          13XXXX
          1YYYYY2YYYYY3YYYYY4YYYYY5YYYYY6YYYYY7YYYYY8YYYYY9YYYYY
          10YYYY
          11YYYY
          12YYYY
          13YYYY
          1ZZZZZ2ZZZZZ3ZZZZZ4ZZZZZ5ZZZZZ6ZZZZZ7ZZZZZ8ZZZZZ9ZZZZZ
          10ZZZZ
          11ZZZZ
          12ZZZZ
          13ZZZZ
          
          Final output for the example after macro finished:

          Code: Select all

          1XXXXX2XXXXX3XXXXX4XXXXX5XXXXX6XXXXX7XXXXX8XXXXX9XXXXX10XXXX11XXXX12XXXX13XXXX
          1YYYYY2YYYYY3YYYYY4YYYYY5YYYYY6YYYYY7YYYYY8YYYYY9YYYYY10YYYY11YYYY12YYYY13YYYY
          1ZZZZZ2ZZZZZ3ZZZZZ4ZZZZZ5ZZZZZ6ZZZZZ7ZZZZZ8ZZZZZ9ZZZZZ10ZZZZ11ZZZZ12ZZZZ13ZZZZ
          
          Best regards from an UC/UE/UES for Windows user from Austria

          5
          NewbieNewbie
          5

            Oct 27, 2015#5

            Wow! This works perfectly and is very fast.

            Many thanks for putting this together for me.

            Vielen dank!

            Siegfried