aGerman wrote: ↑15 Apr 2018 13:14
Reading and writing HEX values might be easier.
It looks simpler and is probably preferred. By the time I've read your post I overcame the scope problem.
creating ASCII charMap[0-255]
Code: Select all
:: --------------------------------------------------------------------------------------------------------------------------
echo. &echo. &<nul set /P = ¯ creating ASCII charMap[0-255]...
:: --------------------------------------------------------------------------------------------------------------------------
:: last updated : 2015^04^12
:: support : naDelayed
:: (
2>nul MD "%$doskit.fullPath%\lib\charMap" &pushd "%$doskit.fullPath%\lib\charMap" &&(
for /L %%i in (
0, 1, 255
) do if not exist "%%i.CHR" if %%i NEQ 26 (
> "%%i.TMP" type NUL
>nul makecab /D compress=OFF /D reserveperdatablocksize=26 /D reserveperfoldersize=%%i "%%i.TMP" "%%i.CHR"
type %%i.CHR |(
>nul ( for /L %%N in ( 1, 1, 38 ) do pause )
> "%%i.TMP" findStr.EXE /BRIC:"^"
)
>nul copy /Y "%%i.TMP" /A "%%i.CHR" /B
del /F /Q "%%i.TMP"
) else >nul copy /Y NUL + NUL /A "%%i.CHR" /A
popd
)
:: )
>>"%$log.fullPathfile%" (echo.creating ASCII charMap[0-255] [ok:generated]) &echo. &<nul set /P = ® ASCII 0-255 [ok:generated]
:: --------------------------------------------------------------------------------------------------------------------------
retrieving $bs, $tab, $lf, $cr, $sub, $esc
Code: Select all
:: --------------------------------------------------------------------------------------------------------------------------
echo. &echo. &<nul set /P = ¯ retrieving $bs, $tab, $lf, $cr, $sub, $esc...
:: --------------------------------------------------------------------------------------------------------------------------
:: (
if not exist "%~dp0\lib\ASCII.table" (
::
>nul copy "%~dp0\lib\charMap\35.CHR" "%~dp0\lib\ASCII.table" &for /L %%i in ( 1, 1, 255 ) do (
::
>nul copy "%~dp0\lib\ASCII.table" /B + "%~dp0\lib\charMap\%%i.CHR" /B "%~dp0\lib\ASCII.table" /B
)
)
< "%~dp0\lib\ASCII.table" set /P "$ASCII.table=" &echo. &echo. &set $ASCII.table
set /A $bs = 8, $tab = 9, $lf = 10, $cr = 13, $sub = 26, $esc = 27
setlocal enableDelayedExpansion
:: (
for %%? in (
$bs, $tab, $lf, $cr, $sub, $esc
) do for %%i in ( !%%?! ) do (
for /F tokens^=1-2^ delims^=#^ eol^=# %%r in ( "!$ASCII.table:~%%i,1!# " ) do (
if "%%s" NEQ "" (
endlocal &set "%%?=%%~r" &setlocal enableDelayedExpansion
) else for %%r in ( "!$ASCII.table:~%%i,1!" ) do (
endlocal &set "%%?=%%~r" &setlocal enableDelayedExpansion
)
)
)
:: )
endlocal
:: )
>>"%$log.fullPathfile%" (echo.retrieving $bs, $tab, $lf, $cr, $sub, $esc [ok:loaded]) &echo. &<nul set /P = ® retrieving $bs, $tab, $lf, $cr, $sub, $esc [ok:loaded]
:: (
setlocal enableDelayedExpansion
:: (
echo.
echo. &set $bs
echo.this%$bs%works
echo. &set $tab
echo.this%$tab%works
echo. &set $lf
echo.this!$lf!works
echo. &set $cr
echo.this!$cr!works
echo. &set $sub
echo.this%$sub%works
echo. &set $esc
echo.this%$esc%works
:: )
endlocal
:: )
:: --------------------------------------------------------------------------------------------------------------------------
::
goto :skip "()"
echo.endoftest
pause
exit
:skip ()
Code: Select all
» creating ASCII charMap[0-255]...
« ASCII 0-255 [ok:generated]
» retrieving $bs, $tab, $lf, $cr, $sub, $esc...
$ASCII.table=#☺☻♥♦
♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]
^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡
«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈıÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´±‗¾¶§÷¸°¨·¹³²
■
« retrieving $bs, $tab, $lf, $cr, $sub, $esc [ok:loaded]
$bs=
thiworks
$tab=
this works
$lf=
this
works
$cr=
works
$sub=→
this→works
$esc=←
this←works
endoftest
Druk op een toets om door te gaan. . .
I'll test my own code first, I may change to yours more simpler solution when I start realigning the optional classes that deal with mapping dec and hex values, I have the charmap functions, was gonna take a look at them anyways, but you guys were so quick to respond.
Thanks !