├── GetInput.exe ├── batbox.exe ├── Screenshot.png ├── README.md ├── Test_Button_Function.bat ├── LICENSE └── Button.bat /GetInput.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Psi505/Batch-GUI-Button/HEAD/GetInput.exe -------------------------------------------------------------------------------- /batbox.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Psi505/Batch-GUI-Button/HEAD/batbox.exe -------------------------------------------------------------------------------- /Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Psi505/Batch-GUI-Button/HEAD/Screenshot.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## About 2 | 3 | This repository contains a straightforward program designed for batch projects, offering an enhanced GUI Buttons function. 4 | 5 | - Refer to the usage example provided. 6 | - Comments within the "Button.bat" file provide insights into the program's functionality. 7 | 8 | ## Screenshot 9 | 10 | ![](https://raw.githubusercontent.com/Psi505/Batch-GUI-Button/main/Screenshot.png) 11 | -------------------------------------------------------------------------------- /Test_Button_Function.bat: -------------------------------------------------------------------------------- 1 | @Echo off 2 | @Mode 48,15 3 | @Title %~n0 4 | 5 | cd %~dp0 &:: Added line for program to work when run as admin 6 | Batbox /h 0 7 | 8 | :Loop 9 | Call Button 10 4 "Open cmd" 24 4 "Close Cmd" 17 8 " Exit " # Press 10 | Getinput /m %Press% /h 70 11 | 12 | :: Check for the pressed button 13 | if %errorlevel%==1 (start "Cmd") 14 | if %errorlevel%==2 (taskkill /f /fi "windowtitle eq Cmd" >nul 2>&1) 15 | if %errorlevel%==3 (exit) 16 | goto Loop -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Psi505 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Button.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | @setlocal enabledelayedexpansion 3 | 4 | :: The Function was created and enhanced by Psi505 5 | 6 | ::---- Abbreviations meaning ----:: 7 | :: XBPB = X Button Positin Begin 8 | :: YBPB = Y Button Positin Begin 9 | :: XBPM = X Button Position Middle 10 | :: YBPM = Y Button Position Middle 11 | :: XBPE = X Button Positin End 12 | :: YBPE = Y Button Positin End 13 | :: HL = Horizontal line 14 | :: Lng[B] = Button Length 15 | :: 16 | ::------------ Help ------------:: 17 | :: [%1 = X coordinate] 18 | :: [%2 = Y coordinate] 19 | :: [%3 = Text of the Button] 20 | :: [%4 = '#' : The end of arguments] 21 | :: [%5 = 'Press' : Varible to use with Getinput.exe] 22 | :: 23 | ::------------------------------:: 24 | :: Exemple : Call Button [X1] [Y1] "Button 1" [X2] [Y2] "Button 2" [X3] [Y3] "Button 3" # Press 25 | ::------------------------------:: 26 | 27 | 28 | ::------------- Begin Program -------------:: 29 | :SLoop 30 | if "%1"=="" (exit) 31 | if "%1"=="#" (batbox !Buttons! & endlocal & set "%~2=%Button_Dim%" & exit /b) 32 | set XBPB=%1 33 | set YBPB=%2 34 | set "Text_Button=%~3" 35 | 36 | :: Calculate the button length 'X2' 37 | call :Length "%Text_Button%" Lng[B] 38 | 39 | :: Calculate x & y positions 40 | set /a XBPE= XBPB + Lng[B] + 3 41 | set /a YBPE= YBPB + 2 42 | set /a XBPM= XBPB + 1 43 | set /a YBPM= YBPB + 1 44 | set /a _Lng[B]= Lng[B] + 2 45 | :: Make the hor line 46 | set "HL=" & for /l %%i in (1,1,!_Lng[B]!) do (set HL=!HL! /a 196 ) 47 | 48 | :: Calculate the button dim 49 | set /a XBB= XBPB + 1 50 | set /a YBB= YBPB + 1 51 | set /a XBE= XBPE - 1 52 | set /a YBE= YBPE - 1 53 | set Button_Dim=%Button_Dim% %XBB% %YBB% %XBE% %YBE% 54 | 55 | :: Make the button 56 | set Top_Left=/g %XBPB% %YBPB% /a 218 57 | set Top_Rihgt=/g %XBPE% %YBPB% /a 191 58 | set Base_Left=/g %XBPB% %YBPE% /a 192 59 | set Base_Right=/g %XBPE% %YBPE% /a 217 60 | set Hor_Line=/g %XBPM% %YBPB% !HL! /g %XBPM% %YBPE% !HL! 61 | set Ver_Line=/g %XBPB% %YBPM% /a 179 /g %XBPE% %YBPM% /a 179 62 | set Text_Po=/g %XBPM% %YBPM% /d " %Text_Button% " 63 | 64 | :: Make all the buttons 65 | set Buttons=!Buttons! %Top_Left% %Top_Rihgt% %Base_Left% %Base_Right% %Hor_Line% %Ver_Line% %Text_Po% 66 | 67 | :: Get the next items 68 | for /l %%i in (1,1,3) do (shift /1) 69 | goto SLoop 70 | ::------------- End Program -------------:: 71 | 72 | ::------------- Begin Funcs -------------:: 73 | :Length 74 | set str=%~1 75 | set cn=-1 76 | :_Lp 77 | set /a cn+=1 78 | if "!str:~%cn%,1!" neq "" (goto _Lp) 79 | endlocal & set %2=!cn! 80 | exit /b 81 | ::------------- End Funcs -------------:: 82 | --------------------------------------------------------------------------------