Fixed bug: ReplInFiles with empty replace string interpreted as FindInFiles

Help with writing and playing macros

Fixed bug: ReplInFiles with empty replace string interpreted as FindInFiles

Postby ChrisGlo » Tue Jun 30, 2009 5:52 am

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
ChrisGlo
Newbie
 
Posts: 2
Joined: Tue Jun 30, 2009 5:50 am

Re: Fixed bug: ReplInFiles with empty replace string interpreted as FindInFiles

Postby pietzcker » Tue Jun 30, 2009 7:19 am

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?
User avatar
pietzcker
Master
Master
 
Posts: 241
Joined: Sun Aug 22, 2004 11:00 pm

Re: Fixed bug: ReplInFiles with empty replace string interpreted as FindInFiles

Postby ChrisGlo » Tue Jun 30, 2009 7:23 am

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.
ChrisGlo
Newbie
 
Posts: 2
Joined: Tue Jun 30, 2009 5:50 am

Re: Fixed bug: ReplInFiles with empty replace string interpreted as FindInFiles

Postby greg123 » Tue Mar 22, 2011 10:27 am

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

Greg
greg123
Newbie
 
Posts: 7
Joined: Mon Jun 21, 2010 5:48 am

Re: Fixed bug: ReplInFiles with empty replace string interpreted as FindInFiles

Postby Mofi » Wed Mar 23, 2011 4:37 am

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 1 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 I reported to IDM by email in summer 2009 which could be fixed only by changing the syntax back.

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.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4049
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Macros