/Box

It Prints simple box on the cmd console at specified X Y co-ordinate. This function helps in Adding a little GUI effect into your batch program.

Primary LanguageBatchfileGNU General Public License v3.0GPL-3.0

Box v20220420 - by Kvc

Description

This function helps in Adding a little GUI effect into your batch program. It Prints simple box on the CMD console at specified X Y co-ordinate with different options.

Author: Kvc

Usage

Call Box [X] [Y] [Height] [Width] [Sepration] [BG_Char] [color] [Type] [_Var]
call Box [help | /? | -h | -help]
call Box ver

Where:

X		            = X-ordinate of top-left corner of box  
Y		            = Y-co_ordinate of top-left corner of box  
Height		            = height of box  
Width		            = width of box  
Sepration	            = width From where to separate box,if don't specified or  
	                      specified '-' (minus),then box will not be separated.  
BG_char	                    = Background element of Box,if not specified or specified  
	                      '-' (minus),then no background will be shown...It should be  
	                      a single Character...  
color		            = the color Code for the Box,e.g. fc,08,70,07 etc...  
	                      Don't define it if you want default colour...or type '-'  
	                      (minus) for no color change...  
Type 		            = The style / type of the Box you want, double Border, single  
	                      Border etc. New, No Border Option added [Valid values: 0 to 4]  
_Var 		            = Variable to Save Output, instead of Printing Directly.  
		              (Optional)  
ver		            = Version of Box function  
help		            = Displays help for the program

Example:

Creating a Simple Box Layout

Creating a simple box with the height and width given by the user. in the example given below I created a box of Height and Width both as 10 at coordinate 4,4 :

box 4 4 10 10

Box with separation and filled with character

We can also create a box with Separation and fill it with characters instead of just empty spaces. you just have to add a number (shorter than the width of the box) where you want to create the separation as the fifth parameter (don't specify or specify '-' (minus), if you don't want to create separation). To add character instead of free space add any character as the sixth parameter as I have inserted 'o' (don't specify or specify '-' (minus), if you don't want to add any character in the box). 'o' (don't specify or specify '-' (minus), if you don't want to add any character in the box).

box 4 4 10 20 10 o

Adding color and style to our box

We can also add color to the background or border of the box. To do that you have to pass the seventh parameter having two characters i.e color code of background and border respectively. We can also store the box in a variable and call it using the batbox plugin. As I have shown in the example below.

We can also change the style of the box by using numbers 0-4 as the eighth parameter. Where the numbers 0-4 are:

  • 0: No border
  • 1: Single lined border
  • 2: Double-lined border
  • 3: Double-lined top & bottom, single lined sides
  • 4: Single lined top and bottom, double-lined sides
box 4 4 10 10 - - 1a 2 _a
batbox %_A%

Article Link https://batch-man.com/create-box-in-cmd/

Video Link https://youtu.be/ficRp89PXwo