Here is test.bat

Code: Select all

```
@echo off
setlocal enableDelayedExpansion
:read_map
del _TEMP.txt
set map=test.bgem
set /a cell=0
for /F "tokens=* delims=" %%a in ('type %map%') do (
Set /a cell+=1
Set "output[!cell!]=%%a"
set "output[cur]=%%a"
echo !output[cur]!
for /f "tokens=1 delims=," %%i in ("!output[%cell%]!") do set output[%cell%]_x=%%i
for /f "tokens=1 delims=:" %%i in ("!output[%cell%]!") do set output[%cell%]_y=%%i
echo !output[%cell%]_y! >> _TEMP.txt
call:findString output[%cell%]_y "," pos
if not defined pos echo.Substring not found&goto:eof
echo.Position is: %pos%
set /A pos=%pos%+1
echo x: !output[%cell%]_x!
echo y: !output[%cell%]_y:~%pos%,2!
echo.
)
pause
REM https://www.dostips.com/forum/viewtopic.php?t=194 credits DosItHelp
:findString -- returns the zero based postion of one string in another string of maximum length of 1023 characters
:: -- %~1: in - varible name of a string to be serached
:: -- %~1: in - string to be found
:: -- %~3: out- return variable name, will be set to position or undefined if string not found
set "str=!%~1!"
set "str=!str:%~2=@@@@!
set "str=%str:@@@@="&REM %
if "%str%"=="!%~1!" (
ENDLOCAL&IF "%~3" NEQ "" SET "%~3="
GOTO:EOF
)
set str=A!str!& rem keep the A up front to ensures we get the length and not the upper bond
rem it also avoids trouble in case of empty string
set len=0
set /a n=1024
set /a n^>^>=1, len+=n
if !str:~%len%!. == . set /a len-=n
set /a n^>^>=1, len+=n
if !str:~%len%!. == . set /a len-=n
set /a n^>^>=1, len+=n
if !str:~%len%!. == . set /a len-=n
set /a n^>^>=1, len+=n
if !str:~%len%!. == . set /a len-=n
set /a n^>^>=1, len+=n
if !str:~%len%!. == . set /a len-=n
set /a n^>^>=1, len+=n
if !str:~%len%!. == . set /a len-=n
set /a n^>^>=1, len+=n
if !str:~%len%!. == . set /a len-=n
set /a n^>^>=1, len+=n
if !str:~%len%!. == . set /a len-=n
set /a n^>^>=1, len+=n
if !str:~%len%!. == . set /a len-=n
set /a n^>^>=1, len+=n
if !str:~%len%!. == . set /a len-=n
( ENDLOCAL & REM RETURN VALUES
IF "%~3" NEQ "" SET %~3=%len%
)
GOTO:EOF
```

And here is test.bgem

Code: Select all

```
0,0:sf2/a;
12,10:sf2/a;
```

Thanks,

Exro