Page 1 of 1

Strange thing

Posted: 15 Jul 2024 12:22
by miskox
See this:

Code: Select all

@echo off
setlocal
cls
call :createbinvalue 219 DEL
set filler=&rem
set polnilo=&rem
for /L %%f in (1,1,78) do call set filler=%%char219%%%%filler%%
for /L %%f in (1,1,78) do call set polnilo=%%char219%%%%polnilo%%

echo fill=%filler%
echo poln=%polnilo%
goto :EOF
:createbinvalue
REM par1=decima value between 0 and 255
REM par2: if DEL set the variable only (delete chr file)
md _exe\_chrs_>nul 2>nul
if exist _exe\_chrs_\%1.chr goto :gonext
set "options=/d compress=off /d reserveperdatablocksize=26"
if %~1 neq 26  (type nul >_exe\_chrs_\t.tmp
makecab %options% /d reserveperfoldersize=%~1 _exe\_chrs_\t.tmp _exe\_chrs_\%~1.chr >nul
type _exe\_chrs_\%~1.chr | (
(for /l %%N in (1 1 38) do pause)>nul&findstr "^">_exe\_chrs_\t.tmp)
>nul copy /y _exe\_chrs_\t.tmp /a _exe\_chrs_\%~1.chr /b
del _exe\_chrs_\t.tmp
) else (copy /y nul + nul /a _exe\_chrs_\26.chr /a >nul)
:gonext
if "%2"=="DEL" (
 for /F "delims=" %%y in (_exe\_chrs_\%1.chr) do set "char%1=%%y"
del _exe\_chrs_\%1.chr
rd _exe\_chrs_
)
goto :EOF
Variables filler and polnilo should be the same:

Code: Select all

fill=█78iller
poln=██████████████████████████████████████████████████████████████████████████████

C:\>
The problem lies here:

Code: Select all

for /L %%f in (1,1,78) do call set filler=%%char219%%%%filler%%
Variable must not start with letter 'f' because '%%f' is used.

Saso

Re: Strange thing

Posted: 16 Jul 2024 00:59
by jeb
Hi miskox,

Code: Select all

for /L %%f in (1,1,78) do call set filler=%%char219%%%%filler%%
It's simply the "f" in "%%f ... iller%%"
You used %%f as your FOR-metavariable, change that or use another variable name

Re: Strange thing

Posted: 16 Jul 2024 04:52
by miskox
jeb wrote:
16 Jul 2024 00:59
Hi miskox,

Code: Select all

for /L %%f in (1,1,78) do call set filler=%%char219%%%%filler%%
It's simply the "f" in "%%f ... iller%%"
You used %%f as your FOR-metavariable, change that or use another variable name
Thank you, Jeb. I noticed that. That's what I wrote at the end. Maybe somebody might have the same problem.

Saso