Draw a box

  • Hello Guest! Welcome to ConsoleCrunch, to help support our site check out the premium upgrades HERE! to get exclusive access to our hidden content.
  • Unable to load portions of the website...
    If you use an ad blocker addon, you should disable it because it interferes with several elements of the site and blocks more than just adverts.
  • Read Rules Before Posting Post Virus Scans with every program.

Assaultz

Member
Dec 11, 2016
431
256
73
m0X6gQC.png




CODE :

[HIDE]@echo off&& setlocal&& cls
REM Draws a rectangle with X1, Y1, Width and Height specified by inputs
set "x=%1"&& set "y=%2"&& set "w=%3"&& set "h=%4"

REM Place blank lines above
set /a yBefore=%y% - 1
for /l %%a in (1,1,%yBefore%) do (echo.)

REM Create rectangle components
set /a xRemaining=%x%-1
set wRemaining=%w%
:topLineGen
if NOT %xRemaining% == 0 set /a xRemaining-=1&& set "topLine=%topLine% "&& goto :topLineGen
set "topLine=%topLine%#"&& set /a wRemaining-=1
if NOT %wRemaining% == 0 goto :topLineGen

REM Render top line
echo %topLine%

REM Create middle line
set xRemaining=%x%
set /a wRemaining=%w%-2
:midLinePreGen
if %xRemaining% GTR 1 set /a xRemaining-=1&& set "midLine=%midLine% "&& goto :midLinePreGen
set "midLine=%midLine%#"
:midLineGen
if %wRemaining% GTR 0 set /a wRemaining-=1&& set "midLine=%midLine% "&& goto :midLineGen
if %w% GTR 1 set "midLine=%midLine%#"

REM Render middle lines
set /a midLinesRemaining=%h%-2
:renderMidLines
if %midLinesRemaining% GTR 0 echo %midLine%&& set /a midLinesRemaining-=1&& goto :renderMidLines

REM If the height is greater than 1, render a bottom line (we can re-use %topLine% variable)
if %h% GTR 1 echo %topLine%
endlocal
exit /b
[/HIDE]

Enjoy :P
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Chat Bot:
    xushnud is our newest member. Welcome!
  • Chat Bot:
    hungnho258 is our newest member. Welcome!
  • Chat Bot:
    lawnmower is our newest member. Welcome!
  • Chat Bot:
    ME66666666 is our newest member. Welcome!
  • Chat Bot:
    TheRealToxic is our newest member. Welcome!
  • @ TheRealToxic:
    Hello friends
  • Chat Bot:
    bunnylover8024 is our newest member. Welcome!
  • Chat Bot:
    QM|T_JinX has joined the room.
  • @ QM|T_JinX:
    TheRealToxic said:
    Hello friends
    sup bro
  • Chat Bot:
    suhb is our newest member. Welcome!
  • Chat Bot:
    vitdb is our newest member. Welcome!
  • @ vitdb:
    hi
  • @ QM|T_JinX:
    hi
  • Chat Bot:
    QM|T_JinX has joined the room.
  • Chat Bot:
  • Chat Bot:
    QM|T_JinX has joined the room.
  • Chat Bot:
    Benders is our newest member. Welcome!
  • @ ShutTheCrunchUp:
    Damn bro miss the good ol days
    +1
  • Chat Bot:
    QM|T_JinX has joined the room.
  • Chat Bot:
    lordKenny is our newest member. Welcome!
  • Chat Bot:
    yotatouch is our newest member. Welcome!
  • Chat Bot:
    maikito is our newest member. Welcome!
  • Chat Bot:
    maikito is our newest member. Welcome!
  • Chat Bot:
    QM|T_JinX has joined the room.
      Chat Bot: QM|T_JinX has joined the room.