Tapatalk

Fixed bug: ReplInFiles with empty replace string interpreted as FindInFiles

Fixed bug: ReplInFiles with empty replace string interpreted as FindInFiles

2
NewbieNewbie
2

    Jun 30, 2009#1

    I have a macro to tidy up a text file that reads as the following -

    Code: Select all

    InsertMode
    ColumnModeOff
    HexOff
    UltraEditReOn
    ReplInFiles Log "C:\Users\Chris\Desktop\" "file.txt" "  " ""
    ReplInFiles Log "C:\Users\Chris\Desktop\" "file.txt" ", " ","
    ReplInFiles Log "C:\Users\Chris\Desktop\" "file.txt" " ," ","
    ReplInFiles Log "C:\Users\Chris\Desktop\" "file.txt" "^p^p^p" ""
    And it works fine, however when I save it, reload UE and load the macro in the first and last replinfiles lines get changed to findinfiles -

    Code: Select all

    InsertMode
    ColumnModeOff
    HexOff
    UltraEditReOn
    FindInFiles Log "C:\Users\Chris\Desktop\" "file.txt" "  "
    ReplInFiles Log "C:\Users\Chris\Desktop\" "file.txt" ", " ","
    ReplInFiles Log "C:\Users\Chris\Desktop\" "file.txt" " ," ","
    FindInFiles Log "C:\Users\Chris\Desktop\" "file.txt" "^p^p^p"
    I guess this is because I'm wanting to replace the found text with nothings. However it is what I want to do. Is this a bug or is there another way to do what I want to do ?

    Thanks in advance

    236
    MasterMaster
    236

      Jun 30, 2009#2

      I can reproduce that using the current version of UE (15.00.0.1047). Looks like a bug to me - would you report it to IDM support by email?

      Why are you using Replace in Files if it's only one file you want to modify?

      2
      NewbieNewbie
      2

        Jun 30, 2009#3

        Have logged it with them :).
        pietzcker wrote:Why are you using Replace in Files if it's only one file you want to modify?
        The file is output on a daily basis by another program. I'm then using UE to tidy it up as part of a script.

        7
        NewbieNewbie
        7

          Mar 22, 2011#4

          Hi,
          this problem is not fixed in UE 15.10.0.1026. Do you know, if it is fixed in v17.00?

          Greg

          6,685587
          Grand MasterGrand Master
          6,685587

            Mar 23, 2011#5

            Hi Greg,

            I have tested the problem reported here with various versions of UltraEdit starting with UE v15.10.0.1026 (for verification), continued with build 1028 and 1031 of v15.10, verified the problem also with v15.20.0.1027 (last v15.xx) and finally tested this issue with first v16.xx which was v16.00.0.1025.

            This problem with saving a macro containing one or more ReplInFiles commands with an empty replace string interpreted as FindInFiles after reloading the macro is fixed in v16.00.0.1025 and all later versions.

            What remains as problem caused by the syntax change of the ReplInFiles macro command in UE v14.20 and UES v9.00 (replace string moved up from line below ReplInFiles command to end of line with ReplInFiles command) is following macro compilation issue which I reported to IDM by email in summer 2009 which could be fixed only by changing the syntax back or introducing a new syntax.
            Mofi wrote:... For example if I want to write a macro containing following commands

            InsertMode
            ColumnModeOff
            HexOff
            UltraEditReOn
            ReplInFiles Log "C:\Temp\" "*.tmp" " " " " ""

            the macro compiler must fail here to find out what I want to search for and what should be the replace string. Above is compiled as:

            InsertMode
            ColumnModeOff
            HexOff
            UltraEditReOn
            ReplInFiles Log "C:\Temp\" "*.tmp" " " " "

            which would result in replacing all spaces by spaces. That was not my intention. In pre v14.20 syntax the command would be:

            ReplInFiles Log "C:\Temp\" "*.tmp" " " "
            " ""

            You see now what the command should do: delete the space after a double quote character if a space is preceding the double quote character. ...
            A workaround is to use a script instead of a macro. Also just recording macros using such search/replace strings and not editing such a recorded macro is a possible workaround. Another workaround would be to use the Perl regular expression engine and use \x22 instead of " to "encode" the double quote character in the search/replace strings.

            Update:
            The issue reported by me as described above is fixed with UE v25.00.0.82  and UES v18.00.0.4.
            See also:  FindInFiles and ReplInFiles not correct compiled after creating/editing a macro with them with UE v25.00 (fixed)
            The modified syntax for the strings of the four commands Find, Replace, FindInFiles and ReplInFiles requires that every double quote within a string must be escaped with a backslash and a backslash inside a string must be escaped with a backslash if it is the last character of a string or if the next character is a double quote.