Hi,
nice tool, but when I use it as batch mode in a cmd line I need to put wait state between several replaced lines
f.e. this is not working .. only the first line i replaced:
*****************
call:replace_ini "C:\Program Files (x86)\myfolder" "file.ini" "PosX=[0-9]+" "PosX=1678"
call:replace_ini "C:\Program Files (x86)\myfolder" "file.ini" "PosY=[0-9]+" "PosY=0"
call:replace_ini "C:\Program Files (x86)\myfolder" "file.ini" "SizeX=[0-9]+" "SizeX=898"
call:replace_ini "C:\Program Files (x86)\myfolder" "file.ini" "SizeY=[0-9]+" "SizeY=1049"
goto :eof
:replace_ini
:: %1 is the path
:: %2 is the file
:: %3 is the input string
:: %4 is the string to put
"M:\scripts\fnr.exe" --cl --dir %1 --fileMask %2 --useRegEx --find %3 --replace %4 --silent
goto:eof
*********************
if the called process is the one here than its working:
:replace_ini
:: %1 is the path
:: %2 is the file
:: %3 is the input string
:: %4 is the string to put
"M:\scripts\fnr.exe" --cl --dir %1 --fileMask %2 --useRegEx --find %3 --replace %4 --silent
ping -n 8 localhost >nul
goto:eof
Only difference is that I add a short wait after executing the command
I guess the file close process need some time. Can you do something in upcoming version to have the end of the exe clean with the file closed !
Thx a lot for the nice tool !
Comments: I have provided some test files to demonstrate this issue and to show that by inserting a delay between successive calls to fnr.exe that the errors go away, longer delays are more beneficial to removing the errors .
Extract the zip to C:\Software.ins\SearchReplace\FNR-exe\
Run StressTest-FNR.bat The results report will be in results.txt.
The batch file StressTest-FNR calls StressTestSearchReplace0.bat, StressTestSearchReplace1.bat and StressTestSearchReplace2.bat in a 20 times loop. These batch files each call fnr.exe 17 times and process a html file. The bat files have a zero delay, 1 second and 2 second delay between call to fnr.exe according to their names StressTestSearchReplace0, StressTestSearchReplace1 and StressTestSearchReplace2. The results.txt file lists the times when fnr.exe returned an errorlevel of 2. A sample report looks like:
---------- REPORT0.TXT
erlvl 2 delete any white space around a right curly bracket
erlvl 2 delete any white space around a right curly bracket
erlvl 2 delete any white space around a right curly bracket
erlvl 2 reinstate :// in URLs
erlvl 2 delete any white space around a right curly bracket
erlvl 2 delete any white space around a right curly bracket
erlvl 2 reinstate :// in URLs
erlvl 2 delete any white space around a right round bracket
---------- REPORT1.TXT
erlvl 2 reinstate our doc type
erlvl 2 delete any white space around a right curly bracket
erlvl 2 delete any white space around a semi colon
erlvl 2 escape out :// in URLs
---------- REPORT2.TXT
According to this the calls to fnr.exe without a delay had 8 errors
The calls to fnr.exe separated with a delay of 1 second had 4 errors
and the calls to fnr.exe separated with a delay of 2 seconds had zero errors.
The section REPORT0.TXT refers to the errors obtained when using StressTestSearchReplace0.bat
Warning, these tests take approx 20 mins to run, each time the report files REPORT0.TXT, REPORT1.TXT, REPORT2.TXT and results.txt are deleted. So if you want to keep previous reports then copy them to somewhere else.