Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off & setlocal enableDelayedExpansion
- call :grid /F 3 "3x5" /s
- call :display
- pause & exit
- :grid
- for /l %%a in (0,1,%gridMaxHeight%) do set "line[%%a]="
- for %%a in (gHeight gWidth gridMaxHeight gridMaxWidth bHeight bWidth i g s d z) do set "%%a="
- set "_t=A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"
- set /a "gHeight=%2"
- set "z=%1" & set "z=!z:~1,1!"
- for %%a in (%_t%) do set /a "i+=1" & if /i "%%a" equ "%z%" set "gWidth=!i!"
- for /f "tokens=1,2 delims=x" %%a in ("%~3") do set /a "bHeight=%%a + 1", "bWidth=%%b"
- set /a "gridMaxWidth=((gWidth * bWidth) + bWidth)", "gridMaxHeight=(gHeight * bHeight) + 1"
- set /a "g=gridMaxWidth - bWidth + gWidth + 1"
- for /l %%a in (1,1,%bWidth%) do set "s=!s! "
- for /l %%a in (1,%bWidth%,%gridMaxWidth%) do set "d=!d!!s!#"
- for /l %%a in (1,1,%gridMaxHeight%) do set "line[%%a]=#!line[%%a]!!d:~0,-%bWidth%!"
- for /l %%a in (1,1,%g%) do set "line[0]=!line[0]!#"
- for /l %%a iN (1,%bHeight%,%gridMaxHeight%) do set "line[%%a]=!line[0]!"
- if "%~4" equ "/s" set "ol=GRID: %gridMaxHeight%x%gridMaxWidth%/[A-%z%] x %gHeight%. - %~3 boxes"
- goto :eof
- :display
- cls
- if defined ol echo !ol!
- for /l %%a in (1,1,%gridMaxHeight%) do echo=!line[%%a]!
- goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement