Page 36 of 37

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

Posted: 24 Apr 2022 10:32
by aGerman
I think option /P and friends are helpful here.

Code: Select all

cmd /c jrepl.bat . "" /P "(.+)\r\n(.*)" /PFLAG "" /PREPL "$1+$2" /M /F "a.txt" /O "b.txt"
Steffen

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

Posted: 02 May 2022 09:58
by BCX454
It does not work with windows 11 :( It seems like it is discontinued

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

Posted: 02 May 2022 14:55
by aGerman
I'm using JREPL on Win 11 without any problems. If you have issues please elaborate on how to reproduce them.

Steffen

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

Posted: 13 Jun 2022 18:35
by vin97
I ran across a strange problem when running multiple looped batch files in parallel that all execute (individual copies of) JREPL.

Code: Select all

C:\Users\Vini\AppData\Local\Temp\jrepl.bat.14.06.2022_ 2.21.56,50_27286.temp"\\"!")" kann syntaktisch an dieser Stelle nicht verarbeitet werden.
This is a nonsense error that does never ever happen if running only a single batch with exactly the same content.

Which one of the parallel running batch files is the one that fails seems pretty much random, as well as how soon after launch it fails.
The error is much more likely to occur when the batch files are running on low priority and it also correlates with the amount of parallel batch loops.

It seems to me that JREPL needs to generate even finer names for the tempfiles it uses. Maybe even throw in completely random character strings that are unlikely to occur twice.
My explaination is that if two JREPL instances are by chance executed at exactly the same moment, the temp files will overlap and produce strange bugs.
Running on low priority means less executions per second which increases the chance of this happening.

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

Posted: 14 Jun 2022 03:22
by siberia-man
vin97 wrote:
13 Jun 2022 18:35
My explaination is that if two JREPL instances are by chance executed at exactly the same moment, the temp files will overlap and produce strange bugs.
That's true. Once I had the same issue in a pipe which looks like this:

Code: Select all

C:\Temp>type z.bat
@echo:%RANDOM%>&2

C:\Temp>z | z
1826
1826
By the following link you can find the long discussion how we tried to fix it. viewtopic.php?f=3&t=6133&hilit=cmdpid

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

Posted: 14 Jun 2022 06:22
by vin97
siberia-man wrote:
14 Jun 2022 03:22
By the following link you can find the long discussion how we tried to fix it. viewtopic.php?f=3&t=6133&hilit=cmdpid
Before I dive in, did you find a solution or not?
In my case, the total number of maximum parallel JREPL calls is fixed, so in theory I could give each batch file its own JREPL copy and edit this copy to produce tempfiles with an extra prefix.
Do you think this would work?

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

Posted: 14 Jun 2022 09:32
by vin97
Never mind, the solution was on the first page. I just put timeout /t 1 in my cmd.exe spawnloop.

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

Posted: 08 Jul 2022 05:48
by dalewz
Hi Experts,

We are using JREPL.BAT v8.6 to build our installers.

We have a team who add new folders/files under installers folder. every time they did this, we needed to modify the script.
Could Jrepl.bat takes multi input files by using a wild char? here is the script:

call %jrepl_cmd% "(\d{1,})\.(\d{1,})\.(\d{1,})\.(\d{1,})" %FINALVERSION% /f "Installers\T1\T1Installer_Release.iss" /o -
call %jrepl_cmd% "(\d{1,})\.(\d{1,})\.(\d{1,})\.(\d{1,})" %FINALVERSION% /f "Installers\M1\M1Installer_Release.iss" /o -

how can i change the above two lines into 1 line?

i tried this:
call %jrepl_cmd% "(\d{1,})\.(\d{1,})\.(\d{1,})\.(\d{1,})" %FINALVERSION% /f "Installers\*" /o -

it did not work as jrepl reported reading input error. any suggestions?

thanks,
dale

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

Posted: 08 Jul 2022 09:23
by aGerman
You may use a FOR /R loop in order to recursively enumerate all *.iss files in the Installers folder.

Code: Select all

for /r "Installers" %%i in (*.iss) do call %jrepl_cmd% "(\d{1,})\.(\d{1,})\.(\d{1,})\.(\d{1,})" %FINALVERSION% /f "%%~i" /o -
Steffen

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

Posted: 09 Jul 2022 06:27
by dalewz
Hi Steffen,

Thank you for your help. I tried it but reported input error:
"The filename, directory name, or volume label syntax is incorrect."
buildinstallers-2F-1.PNG
the change is in the left. the original is on the right
buildinstallers-2F-1.PNG (177.82 KiB) Viewed 48088 times
the change is in the left. the original is on the right.

Also, the folder has two iss files: one for release, the other for debug.

test1 for /r "Installers" %%i in (*_Release.iss) do call %jrepl_cmd% "(\d{1,})\.(\d{1,})\.(\d{1,})\.(\d{1,})" %FINALVERSION% /f "%%~i" /o -
test2 for /r "Installers" %%i in (*.iss) do call %jrepl_cmd% "(\d{1,})\.(\d{1,})\.(\d{1,})\.(\d{1,})" %FINALVERSION% /f "%%~i" /o -

I tried both test1 and test2. they gave me the same error.

Could you help?
Thank again,
Dale

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

Posted: 09 Jul 2022 08:12
by aGerman
I don't know. Check the contents of your variables. What is the reason for getting output like "Current branch not provided". Also the "ECHO is OFF" is what you'll get if you try to output a variable that is not defined (did not get a value assigned). However, only you can figure out which variable in your script is the culprit ¯\_(ツ)_/¯

Steffen

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

Posted: 09 Jul 2022 14:56
by dalewz
Steffen,

Your change is causing this "The filename, directory name, or volume label syntax is incorrect."

This means we cannot read the input files properly.

Please ignore "Current branch not provided" as i disabled this part of the script.

the main focus is how to read multi files in one line script. i certainly agree with your approach as i thought about the same.
thanks,
dale

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

Posted: 09 Jul 2022 15:25
by aGerman
I created foder "test" on my desktop with subfolder "Installers" (incl. all of what you told before) and test.bat.

test.bat

Code: Select all

@echo off &setlocal
echo ============================================================
tree "%cd%" /f

echo ============================================================
for /r "Installers" %%i in (*.iss) do echo "%%~i"

echo ============================================================
pause
Output:

Code: Select all

============================================================
Auflistung der Ordnerpfade für Volume Windows-SSD
Volumeseriennummer : D470-BFC1
C:\USERS\STEFFEN\DESKTOP\TEST
│   test.bat
│
└───Installers
    ├───M1
    │       M1Installer_Release.iss
    │
    └───T1
            T1Installer_Release.iss

============================================================
"C:\Users\steffen\Desktop\test\Installers\M1\M1Installer_Release.iss"
"C:\Users\steffen\Desktop\test\Installers\T1\T1Installer_Release.iss"
============================================================
Drücken Sie eine beliebige Taste . . .
Of course the *.iss files are just empty text files in my case and it doesn't make sense to call JREPL. However, as the output shows they are found.
Again, I can't help any further because based on the information you gave this test environment is the only thing I was able to create.

Steffen

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

Posted: 12 Jul 2022 12:03
by dalewz
Steffen,

your script works well.

but this in one line does not work:

for /r "..\Installers" %%i in (*_Release.iss) do call %jrepl_cmd% "(\d{1,})\.(\d{1,})\.(\d{1,})\.(\d{1,})" %FINALVERSION% /f "%%~i" /o -

separately they work well:

for /r "..\Installers" %%i in (*_Release.iss) do echo "%%~i"

call %jrepl_cmd% "(\d{1,})\.(\d{1,})\.(\d{1,})\.(\d{1,})" %FINALVERSION% /f "Installers\T1\T1Installer_Release.iss" /o -

any suggestions?

thanks,
dale

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

Posted: 12 Jul 2022 13:21
by aGerman
I don't know what you're doing wrong ¯\_(ツ)_/¯
Alright, another attempt ...
I updated my test environment. Having now also a folder "foo" in "test" wherin "test.bat" is saved. Just to show you that the "..\installers" path in the FOR /R loop works as well. Furthermore I update the content of the *.iss files in order to show that JREPL is able to do its job.

test.bat

Code: Select all

@echo off &setlocal
echo ===========================================================================
REM Print the file tree rooted in the parent directory
tree "%cd%\.." /f


REM location of JREPL.bat is the grandparent folder in my case (my desktop)
set jrepl_cmd="..\..\JREPL.bat"
REM I *guess* something about like that is how FINALVERSION is assigned based on what the
REM  search pattern indicates, and based on the fact that you didn't quote %FINALVERSION%
REM  in the command line
set FINALVERSION="4.55.6.7"

REM Find *.iss files
echo ===========================================================================
for /r "..\Installers" %%i in (*_Release.iss) do (
  echo *************************************************************************
  REM See which file is found
  echo found:
  echo "%%~i"
  echo -----------------------------------------------------------------------
  REM For test purposes, write some content into the found file containing a version numbering
  >"%%~i" echo foo version 4.33.222.1 bar baz
  REM Print the current content
  echo content before:
  type "%%~i"
  echo -----------------------------------------------------------------------
  REM For debugging purposes, output the JREPL command line using ECHO,
  REM  deliberately having CALL still the first command because it *may* alter string contents
  call echo %jrepl_cmd% "(\d{1,})\.(\d{1,})\.(\d{1,})\.(\d{1,})" %FINALVERSION% /f "%%~i" /o -
  REM Actually call JREPL.bat to replace the version
  call %jrepl_cmd% "(\d{1,})\.(\d{1,})\.(\d{1,})\.(\d{1,})" %FINALVERSION% /f "%%~i" /o -
  echo -----------------------------------------------------------------------
  REM Print the new content
  echo content after:
  type "%%~i"
)

echo ===========================================================================
pause
Output:

Code: Select all

===========================================================================
Auflistung der Ordnerpfade für Volume Windows-SSD
Volumeseriennummer : D470-BFC1
C:\USERS\STEFFEN\DESKTOP\TEST
├───foo
│       test.bat
│
└───Installers
    ├───M1
    │       M1Installer_Release.iss
    │
    └───T1
            T1Installer_Release.iss

===========================================================================
*************************************************************************
found:
"C:\Users\steffen\Desktop\test\Installers\M1\M1Installer_Release.iss"
-----------------------------------------------------------------------
content before:
foo version 4.33.222.1 bar baz
-----------------------------------------------------------------------
"..\..\JREPL.bat" "(\d{1,})\.(\d{1,})\.(\d{1,})\.(\d{1,})" "4.55.6.7" /f "C:\Users\steffen\Desktop\test\Installers\M1\M1Installer_Release.iss" /o -
-----------------------------------------------------------------------
content after:
foo version 4.55.6.7 bar baz
*************************************************************************
found:
"C:\Users\steffen\Desktop\test\Installers\T1\T1Installer_Release.iss"
-----------------------------------------------------------------------
content before:
foo version 4.33.222.1 bar baz
-----------------------------------------------------------------------
"..\..\JREPL.bat" "(\d{1,})\.(\d{1,})\.(\d{1,})\.(\d{1,})" "4.55.6.7" /f "C:\Users\steffen\Desktop\test\Installers\T1\T1Installer_Release.iss" /o -
-----------------------------------------------------------------------
content after:
foo version 4.55.6.7 bar baz
===========================================================================
Drücken Sie eine beliebige Taste . . .
Read the comments in the script and see what I did for debugging reasons. Just try to do something similar in your script. Also you may want to turn ECHO ON at the beginning of your script in order to see which command lines do actually cause errors.

Steffen