Advertisement
T3RRYT3RR0R

Buttons

Jul 5th, 2021 (edited)
661
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 47.12 KB | None | 0 0
  1. @Echo off & Cls
  2.  
  3. REM This script should be copied from raw paste data or downloaded only
  4. REM Pastebins Syntax highlighting does not render this script correctly.
  5.  
  6. REM ** IMPORTANT NOTE: WINDOWS 11 has different Virtual terminal Syntax which broke this script.
  7. REM scipt has been updated to resolve this issue, by replacing previous supported Syntax for moving cursor
  8. REM up \EA down \EB Left \ED right \EC with explicit values: up \E[1A down \E[1B Left \E[1D right \E[1C
  9.  
  10. :# As exampled at: https://youtu.be/ZYhvUbek4Xc
  11.  
  12. :# Batch clickable button macros and example functions
  13. :# Author: T3RRY Version: 2.0.5 Last Update: 11/01/2022
  14. :# New features:
  15. :# Added 'def' arg to allow this file to be called to define macros for use in a calling file.
  16. :#  - Note:
  17. :#        - Delayed Expansion be DISabled prior to defining macros
  18. :#        - Delayed Expansion must be ENabled to expand macros
  19. :# Expanded help information
  20. :# Reduced number of macros and functions to simplify usage
  21. :# Added new switches to make.btn for controlling button toggle type and defaults
  22. :# Added prompt for permission to install bg.exe ; a required component of this file.
  23.  
  24. :testEnviron
  25.  
  26.  If Defined WT_SESSION (
  27.   Echo(This utility will not work as intended in windows terminal. Must be Run from Cmd.exe
  28.   Exit /b 1
  29.  )
  30.  
  31.  If "!!" == "" (Goto :button_help)
  32.  Set "Buttons_File=%~f0"
  33.  
  34. (Set \n=^^^
  35.  
  36. %= \n macro newline variable. Do not modify =%)
  37. (Set LF=^
  38.  
  39.  
  40. %= LF newline variable. Do not modify =%)
  41.  
  42. CLS
  43.  
  44. ====================:# OS Requirement tests
  45. :# Verify NTFS drive ** ADS Used to store Settings applied in demo function ColorMod
  46.  (Echo(verify.NTFS >"%~f0:Status") || (
  47.   Echo(This file must be located on an NTFS drive as it utilises Alternate Data Streams.
  48.   Pause
  49.   Exit /B 1
  50.  )
  51.  
  52. :# Windows Version control. Assigns flag true if system is windows 10 build GTR 10586
  53. :# https://en.wikipedia.org/wiki/ANSI_escape_code#DOS,_OS/2,_and_Windows
  54. :# Version 1511 build number = 10.0.10586
  55.  Set "Win10="
  56.  For /f "tokens=3 delims=." %%v in ('Ver')Do if %%v GTR 10586 Set "Win10=True"
  57.  
  58. :# If Win10 true ; Test if virtual terminal codes enabled ; enable if false
  59. :# removes win10 flag definition if version does not support Virtual Terminal sequences
  60. :# Reg values: https://devblogs.microsoft.com/commandline/understanding-windows-console-host-settings/
  61.  If defined Win10 (
  62.   Reg Query HKCU\Console | %SystemRoot%\System32\findstr.exe /LIC:"VirtualTerminalLevel    REG_DWORD    0x1" > nul || (
  63.     Reg Add HKCU\Console /f /v VirtualTerminalLevel /t REG_DWORD /d 1
  64.   ) > Nul && (
  65.     Echo(CMD restart required to complete Virtual terminal sequence Initialization.
  66.     Pause
  67.     EXIT
  68.   ) || Set "Win10="
  69.  )
  70.  
  71. :# Buttons macro Based on function at: https://www.dostips.com/forum/viewtopic.php?f=3&t=9222
  72.  
  73. :# Script Structure:
  74. :# OS and Exe Validation
  75. :# - Variable and macro Setup
  76. :#  - Functions
  77. :#   - Macro help handling
  78. :#    - [Script Break - Jump to :Main]
  79. :#     - Embedded Exe for Mouse and Key Inputs
  80. :#      - Main script body
  81.  
  82.  Set "reg.restore=(Call )"
  83.  
  84. :# disable QuickEdit if enabled. Restored at :end label if disabled by script
  85.   For /f "skip=1 Tokens=3" %%G in ('reg query HKEY_CURRENT_USER\console\ /v Quickedit')Do Set "QE.reg=%%G"
  86.    If "%QE.reg%" == "0x1" (
  87.    (Reg add HKEY_CURRENT_USER\console\ /v QuickEdit /t REG_DWORD /d 0x0 /f) > nul
  88.    Set "reg.restore=Reg add HKEY_CURRENT_USER\console\ /v QuickEdit /t REG_DWORD /d 0x1 /f"
  89.   )
  90.  
  91.  For /f %%e in ('Echo Prompt $E ^| cmd')Do Set "\E=%%~e"
  92.  
  93.  If not exist "%TEMP%\BG.exe" (
  94.   Echo(%\E%[33mThis program requires Bg.exe to run.%\E%[0m
  95.   Echo( Install from this file %\E%[32m[Y]%\E%[0m or Exit %\E%[31m[N]%\E%[0m ?
  96.   For /f "delims=" %%C in ('%SystemRoot%\System32\choice.exe /N /C:YN')Do if %%C==Y (
  97.    Certutil -decode "%~f0" "%TEMP%\BG.exe" > nul
  98.   )Else Goto :eof
  99.   Cls
  100.  )
  101.  
  102.  Set BG.exe="%TEMP%\BG.exe"
  103.  
  104.  For /f "tokens=4 Delims=: " %%C in ('CHCP')Do Set "active.cp=%%C"
  105.  chcp 65001 > nul
  106.  
  107.  Set "/??=0"
  108. :#0  \E33m
  109. :#0 Call this file with one of the below macro or function \E37mNames\E33m
  110. :#0 to see it's full usage information.
  111. :#0  \E36m
  112. :#0 Macros: \E37m
  113. :#0  Make.Btn   \E38;2;61;61;61m %Make.Btn% GroupName /S button text \E37m
  114. :#0  Get.Click  \E38;2;61;61;61m %Get.Click% GroupName OtherGroupName \E37m
  115. :#0  If.Btn     \E38;2;61;61;61m %If.Btn[Groupname]%[#] command \E37m
  116. :#0  Buffer     \E38;2;61;61;61m %Buffer:@=Alt% \E37m
  117. :#0             \E38;2;61;61;61m %Buffer:@=Main% \E37m
  118. :#0  Clean.Exit \E38;2;61;61;61m %Clean.Exit%
  119. :#0  \E36m
  120. :#0 Functions: \E37m
  121. :#0  YesNo      \E38;2;61;61;61m Call :YesNo "Option 1" "Option 2" "Spoken Prompt"
  122. :#0  \E36m
  123. :#0 Define macros for use in a calling .bat or .cmd script: \E37m
  124. :#0  Call buttons.bat def
  125. :#0
  126.  
  127.  Set "Buffer?=1"
  128. :#1 \E36m
  129. :#1 Usage:   %Buffer:@=Alt%
  130. :#1 \E0m          - Switch to Alt buffer; preserving content of main screen buffer.
  131. :#1 \E36m
  132. :#1          %Buffer:@=Main%
  133. :#1 \E0m          - Returns to main screen buffer.
  134. :#1
  135.  Set "Buffer.Hash=@"
  136.  Set "Buffer=If not "!Buffer.Hash!"=="@" ( <nul set /p "=!@!" )Else (Cls&Call "%~f0" Buffer&Call Echo(%\E%[31mUsage Error in %%0 - Missing or Incorrect Substitution^^!%\E%[0m&Pause &Exit)"
  137.  Set "Alt=%\E%[?1049h%\E%[?25l"
  138.  Set "Main=%\E%[?25h%\E%[?1049l%\E%[?25l"
  139.  
  140. :# button sound fx. disable by undefining buttonsfx below ; prior to definition of OnCLick macro
  141.  Set "buttonsfx=On"
  142.  %BG.exe% Play "%WINDIR%\Media\Windows Feed Discovered.wav"
  143.  Set "OnClick=(Call )"
  144.  Set "OnType=(Call )"
  145.  If defined buttonsfx (
  146.   For /f "Delims=" %%G in ('Dir /b /s "%WINDIR%\SystemApps\*KbdKeyTap.wav"')Do If exist "%%~G" Set "OnClick=(Start /b "" %BG.exe% Play "%%~G")"
  147.   Set "OnType=(start /b "" %BG.exe% Play "%WINDIR%\Media\Windows Feed Discovered.wav")"
  148.  )
  149.  
  150.  Set "Get.Click?=2"
  151. :#2 \E36m
  152. :#2 Usage: %Get.Click% \E0m{^<\E31mGroupName\E0m^> ^| ^<\E31mGroupName\E0m^> ^<\E31mOtherGroupName\E0m^>}
  153. :#2 \E33m
  154. :#2 Performs the following Actions: \E0m
  155. :#2  - Launches Bg.exe with mouse arg to get mouse click
  156. :#2  - Assigns 1 indexed Y;X pos of mouse click to c{Pos}
  157. :#2  - Performs a conditional comparison via substring modifications
  158. :#2    of all buttons Coordinates defined in each btn[GroupName] array
  159. :#2    matching against the Y;X value of c{Pos}
  160. :#2 \E33m
  161. :#2 On clicked position matching a buttons defined Coordinates: \E0m
  162. :#2  - If %Make.Btn% /T or /TM Switches used to define defined btn[Groupname][Index]{t}:
  163. :#2    - /T:
  164. :#2      - Toggles button visually by inverting colors
  165. :#2      - Toggles btn[Groupname][Index]{state} variable value: true / false
  166. :#2    - /TM:
  167. :#2      - Forces btn[Groupname][Index]{state} true for clicked button.
  168. :#2      * Use In conjunction with /D 'default' or /CD 'Conditional Default' switch
  169. :#2        when a mandatory single selection is required.
  170. :#2  - Defines the following:
  171. :#2     If.btn[GroupName]=\E35mIf [Groupname][Index] == [GroupName]\E0m
  172. :#2     Group=GroupName
  173. :#2     Clicked[Groupname]=Button Text
  174. :#2     ValidClick[GroupName]=[GroupName][Index]
  175. :#2     - Tip reference values directly using: \E36m
  176. :#2       !Clicked[%Group%]!
  177. :#2       !ValidClick[%Group%]!  \E0m
  178. :#2  - Plays the system file KbdKeyTap.wav [If Present] as a clicking sound.
  179. :#2 \E33m
  180. :#2 On clicked position not matching a buttons defined Coordinates: \E0m
  181. :#2  - Defines:
  182. :#2     If.btn[GroupName]=\E36mIf Not.Clicked ==\E0m
  183. :#2  - Undefined:
  184. :#2     Group
  185. :#2      - To loop to a label and wait for a valid click of any
  186. :#2        button defined to a supplied GroupName, Use:
  187. :#2        \E36mIf not defined Group Goto :\E33mlabel\E0m
  188. :#2     Clicked[Groupname]
  189. :#2     ValidClick[GroupName]
  190. :#2
  191.  Set "If.Btn?=4"
  192. :#4 \E36m
  193. :#4 Usage: %If.btn\E35m[GroupName]\E36m%\E31m[Index] \E90m(Command)\E0m
  194. :#4
  195. :#4  -\E33m Compares clicked button \E0m[GroupName][Index]\E33m against \E0m[Groupname]\E31m[arg]\E0m
  196. :#4
  197.  
  198. :# return button click coords in c{pos} variable n Y;X format
  199.  Set Get.Click=For %%n in (1 2)Do if %%n==2 (%\n%
  200.   Set "Group="%\n%
  201.   For %%G in (!GroupName!)Do (%\n: Update display of toggle state =%
  202.    For /l %%i in (1 1 !Btns[%%G][i]!)Do (%\n%
  203.     If not "!Btn[%%G][%%i]{state}!"=="true" (%\n%
  204.      ^<nul set /P "=!Btn[%%G][%%i]!"%\n%
  205.     )Else If Defined Btn[%%G][%%i]{t} (%\n%
  206.      set "tmpstr=!Btn[%%G][%%i]:38=7;38!"%\n%
  207.      ^<nul set /P "=!tmpstr:48=7;48!"%\n%
  208.   )))%\n%
  209.   for /f "tokens=1,2" %%X in ('%BG.exe% mouse')Do (%\n: Wait for mouse input =%
  210.    Set /A "c{pos}=%%X+1"                         %\n: Adjust X axis for 1 index =%
  211.    Set "c{pos}=!c{Pos}!;%%Y"                     %!!%
  212.    For %%G in (!GroupName!)Do (                  %\n: iterate over list of supplied group names =%
  213.     Set "If.Btn[%%G]=If Not.Clicked =="          %\n: assign or clear default values for return variables =%
  214.     Set "Clicked[%%G]="%\n%
  215.     Set "ValidClick[%%G]="%\n%
  216.     Set "ValidClick[%%G]{t}="%\n%
  217.     For /F "Delims=" %%C in ("!c{Pos}!")Do (     %\n: expand Coordinate var for use in substring modification =%
  218.      For /l %%I in (1 1 !btns[%%G][I]!)Do (      %\n: test if [Y;X] Coord contained in btn Coord Var =%
  219.       If not "!btn[%%G][%%I][Coord]:[%%C]=!" == "!btn[%%G][%%I][Coord]!" (%\n%
  220.        %OnClick%                                 %\n: play click sound effect if available =%
  221.        Set "Group=%%G"                           %\n: assign groupname value the button clicked belongs to =%
  222.        Set "If.Btn[%%G]=If [%%G][%%I] == [%%G]"  %\n: define If.Btn[GroupName] macro =%
  223.        Set "ValidClick[%%G]=[%%G][%%I]"          %\n: assign [GroupName][Index] of clicked button =%
  224.        Set "Clicked[%%G]=!Btn[%%G][%%I][String]!"%\n: assign the text containd in the clicked button =%
  225.        If Defined Btn[%%G][%%I][items] (%\n%
  226.         Set Btn[%%G][%%I][items]="!Btn[%%G][%%I][items]:{EQ}==!"%\n%
  227.         Set "Btn[%%G][%%I][items]=!Btn[%%G][%%I][items]: =" "!"%\n%
  228.         Set "Tmp.Items=!Btn[%%G][%%I][items]!"%\n%
  229.         Set "Btn[%%G][%%I][items]="%\n%
  230.         For %%t in (!Tmp.Items!)Do (%\n%
  231.          Set "tmp.str=%%~t"%\n%
  232.          Set "tmp.str=!tmp.Str:_= !"%\n%
  233.          Set "!tmp.str!"%\n%
  234.          Echo(!tmp.str!^|findstr.exe /R "[0-9]" ^> nul ^|^| Set "Btn[%%G][%%I][items]=!Btn[%%G][%%I][items]! "!tmp.str!""%\n%
  235.         )%\n%
  236.        )%\n%
  237.        If Defined Btn[%%G][%%I]{t} (             %\n: toggle state handling. =%
  238.         Set "ValidClick[%%G]{t}=[%%G][%%I]"      %\n: flag toggle state change for toggle.If.Not macro =%
  239.         If "!Btn[%%G][%%I]{state}!"=="true" (    %\n: update console display of toggle state by inverting colors =%
  240.         If not defined Btn[%%G][%%I]{m} (%\n%
  241.          ^<nul set /P "=!Btn[%%G][%%I]!"%\n%
  242.           Set "Btn[%%G][%%I]{state}=false"%\n%
  243.          )%\n%
  244.         )Else (%\n%
  245.          set "tmpstr=!Btn[%%G][%%I]:38=7;38!"%\n%
  246.          ^<nul set /P "=!tmpstr:48=7;48!"%\n%
  247.          Set "Btn[%%G][%%I]{state}=true"%\n%
  248.   )))))))%\n%
  249.  )Else Set GroupName=
  250.  
  251.  Set "Toggle.If.not?=5"
  252. :#5 \E36m
  253. :#5 Usage: %Toggle.If.Not% \E0m{^<\E31m[Groupname][Index]\E0m^> ^| ^<\E31m[Groupname][Index]\E0m^> ^<\E31m[OtherGroupname][Index]\E0m^>}
  254. :#5 \E33m
  255. :#5 Macro Actions: \E0m
  256. :#5 - Defines {state} false for all toggle buttons in GroupName except [Groupname][Index]
  257. :#5 - Updates Display Color of all buttons; Inverting each button with {state}=true
  258. :#5
  259. :#5 * Multiple [GroupName][Index]'s \E31m with unique GroupNames \E0m may be supplied
  260. :#5 \E33m
  261. :#5 Example usage:\E36m
  262. :#5 %Toggle.If.Not% !ValidClick[GroupName]!
  263. :#5 \E0m
  264.  Set Toggle.If.not=For %%n in (1 2)Do if %%n==2 (%\n%
  265.   For /f "tokens=1,2 Delims=[]" %%G in ("!GroupName: =!")Do (%\n: Remove spaces from arg assignment =%
  266.    If defined ValidClick[%%G]{t} (               %\n: If state change flagged true in Get.Click macro =%
  267.     For /l %%i in (1 1 !btns[%%G][i]!)Do (       %\n: test each button in groupname =%
  268.      If not "%%i"=="%%H" (                       %\n: If not button EQU clciked button =%
  269.       Set "btn[%%G][%%i]{state}=false"           %\n: Force btn[%%G][%%i]{state} false =%
  270.       ^<nul Set /P "=!btn[%%G][%%i]!"            %\n: Display button in standard unselected color =%
  271.   ))))%\n%
  272.  )Else Set GroupName=
  273.  
  274.  Set "Clean.Exit?=7"
  275. :#7
  276. :#7 Clean.Exit \E33m
  277. :#7  Restores codepage and Quickedit registry state
  278. :#7  Clears the title and screen ; ends the local environment
  279. :#7  executes Goto :Eof
  280. :#7 \E0m
  281.  Set Clean.Exit=(%\n%
  282.   cls %\n%
  283.   (%Reg.Restore%) ^> nul %\n%
  284.   (Title ) %\n%
  285.   ^<nul set /p "=%\E%[?25h" %\n%
  286.   CHCP %active.cp% ^> nul %\n%
  287.   Endlocal %\n%
  288.   Goto :Eof %\n%
  289.  )
  290.  
  291.  Set "Make.Btn?=9"
  292. :#9  \E33m
  293. :#9 Make.Btn Macro Usage: \E36m
  294. :#9 %Make.Btn%\E0m ^<\E31mGroupName\E0m^> ^<\E31m/S "Btn text"\E0m^> [\E32m/Y Coord\E0m] [\E32m/X Coord\E0m] [\E32m/FG R G B\E0m]
  295. :#9            [\E32m/BG R G B\E0m] [\E32m/BO \E0m{\E33mR G B\E0m^|\E33mR G B + R G B\E0m^|\E33mValue\E0m}] [\E32m/T\E0m] [\E32m/N\E0m]
  296. :#9            [^<\E31m/TM\E0m^> [\E32m/D\E0m]^|[\E32m/CD Variable\E0m]]
  297. :#9  \E37m
  298. :#9  - Arg 1 must be Groupname. Switch order is NOT mandatory.
  299. :#9  \E36m
  300. :#9   /N \E37mReset button count for GroupName (Arg 1) to 0. use when creating buttons in a :label that is returned to. \E36m
  301. :#9   /T \E37mDefine button as toggleable. Button state: 'Btn[Groupname][i]{state}' variable
  302. :#9      alternates true or false when clicked; and clicked buttons Color is inverted on match. \E36m
  303. :#9   /TM \E0m'Toggle Mandatory' as above; however mandatory true state for last selected button \E36m
  304. :#9      /D  \E0m'default selection' ; Flags toggle {state} true on definition. \E31m * Requires \E36m/TM
  305. :#9      /CD \E0m'Conditional default selection' ; If /CD Variable contains /S string
  306. :#9           Flags toggle {state} true on definition. \E31m * Requires \E36m/TM
  307. :#9
  308. :#9 Note: \E36m/BO \E37m{'Button box'} may supply a pair of R G B values for FG and BG by concatenating values with '+'
  309. :#9   IE: '\E36m/BO \E38;2;255;0;0m\E48;2;0;0;100m38 2 255 0 0 + 48 2 0 0 100\E0m'
  310. :#9   R G B sequences are groups of three integers between 0 and 255. Each R G B value adjusts the intensity of
  311. :#9  that color. Valid values for Virtual terminal sequences can be referenced at:
  312. :#9  \E32m https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#text-formatting
  313. :#9  \E33m
  314. :#9 Default Y and X Coordinates is used are /X value is ommited \E37m
  315. :#9 - Button defaults to next X spacing if /Y position included ; Else X = 2
  316. :#9 - Button defaults to next Y spacing if /Y ommited ;
  317. :#9   - defaults to previous /X spacing if /X also ommited
  318. :#9
  319. :#9 \E38;2;81;81;81mExpansion time is approxiamtely 1/33rd of a second when all switches used.
  320. :#9 \E0m
  321.  
  322.  Set Make.Btn[Switches]="S" "Y" "X" "FG" "BG" "BO" "T" "TM" "D" "N" "CD" "Def"
  323.  
  324.  Set Make.Btn=For %%n in (1 2)Do if %%n==2 (                              %\n: CAPTURE ARG STRING =%
  325.   Set "Make.Btn[Syntax]=%\E%[33m!Make.Btn[args]!"%\n%
  326.   For /F "Tokens=1,2 Delims==" %%G in ('Set "Make.Btn_" 2^^^> nul')Do Set "%%~G=" %\n: RESETS ALL MACRO INTERNAL VARS =%
  327.   If not "!Make.Btn[args]:* /=!" == "!Make.Btn[args]!" (                              %\n: BUILD Make.Btn.Args[!Make.Btn_arg[i]!] ARRAY IF ARGS PRESENT =%
  328.    Set "Make.Btn_leading.args=!Make.Btn[args]:*/=!"                                   %\n: SPLIT ARGS FROM SWITCHES =%
  329.    For /F "Delims=" %%G in ("!Make.Btn_leading.args!")Do Set "Make.Btn_leading.args=!Make.Btn[args]:/%%G=!"%\n%
  330.    Set ^"Make.Btn[args]=!Make.Btn[args]:"=!"                                          %\n: REMOVE DOUBLEQUOTES FROM REMAINING ARGSTRING - SWITCHES =%
  331.    Set "Make.Btn_arg[i]=0"                                                            %\n: ZERO INDEX FOR ARGS ARRAY =%
  332.    For %%G in (!Make.Btn_leading.args!)Do (                                           %\n: BUILD ARGS ARRAY =%
  333.     Set /A "Make.Btn_arg[i]+=1"%\n%
  334.     Set "Make.Btn_arg[!Make.Btn_arg[i]!]=%%~G"%\n%
  335.     For %%i in ("!Make.Btn_arg[i]!")Do (                                              %\n: SUBSTITUTE THE FOLLOWING POISON CHARACTERS =%
  336.      Set "Make.Btn_arg[%%~i]=!Make.Btn_arg[%%~i]:{SC}=;!"%\n%
  337.      Set "Make.Btn_arg[%%~i]=!Make.Btn_arg[%%~i]:{QM}=?!"%\n%
  338.      Set "Make.Btn_arg[%%~i]=!Make.Btn_arg[%%~i]:{FS}=/!"%\n%
  339.      Set "Make.Btn_arg[%%~i]=!Make.Btn_arg[%%~i]:{AS}=*!"%\n%
  340.      Set "Make.Btn_arg[%%~i]=!Make.Btn_arg[%%~i]:{EQ}==!"%\n%
  341.      Set ^"Make.Btn_arg[%%~i]=!Make.Btn_arg[%%~i]:{DQ}="!"%\n%
  342.   ))) Else (                                                                           %\n: IF NO ARGS REMOVE DOUBLEQUOTES FROM ARGSTRING - SWITCHES =%
  343.    Set ^"Make.Btn[args]=!Make.Btn[args]:"=!"%\n%
  344.    Set "Make.Btn_Arg[1]=!Make.Btn[args]!"%\n%
  345.    Set "Make.Btn_Arg[i]=1"%\n%
  346.   )%\n%
  347.   For /L %%L in (2 1 4)Do If "!Make.Btn_LastSwitch!" == "" (%\n%
  348.    If "!Make.Btn[args]:~-%%L,1!" == " " Set "Make.Btn_LastSwitch=_"%\n%
  349.    If "!Make.Btn[args]:~-%%L,1!" == "/" (                                              %\n: FLAG LAST SWITCH TRUE IF NO SUBARGS ; FOR SWITCHES UP TO 3 CHARCTERS LONG =%
  350.     For /F "Delims=" %%v in ('Set /A "%%L-1"')Do Set "Make.Btn_Switch[!Make.Btn[args]:~-%%v!]=true"%\n%
  351.     If not "!Make.Btn[args]:/?=!." == "!Make.Btn[args]!." Set "Make.Btn_Switch[help]=true"%\n%
  352.     Set "Make.Btn[args]=!Make.Btn[args]:~0,-%%L!"%\n%
  353.     Set "Make.Btn_LastSwitch=_"%\n%
  354.    )%\n%
  355.   )%\n%
  356.   For %%G in ( %Make.Btn[Switches]% )Do If not "!Make.Btn[args]:/%%~G =!" == "!Make.Btn[args]!" (%\n: SPLIT AND ASSIGN SWITCH VALUES =%
  357.    Set "Make.Btn_Switch[%%~G]=!Make.Btn[args]:*/%%~G =!"%\n%
  358.    If not "!Make.Btn_Switch[%%~G]:*/=!" == "!Make.Btn_Switch[%%~G]!" (%\n%
  359.     Set "Make.Btn_Trail[%%~G]=!Make.Btn_Switch[%%~G]:*/=!"%\n%
  360.     For %%v in ("!Make.Btn_Trail[%%~G]!")Do (%\n%
  361.      Set "Make.Btn_Switch[%%~G]=!Make.Btn_Switch[%%~G]: /%%~v=!"%\n%
  362.      Set "Make.Btn_Switch[%%~G]=!Make.Btn_Switch[%%~G]:/%%~v=!"%\n%
  363.     )%\n%
  364.     Set "Make.Btn_Trail[%%~G]="%\n%
  365.     If "!Make.Btn_Switch[%%~G]:~-1!" == " " Set "Make.Btn_Switch[%%~G]=!Make.Btn_Switch[%%~G]:~0,-1!"%\n%
  366.     If "!Make.Btn_Switch[%%~G]!" == "" Set "Make.Btn_Switch[%%~G]=true"%\n%
  367.     If not "!Make.Btn_Switch[%%~G]!" == "" If not "!Make.Btn_Switch[%%~G]!" == "true" (%\n%
  368.      Set "Make.Btn_Switch[%%~G]=!Make.Btn_Switch[%%~G]:{SC}=;!"%\n%
  369.      Set "Make.Btn_Switch[%%~G]=!Make.Btn_Switch[%%~G]:{QM}=?!"%\n%
  370.      Set "Make.Btn_Switch[%%~G]=!Make.Btn_Switch[%%~G]:{FS}=/!"%\n%
  371.      Set "Make.Btn_Switch[%%~G]=!Make.Btn_Switch[%%~G]:{AS}=*!"%\n%
  372.      Set "Make.Btn_Switch[%%~G]=!Make.Btn_Switch[%%~G]:{EQ}==!"%\n%
  373.      Set ^"Make.Btn_Switch[%%~G]=!Make.Btn_Switch[%%~G]:{DQ}="!"%\n%
  374.    ))%\n%
  375.    If "!Make.Btn_Switch[%%~G]:~-1!" == " " Set "Make.Btn_Switch[%%~G]=!Make.Btn_Switch[%%~G]:~0,-1!"%\n%
  376.   )%\n: ACTION SWITCH ASSESSMENT BELOW. USE CONDITIONAL TESTING OF VALID SWITCHES OR ARGS ARRAY TO ENACT COMMANDS FOR YOUR MACRO FUNCTION =%
  377.   If not defined Make.Btn_Arg[1] (%\n:           Enforce button Groupname Definiton via Arg 1 =%
  378.    Call "%Buttons_File%" Make.Btn%\n%
  379.    ^<nul Set /P "=%\E%[E ^! %\E%[31mMissing Arg 1 GroupName in:%\E%[36m %%Make.btn%%%\E%[31m GroupName!Make.Btn[Syntax]:  = !%\E%[0m%\E%[E"%\n%
  380.    Pause %\n%
  381.    cls %\n%
  382.    (%Reg.Restore%) ^> nul %\n%
  383.    (Title ) %\n%
  384.    ^<nul set /p "=%\E%[?25h" %\n%
  385.    CHCP %active.cp% ^> nul %\n%
  386.    Endlocal %\n%
  387.    Goto :Eof %\n%
  388.   )%\n%
  389.   If not defined Make.Btn_Switch[S] (%\n:        Enforce button text definition via /S switch parameter value =%
  390.    Call "%Buttons_File%" Make.Btn%\n%
  391.    ^<nul Set /P "=%\E%[E ^! %\E%[31mMissing Switch /S in:%\E%[36m %%Make.btn%%!Make.Btn[Syntax]:  = ! %\E%[31m/S Button text%\E%[0m%\E%[E"%\n%
  392.    Pause %\n%
  393.    cls %\n%
  394.    (%Reg.Restore%) ^> nul %\n%
  395.    (Title ) %\n%
  396.    ^<nul set /p "=%\E%[?25h" %\n%
  397.    CHCP %active.cp% ^> nul %\n%
  398.    Endlocal %\n%
  399.    Goto :Eof %\n%
  400.   )%\n%
  401.   For %%e in ("!Make.Btn_Arg[1]!")Do (%!!%
  402.    If defined Make.Btn_Switch[N] (%\n:           Reset button group index and X Y positions if /N switch used =%
  403.     Set "Btn[%%~e][X]="%\n%
  404.     Set "Btn[%%~e][Y]="%\n%
  405.     Set "Btns[%%~e][i]=0"%\n%
  406.    )%\n%
  407.    If defined Make.Btn_Switch[Y] (%\n:           Determine button Y Position according to /Y switch usage or default increment =%
  408.     Set /A "Btn[%%~e][Y]=!Make.Btn_Switch[Y]!"%\n%
  409.    )Else (%\n%
  410.     Set /A "Btn[%%~e][Y]+=3+0"%\n%
  411.    )%\n%
  412.    If defined Make.Btn_Switch[X] (%\n:           Determine button X Position according to /X usage or default increment =%
  413.     Set /A "Btn[%%~e][X]=!Make.Btn_Switch[X]!"%\n%
  414.    )Else (%\n%
  415.     If defined Make.Btn_Switch[Y] (%\n%
  416.      Set /A "Btn[%%~e][X]=!L[%%~e][X]!+0"%\n%
  417.     )Else (%\n%
  418.      If not defined Btn[%%~e][X] Set "Btn[%%~e][X]=2"%\n%
  419.    ))%\n%
  420.    If !Btn[%%~e][X]! LSS 2 ( Set "Btn[%%~e][X]=2" )%\n%
  421.    Set /a "Btns[%%~e][i]+=1+0"%\n:               Increment button Index =%
  422.    For %%f in ("!Btns[%%~e][i]!")Do (%\n:        Expand button index =%
  423.     Set "Btn[%%~e][!Btns[%%~e][i]!][p]=!Btn[%%~e][Y]!;!Btn[%%~e][X]!"%\n%
  424.     Set "Btn[%%~e][!Btns[%%~e][i]!][string]=!Make.Btn_Switch[S]!"%\n%
  425.     If /I "!Make.Btn_Switch[T]!"=="true" (%\n:   Define toggle vars according to /T or /TM switche usage =%
  426.      Set "Btn[%%~e][%%~f]{t}=true"%\n%
  427.      Set "Btn[%%~e][%%~f]{state}=false"%\n%
  428.     ) Else If /I "!Make.Btn_Switch[TM]!"=="true" (%\n%
  429.      Set "Btn[%%~e][%%~f]{t}=true"%\n%
  430.      Set "Btn[%%~e][%%~f]{state}=false"%\n%
  431.      Set "Btn[%%~e][%%~f]{m}=true"%\n%
  432.     ) Else (%\n:                                 If /Tor /TM toggle switches not used ; ensure toggle vars undefined =%
  433.      Set "Btn[%%~e][%%~f]{t}="%\n%
  434.      Set "Btn[%%~e][%%~f]{state}="%\n%
  435.      Set "Btn[%%~e][%%~f]{m}="%\n%
  436.     )%\n%
  437.     If defined Make.Btn_Switch[D] (%\n:          Define button as toggle state true =%
  438.      If defined Btn[%%~e][%%~f]{t} (%\n:         if button is defined as toggleable =%
  439.       Set "Btn[%%~e][%%~f]{state}=true"%\n%
  440.     ))%\n%
  441.     If defined Make.Btn_Switch[CD] (%\n:         Test supplied variable for contents of button text =%
  442.      If defined Btn[%%~e][%%~f]{t} (%\n:         if button is defined as toggleable =%
  443.       For %%1 in ("!Make.Btn_Switch[CD]!")Do (%\n%
  444.        For %%2 in ("!Make.Btn_Switch[S]!")Do (%\n%
  445.         If not "!%%~1:%%~2=!"=="!%%~1!" (%\n:     Define button as toggle state true on match =%
  446.          Set "Btn[%%~e][%%~f]{state}=true"%\n%
  447.     )))))%\n%
  448.     If defined Make.Btn_Switch[FG] (%\n:         Assign Foreground color =%
  449.      Set "Btn[%%~e][FG]=%\E%[38;2;!Make.Btn_Switch[FG]: =;!m"%\n%
  450.     )Else (%\n%
  451.      set "Btn[%%~e][FG]=%\E%[38;2;0;0;0m"%\n%
  452.     )%\n%
  453.     If defined Make.Btn_Switch[BG] (%\n%
  454.      Set "Btn[%%~e][BG]=%\E%[48;2;!Make.Btn_Switch[BG]: =;!m"%\n%
  455.     )Else (%\n%
  456.      Set "Btn[%%~e][BG]=%\E%[48;2;230;230;200m"%\n%
  457.     )%\n%
  458.     If defined Make.Btn_Switch[BO] (%\n:         Process value of /BO border color =%
  459.      Set "Btn[%%~e][Col]=!Btn[%%~e][Col]: + =m%\E%[!"%\n%
  460.      Set "Btn[%%~e][Col]=%\E%[!Make.Btn_Switch[BO]: =;!m"%\n%
  461.      Set "Btn[%%~e][Col]=!Btn[%%~e][Col]:+=m%\E%[!"%\n%
  462.      Set "Btn[%%~e][Col]=!Btn[%%~e][Col]:[;=[!"%\n%
  463.      Set "Btn[%%~e][Col]=!Btn[%%~e][Col]:;;=;!"%\n%
  464.      Set "Btn[%%~e][Col]=!Btn[%%~e][Col]:;m=m!"%\n%
  465.     ) Else (%\n:                                 Enact default border color if no value supplied =%
  466.      set "Btn[%%~e][Col]=%\E%[90m"%\n%
  467.     )%\n%
  468.     Set "len="%\n:                               Get string length of button text =%
  469.     Set "tmp.s=#!Make.Btn_Switch[S]!"%\n%
  470.     For %%P in (8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1) do (%\n%
  471.      If "!tmp.s:~%%P,1!" NEQ "" (%\n%
  472.       Set /a "len+=%%P"%\n%
  473.       Set "tmp.s=!tmp.s:~%%P!"%\n%
  474.     ))%\n%
  475.     Set /A "Btn{Xmin}=!Btn[%%~e][X]!+1", "Btn{Xmax}=!Btn[%%~e][X]!+len", "l[%%~e][X]=!Btn[%%~e][X]!+len+2"%\n%
  476.     Set "Btn[%%~e][%%~f][S]="%\n%
  477.     Set "Btn[%%~e][%%~f][Bar]="%\n%
  478.     Set "Btn[%%~e][%%~f][Coord]="%\n%
  479.     For /l %%i in (!Btn{Xmin}! 1 !Btn{Xmax}!)Do (%\n%
  480.      Set /A "Btn[%%~e][%%~f][Len]=%%i-3", "Xoffset=%%i-1"%\n%
  481.      Set "Btn[%%~e][%%~f][Coord]=!Btn[%%~e][%%~f][Coord]![!Btn[%%~e][Y]!;!Xoffset!]"%\n%
  482.      Set "Btn[%%~e][%%~f][Bar]=!Btn[%%~e][%%~f][Bar]!═"%\n%
  483.      Set "Btn[%%~e][%%~f][S]=!Btn[%%~e][%%~f][S]! "%\n%
  484.     )%\n%
  485.     Set /A "Btn[%%e][Cpos]=!Btn[%%~e][Y]!+2"%\n%
  486.     If defined Make.Btn_Switch[Def] Set "btn[%%~e][%%~f][items]=!Make.Btn_Switch[Def]!"%\n%
  487.     Set "Btn[%%~e][%%~f]=%\E%[!Btn[%%~e][Y]!;!Btn[%%~e][X]!H!Btn[%%~e][col]!%\E%7║%\E%8%\E%[1A╔!Btn[%%~e][%%~f][Bar]!╗%\E%8%\E%[1B╚!Btn[%%~e][%%~f][Bar]!╝%\E%8%\E%[1C%\E%[0m!Btn[%%~e][FG]!!Btn[%%~e][BG]!!Make.Btn_Switch[S]!%\E%[0m!Btn[%%~e][col]!%\E%[0m%\E%[2E%\E%7"%\n%
  488.     Set "Btn[%%~e][%%~f][t]=%\E%[0m!Btn[%%~e][FG]!!Btn[%%~e][BG]!!Make.Btn_Switch[S]!%\E%[0m!Btn[%%~e][col]!%\E%[0m%\E%[K"%\n%
  489.   ))%\n%
  490.  %= ESCAPE AMPERSANDS AND REDIRECTION CHARACTERS.  =%) Else Set Make.Btn[args]=
  491.  
  492.  <nul set /p "=%\E%[?25l"
  493.  
  494.  If not "%~1" == "" (
  495.   If /I not "%~1" == "def" (
  496.    Goto :button_help
  497.   )Else Goto :Eof
  498.  )
  499.  
  500. ==========
  501.  Goto :Main
  502. ==========
  503.  
  504. :# HELP INFO
  505.  
  506. ============
  507. :button_help </?|Function_Name|Macro_Name>
  508.  Set "_D="
  509.  If not "%~1"=="" (
  510.   Setlocal EnableDelayedExpansion
  511.   Set "_D=!%~1?!"
  512.  )
  513.  Endlocal & Set "_D=%_D%"
  514.  
  515.  If not "%~1"=="" (
  516.   If Defined _D (
  517.    Mode 120,45
  518.    (
  519.     Echo(%\E%[36mSyntax: %\E%[0m^<%\E%[31mMandatory%\E%[0m^> [%\E%[32mOptional%\E%[0m] {%\E%[33mMutually^%\E%[0m^|%\E%[33mExclusive%\E%[0m}
  520.     For /f "Tokens=2* Delims=%_D%" %%T in ('Findstr /BLIC:":#%_D%" "%Buttons_File%"')Do (
  521.      Set "line=%%T"
  522.      Call Set "line=%%line:buttons.bat="%~f0"%%"
  523.      Call Echo(%%Line:\E=%\E%[%%
  524.     )
  525.    )> "%TEMP%\%~n0_Help"
  526.    Type "%TEMP%\%~n0_Help" > Con
  527.    Exit /B -1
  528.   )Else (
  529.    Findstr /BLIC:":%~1 " "%~f0" >nul && (
  530.     Echo(%\E%[36mSyntax: %\E%[0m^<%\E%[31mMandatory%\E%[0m^> [%\E%[32mOptional%\E%[0m] {%\E%[33mMutually^%\E%[0m^|%\E%[33mExclusive%\E%[0m}
  531.     <nul Set /P "=%\E%[K %~1 Usage:%\E%[2E Call "
  532.     Findstr /BLIC:":%~1 " "%Buttons_File%"
  533.     Exit /B -1
  534.    ) || (
  535.     Echo(Help query '%~1' does not match any existing Macro or Function.
  536.     Echo(Check your Spelling and try again.
  537.     Exit /B -1
  538.    )
  539.   )
  540.  )Else (
  541.   Echo(%\E%[33mDelayed Expansion %\E%[31mmust not %\E%[33mbe enabled prior to running %\E%[36m%~nx0%\E%[0m
  542.   Exit /B -1
  543.  )
  544. Goto :eof
  545.  
  546. ============
  547. :# Functions
  548. ======
  549. :YesNo      ["Option 1"] ["Prompt 2"] ["Spoken Prompt"]
  550. :# Default:     Yes           No
  551.  
  552.  %Buffer:@=Alt%
  553.  If not "%~3"=="" start /b "" PowerShell -Nop -ep Bypass -C "Add-Type –AssemblyName System.Speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).Speak('%~3');
  554.  
  555.  If "%~1"=="" %Make.Btn% YN /N /S "Yes" /Y 3 /X 3 /FG 0 0 0 /BG 255 0 0 /BO 38 2 60 0 0 + 48 2 20 20 40
  556.  If not "%~1"=="" %Make.Btn% YN /N /S "%~1" /Y 3 /X 3 /FG 0 0 0 /BG 255 0 0 /BO 38 2 60 0 0 + 48 2 20 20 40
  557.  If "%~2"=="" %Make.Btn% YN /S "No" /Y 3 /FG 0 0 0 /BG 0 255 0 /BO 38 2 0 60 0 + 48 2 20 20 40
  558.  If not "%~2"=="" %Make.Btn% YN /S "%~2" /Y 3 /FG 0 0 0 /BG 0 255 0 /BO 38 2 0 60 0 + 48 2 20 20 40
  559.  
  560. :YesNoWait
  561.  %Get.Click% YN
  562.  If defined ValidClick[YN] (
  563.   %Buffer:@=Main%
  564.  )Else Goto :YesNoWait
  565.  %If.Btn[YN]%[1] Exit /B 1
  566.  %If.Btn[YN]%[2] Exit /B 2
  567.  
  568. =========
  569. :ColorMod <Prefixvar.Extension> [-l]
  570. :# Prefix var doubles as the name of the Alternate data stream color variables as saved to / loaded from
  571. :# values returned:
  572. :# prefixvar.ext.FG.Color prefixvar.ext.BG.Color
  573. :# prefixvar.ext_FG_Red prefix.var_FG_Blue prefix.var_FG_Green
  574. :# prefixvar.ext_BG_Red prefix.var_BG_Blue prefix.var_BG_Green
  575. :#
  576.  %Buffer:@=Alt%
  577.  If Not "%~1" == "" Set "Type=%~1"
  578.  
  579. :# load any existing saved values.
  580.  (For /F "UsebackQ Delims=" %%G in ("%~f0:%Type%")Do %%G) 2> nul
  581.  If /I "%~2"=="-l" Goto :Eof
  582.  
  583.  If "!%Type%_FG_Red!"=="" If "!%Type%_BG_Red!"=="" (
  584.   For %%Z in ("FG" "BG")Do (
  585.    If not defined %Type%.%%~Z.Color (
  586.     Cls & Echo(Defalut value for %Type%.%%~Z.Color must be defined in format rrr;ggg;bbb
  587.     Pause
  588.     Exit
  589.    )
  590.    For /F "Tokens=1,2,3 Delims=;" %%1 in ("!%Type%.%%~Z.Color!")Do (
  591.     Set "%Type%_%%~Z_Red=%%1"
  592.     Set "%Type%_%%~Z_Green=%%2"
  593.     Set "%Type%_%%~Z_Blue=%%3"
  594.  )))
  595.  
  596.  If "!%Type%_Zone!" == "" Set "%Type%_Zone=BG"
  597.  If "!%Type%_Spectrum!" == "" Set "%Type%_Spectrum=%Type%_!%Type%_Zone!_Blue"
  598.  
  599. :# definition of /d switch assigns default toggle state to last stored value; or default value if no value stored.
  600.  
  601. %= [CMcolor][1] =%       %Make.btn% CMcolor /s Red /y 3 /x 3 /fg 255 0 0 /bg 0 0 0 /bo 48 2 0 0 0 + 38 2 255 255 255 /tm /cd %Type%_Spectrum /N
  602. %= [CMcolor][2] =%       %Make.btn% CMcolor /s Green /y 3 /fg 0 255 0 /bg 0 0 0 /bo 48 2 0 0 0 + 38 2 255 255 255 /tm /cd %Type%_Spectrum
  603. %= [CMcolor][3] =%       %Make.btn% CMcolor /s Blue /y 3 /fg 0 0 255 /bg 0 0 0 /bo 48 2 0 0 0 + 38 2 255 255 255 /tm /cd %Type%_Spectrum
  604.  
  605. %= [CMzone][1] =%        %Make.btn% CMzone /s FG /y 6 /x 3 /tm /bo 48 2 0 0 0 + 38 2 255 255 255 /cd %Type%_Zone /N
  606. %= [CMzone][2] =%        %Make.btn% CMzone /s BG /y 6 /x 7 /bo 48 2 0 0 0 + 38 2 255 255 255 /tm /cd %Type%_Zone
  607.  
  608. %= [CMcontrol][2] =%         %Make.btn% CMcontrol /s " ▲   " /y 6 /x 11 /fg 255 255 255 /bg 50 20 50 /bo 33 /N
  609. %= [CMcontrol][3] =%         %Make.btn% CMcontrol /s " ▼   " /y 6 /fg 255 255 255 /bg 50 20 50 /bo 33
  610. %= [CMcontrol][1] =%         %Make.btn% CMcontrol /s "     Accept       " /bg 180 160 0 /bo 32 /y 9 /x 3
  611.  
  612. :ColorModLoop
  613.  Set "%Type%.FG.Color=!%Type%_FG_Red!;!%Type%_FG_Green!;!%Type%_FG_Blue!"
  614.  Set "%Type%.BG.Color=!%Type%_BG_Red!;!%Type%_BG_Green!;!%Type%_BG_Blue!"
  615.  
  616.  <nul Set /P "=%\E%[13d%\E%[G%\E%[38;2;255;255;255m%\E%[48;2;!%Type%.BG.Color!m%Type% FG: %\E%[38;2;!%Type%.FG.Color!m!%Type%_FG_Red!;!%Type%_FG_Green!;!%Type%_FG_Blue! %\E%[38;2;255;255;255mBG:%\E%[38;2;!%Type%.FG.Color!m!%Type%_BG_Red!;!%Type%_BG_Green!;!%Type%_BG_Blue!%\E%[0m%\E%[K"
  617.  
  618.  %Get.Click% CMzone CMcolor CMcontrol
  619.  If not defined Group Goto :ColorModLoop
  620.  
  621.  If not "%Group%" == "CMcontrol" %Toggle.If.Not% !ValidClick[%Group%]!
  622.  
  623.  If "%Group%"=="CMzone" (
  624.   Set "%Type%_Zone=!Clicked[%Group%]!"
  625.   If "!Clicked[%Group%]!"=="FG" (
  626.    Set "%Type%_Spectrum=!%Type%_Spectrum:BG=FG!"
  627.   )Else Set "%Type%_Spectrum=!%Type%_Spectrum:FG=BG!"
  628.  )
  629.  
  630.  If "%Group%"=="CMcolor" Set "%Type%_Spectrum=%Type%_!%Type%_Zone!_!Clicked[%Group%]!"
  631.  
  632.  For /f "Delims=" %%G in ("!%Type%_Spectrum!") Do (
  633.   %If.Btn[CMcontrol]%[1] (
  634.    If not !%%G! EQU 255 ( Set /A "%%G+=5" )Else Start /b "" %BG.exe% play "%WINDIR%\Media\Windows Error.wav"
  635.   )
  636.   %If.Btn[CMcontrol]%[2] (
  637.    If not !%%G! EQU 0 ( Set /A "%%G-=5" )Else Start /b "" %BG.exe% play "%WINDIR%\Media\Windows Error.wav"
  638.  ))
  639.  
  640. :# Update stored Color values in alternate data stream
  641.  (For /f "Delims=" %%G in ('Set %Type%')Do Echo(Set "%%G") >"%~f0:%Type%"
  642.  
  643.  %If.Btn[CMcontrol]%[3] (
  644.   %Buffer:@=Main%
  645.   Goto :Eof
  646.  )
  647.  
  648. Goto :ColorModLoop
  649.  
  650.  
  651. ==========
  652. :ShowState <GroupName>
  653.  %Buffer:@=Alt%
  654.  For %%G in (%*)Do (
  655.   For /l %%i in (1 1 !Btns[%%~G][i]!)Do If defined Btn[%%~G][%%i]{t} Echo(Btn[%%~G][%%i]{state}=!Btn[%%~G][%%i]{state}!
  656.  )
  657.  Timeout /T 15
  658.  %Buffer:@=Main%
  659.  Cls
  660. Goto :eof
  661.  
  662. ==========================
  663. :# REQUIRED UTILITY BG.exe
  664. :# - Allows mouse click to be accepted [ blocking input ]
  665. :# - Allows .Wav files to be played
  666. :# - Refer to the documentation at the github repository for all usage options. [ link below ]
  667.  
  668. /* BG.exe V 3.9
  669.   https://github.com/carlos-montiers/consolesoft-mirror/blob/master/bg/README.md
  670.   Copyright (C) 2010-2018 Carlos Montiers Aguilera
  671.  
  672.   This software is provided 'as-is', without any express or implied
  673.   warranty.  In no event will the authors be held liable for any damages
  674.   arising from the use of this software.
  675.  
  676.   Permission is granted to anyone to use this software for any purpose,
  677.   including commercial applications, and to alter it and redistribute it
  678.   freely, subject to the following restrictions:
  679.  
  680.   1. The origin of this software must not be misrepresented; you must not
  681.      claim that you wrote the original software. If you use this software
  682.      in a product, an acknowledgment in the product documentation would be
  683.      appreciated but is not required.
  684.   2. Altered source versions must be plainly marked as such, and must not be
  685.      misrepresented as being the original software.
  686.   3. This notice may not be removed or altered from any source distribution.
  687.  
  688.   Carlos Montiers Aguilera
  689.   cmontiers@gmail.com
  690.  */
  691.  
  692. -----BEGIN CERTIFICATE-----
  693. TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  694. AAAAAAAAAAAAAAAAgAAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5v
  695. dCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAABQRQAATAEEAG3tp1sAAAAA
  696. AAAAAOAADwMLAQIZABoAAAAIAAAAAgAAcCcAAAAQAAAAAMD/AABAAAAQAAAAAgAA
  697. BAAAAAEAAAAEAAAAAAAAAABgAAAABAAAu00AAAMAAAAAACAAABAAAAAAEAAAEAAA
  698. AAAAABAAAAAAAAAAAAAAAABQAABMBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  699. AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  700. AAAAAAAAAAD4UAAAlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC50ZXh0AAAA
  701. IBkAAAAQAAAAGgAAAAQAAAAAAAAAAAAAAAAAACAAUGAucmRhdGEAALgBAAAAMAAA
  702. AAIAAAAeAAAAAAAAAAAAAAAAAABAAGBALmJzcwAAAACMAA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
  718. g/5/iXXkD7fGD4+RAQAAixVQUUAAiQQkg8cCMfaNSiCJTCQE6GcXAAChUFFAAIPA
  719. IIlEJASLRdSJBCToUBcAAA+3HzHJx0XQAAAAAGaF23WD6w2QkJCQkJCQkJCQkJCQ
  720. i0XQhcB0JIP+f4l13A+3xg+PygEAAIsVUFFAAIkEJIPCIIlUJAToBRcAAI1l9Fte
  721. X13zw422AAAAAI2/AAAAAItV0IXSdGmD/n+JdeAPt8YPj0oBAACLFVBRQACJBCSN
  722. SiCJTCQE6MUWAAAxyWaD+1wPlMEPhIYAAAChUFFAAIlNzDH2g8AgiUQkBItF1IkE
  723. JOiaFgAAx0XQAAAAAItNzOnA/v//jXQmAI28JwAAAABmg/tuD4R2AQAAD4awAAAA
  724. ZoP7cg+ERgEAAGaD+3QPhXwBAAChUFFAAMcEJAkAAACDwCCJRCQE6EQWAAAxyely
  725. /v//jbYAAAAAjbwnAAAAADH2x0XQAAAAAOlX/v//ZpCDRdABweYEZoP7OQ+GrwAA
  726. AIPLIA+3w4PoVwHGuQEAAADpL/7//412AI28JwAAAACNRdzHRCQIAQAAAIlEJASN
  727. ReSJBCT/FXxRQAAPt0Xcg+wM6Uj+//+J9o28JwAAAABmg/tiD4XWAAAAoVBRQADH
  728. BCQIAAAAg8AgiUQkBOieFQAAMcnpzP3//420JgAAAACNRdzHRCQIAQAAAIlEJASN
  729. ReCJBCT/FXxRQAAPt0Xcg+wM6Y/+//+J9o28JwAAAACLRdSD6DDpT////5CNdCYA
  730. jUXax0QkCAEAAACJRCQEjUXciQQk/xV8UUAAD7dF2oPsDOkP/v//ifaNvCcAAAAA
  731. oVBRQADHBCQNAAAAg8AgiUQkBOgIFQAAMcnpNv3//5ChUFFAAMcEJAoAAACDwCCJ
  732. RCQE6OgUAAAxyekW/f//kKFQUUAAg8AgiUQkBItF1IkEJOjJFAAAMcnp9/z//2aQ
  733. oUhAQACD+AJ+OlWJ5VdWU4PsHIsVREBAAIP4A4tyCHUvx0QkCBIAAgDHRCQEAAAA
  734. AIk0JP8VhFFAAIPsDI1l9FteX13zw412AI28JwAAAADHRCQICgAAAMdEJAQAAAAA
  735. i0IMiQQk6DUUAACFwH7Oiz2EUUAAjVj/kI20JgAAAACD6wHHRCQIEgACAMdEJAQA
  736. AAAAiTQk/9eD7AyD+/914OubjbQmAAAAAI28JwAAAABVuAQAAAC6BgAAALkGAAAA
  737. ieVXVlO+CAAAALsIAAAAvwgAAACB7LwAAABmiYVs////uBAAAABmiYV4////uAgA
  738. AACDPUhAQAADZomFev///7gFAAAAZomVbv///2aJhXz///+4DAAAAGaJjXD///9m
  739. iYV+////uAcAAABmiZ1y////ZolFgLgMAAAAZom1dP///2aJRYK4EAAAAGaJvXb/
  740. //9miUWOuAoAAAC6CAAAALkMAAAAuxAAAAC+DAAAAL8MAAAAZolFkLgSAAAAZolV
  741. hGaJTYZmiV2IZol1imaJfYxmiUWSdAmNZfRbXl9dw5ChREBAAMdEJAgKAAAAx0Qk
  742. BAAAAACLQAiJBCTo4BIAAIP4CYnDd9DHRCQYAAAAAMdEJBQAAAAAx0QkEAMAAADH
  743. RCQMAAAAAMdEJAgDAAAAx0QkBAAAAMDHBCQAMEAA/xX8UEAAg+wcicbHBCQQMEAA
  744. /xUcUUAAg+wEhcCJxw+ElgAAAMdEJAQqMEAAiQQk/xUYUUAAg+wIhcCJhWT///90
  745. bA+3hJ1s////jU2Ux0QkBEIwQADHRZRUAAAAiV2YiY1g////x0WgMAAAAMdFpJAB
  746. AABmiUWcD7eEnW7///9miUWejUWoiQQk6BsSAACLjWD////HRCQEAAAAAIk0JIuV
  747. ZP///4lMJAj/0oPsDIk8JP8VBFFAAIPsBIlcJASJNCToWxIAAIPsCIk0JP8V+FBA
  748. AIPsBOm+/v//jbQmAAAAAFWJ5VZTjXXwg+wwx0QkGAAAAADHRCQUAAAAAMdEJBAD
  749. AAAAx0QkDAAAAADHRCQIAwAAAMdEJAQAAADAxwQkADBAAP8V/FBAAIPsHInDiXQk
  750. BIkEJP8VCFFAAIPsCIM9SEBAAAN0OsdF9AEAAADHRfAZAAAAiXQkBIkcJP8VJFFA
  751. AIPsCIkcJP8V+FBAAIPsBI1l+FteXcOJ9o28JwAAAAChREBAAMdEJAgKAAAAx0Qk
  752. BAAAAACLQAiJBCToABEAAIP4GXQlfxmFwHQlg/gBdaTHRfQBAAAA65uNtCYAAAAA
  753. g/gydAWD+GR1iolF8OvhkMdF9AAAAADpeP///410JgCDPUhAQAADdAfDjbYAAAAA
  754. VYnlg+wYoURAQADHRCQICgAAAMdEJAQAAAAAi0AIiQQk6IoQAACFwH4MiQQk/xU4
  755. UUAAg+wEycOQjbQmAAAAAFWJ5YPsSI1F6IkEJP8VFFFAAA+3RfaD7ATHBCRUMEAA
  756. iUQkIA+3RfSJRCQcD7dF8olEJBgPt0XwiUQkFA+3Re6JRCQQD7dF6olEJAwPt0Xo
  757. iUQkCA+3ReyJRCQE6AcQAADJw422AAAAAI28JwAAAABVieVXVlONfcyNddSD7FzH
  758. RCQYAAAAAMdEJBQAAAAAx0QkEAMAAADHRCQMAAAAAMdEJAgDAAAAx0QkBAAAAMDH
  759. BCSGMEAA/xX8UEAAicONRdCD7ByJHCSJRCQE/xUMUUAAi0XQg+wIiRwkJC4MkIlE
  760. JAShMFFAAIlFxP/Qg+wIkIl8JAzHRCQIAQAAAIl0JASJHCT/FSBRQACD7BBmg33U
  761. AnXdg33cAXXXD7912g+/fdjHBCSUMEAAiXQkBIl8JAjB5hDoMA8AAItF0IkcJAH+
  762. iUQkBP9VxIPsCIkcJP8V+FBAAIPsBIk0JP8VAFFAAJBVieVTg+wEix1MUUAA/9OF
  763. wHQdPeAAAAB0FqNAQEAAg8QEW13DjXQmAI28JwAAAAD/0wUAAQAAo0BAQACDxARb
  764. XcONtCYAAAAAjbwnAAAAAFWJ5VOD7AT/FVRRQACFwHUfxwVAQEAAAAAAAIPEBFtd
  765. w+sNkJCQkJCQkJCQkJCQkIsdTFFAAP/ThcB0FD3gAAAAdA2jQEBAAIPEBFtdw2aQ
  766. /9MFAAEAAOvqjbQmAAAAAIM9SEBAAAR0B8ONtgAAAABVieVXVlOD7FzHRCQYAAAA
  767. AMdEJBQAAAAAx0QkEAMAAADHRCQMAAAAAMdEJAgDAAAAx0QkBAAAAMDHBCQAMEAA
  768. /xX8UEAAicaNRdKD7ByJNCSJRCQE/xUQUUAAoURAQACD7AgPt33gx0QkCAoAAADH
  769. RCQEAAAAAA+3XeJmK33ci0AIZitd3okEJOjCDQAAiUXEoURAQADHRCQICgAAAMdE
  770. JAQAAAAAi0AMiQQk6J8NAACLVcQxyWaFwA9IwYk0JGaF0g9I0WY5xw9P+GY50w9P
  771. 2g+3/8HjEAn7iVwkBP8VKFFAAIPsCIk0JP8V+FBAAIPsBI1l9FteX13DjbYAAAAA
  772. VYnlU4PsJMdEJBgAAAAAx0QkFAAAAADHRCQQAwAAAMdEJAwAAAAAx0QkCAMAAADH
  773. RCQEAAAAwMcEJAAwQAD/FfxQQACD7ByDPUhAQAADicO4BwAAAHQpiRwkiUQkBP8V
  774. NFFAAIPsCIkcJP8V+FBAAItd/IPsBMnDkI20JgAAAAChREBAAMdEJAgQAAAAx0Qk
  775. BAAAAACLQAiJBCTosAwAAA+3wOuyjXQmAI28JwAAAAChSEBAAIP4BX8G88ONdCYA
  776. VYPoAYnlV1ZTg+x8iUWkx0QkGAAAAADHRCQUAAAAAMdEJBADAAAAx0QkDAAAAADH
  777. RCQIAwAAAMdEJAQAAADAxwQkADBAAP8V/FBAAInDjUXSg+wciRwkiUQkBP8VEFFA
  778. AKFEQEAAg+wIx0QkCAoAAADHRCQEAAAAAItACIkEJOgMDAAAicahREBAAMdEJAgK
  779. AAAAx0QkBAAAAACLQAyJBCTo6gsAAGajIEBAAGajPEBAAA+3ReCJHSxAQABmK0Xc
  780. Zok1IkBAAMdFqBQAAADHRawEAAAAZqMwQEAAD7dF4mYrRd5mozJAQAC4AQAAAGaj
  781. NEBAALgBAAAAZqM2QEAAMcBmozhAQAAxwGajOkBA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D7cVIkBAAGaF
  813. 0g+IGf3//2Y7FTJAQAAPjwz9//+5CAAAAGaJDShAQADp/wIAAI10JgCNvCcAAAAA
  814. jUXCx0QkCAEAAACJRCQEjUXIiQQk/xV8UUAAD7dVwoPsDOmi+///ifaNvCcAAAAA
  815. D7cVIEBAAGaF0nh0ZjsVMEBAAH9rD7cNIkBAAGaFyXhfZjsNMkBAAH9WZqMoQEAA
  816. oThAQACDwgGDwQFmiRUkQEAAx0QkECBAQABmiQ0mQEAAx0QkBChAQACJRCQMoTRA
  817. QACJRCQIoSxAQACJBCT/FTxRQAAPtxUgQEAAg+wUZpCDwgGDRagIi02sOU2kZokV
  818. IEBAAA+PNvn//+nO+v//kGaDBSBAQAABg0WoCItNrDlNpA+PGPn//+mw+v//jXYA
  819. D7cFPEBAAGaDBSJAQAABMdJmoyBAQADplPn//410JgCNRcLHRCQIAQAAAIlEJASN
  820. RcSJBCT/FXxRQAAPt0XCg+wM6S76//+J9o28JwAAAAAPtwUgQEAAZoXAD4ig+///
  821. ZjsFMEBAAA+Pk/v//w+3FSJAQABmhdIPiIP7//9mOxUyQEAAD492+///g8ABg8IB
  822. uw0AAABmoyRAQAChOEBAAGaJHShAQABmiRUmQEAAx0QkECBAQADHRCQEKEBAAIlE
  823. JAyhNEBAAIlEJAihLEBAAIkEJP9VoA+3BSBAQACD7BTpG/v//410JgCNvCcAAAAA
  824. ZoP7Cg+EBv///w+3BSBAQABmhcAPiPb6//9mOwUwQEAAD4/p+v//D7cVIkBAAGaF
  825. 0g+I2fr//2Y7FTJAQAAPj8z6//9miR0oQEAA6cQAAACDwAGDwQGJVbBmoyRAQACh
  826. OEBAAGaJHShAQABmiQ0mQEAAx0QkECBAQADHRCQEKEBAAIlEJAyhNEBAAIlEJAih
  827. LEBAAIkEJP8VPFFAAA+3BSBAQACD7BSLVbDp4fn//4PAAYPCAWaJHShAQABmoyRA
  828. QAChOEBAAGaJFSZAQADHRCQQIEBAAMdEJAQoQEAAiUQkDKE0QEAAiUQkCKEsQEAA
  829. iQQk/xU8UUAAD7cFIEBAAIPsFOkY+///uQkAAABmiQ0oQEAAg8ABg8IBx0QkECBA
  830. QABmoyRAQAChOEBAAGaJFSZAQADHRCQEKEBAAIlEJAyhNEBAAIlEJAihLEBAAIkE
  831. JP8VPFFAAA+3BSBAQACD7BTpqvn//412AI28JwAAAABVieVXVlOD7FzHRCQEojBA
  832. AMcEJAAAAADoEwIAAKFQUUAAg8AgiQQk/xVIUUAAx0QkBAAAAgCJBCT/FVhRQACh
  833. SEBAAIP4Aw+EAwEAAH8RjWX0W15fXcOJ9o28JwAAAACD6AHHRCQYAAAAAMdEJBQA
  834. AAAAiUXAx0QkEAMAAAC7DAAAAMdEJAwAAAAAx0QkCAMAAAC/AgAAAMdEJAQAAADA
  835. xwQkADBAAP8V/FBAAInCiUXEjUXSg+wciUQkBIkUJP8VEFFAAIPsCJCNtCYAAAAA
  836. oURAQADHRCQIEAAAAMdEJAQAAAAAiwS4g8cCiQQk6C0BAACLDURAQAAPt8CLNBmJ
  837. RCQEg8MIi0XEiQQk/xU0UUAAifCD7AjoBOn//zl9wH+vD7dF2ot1xIk0JIlEJAT/
  838. FTRRQACD7AiJNCT/FfhQQACD7ASNZfRbXl9dw410JgChREBAAItACOjD6P//6e3+
  839. //+NtCYAAAAAjbwnAAAAAFWJ5VdWU41F5IPsPMdF5AAAAACJRCQQx0QkDAAAAADH
  840. RCQIAEBAAMdEJAREQEAAxwQkSEBAAOjFAAAAhcB4S4M9SEBAAAF+NKFEQEAAizVc
  841. UUAAMduLeASQjbQmAAAAAIsE3UAxQACJPCSJRCQE/9aFwHQjg8MBg/sMdeShQEBA
  842. AIkEJP8VAFFAAMcEJP//////FQBRQAD/FN1EMUAA69z/JYRRQACQkP8ldFFAAJCQ
  843. /yVwUUAAkJD/JWxRQACQkP8laFFAAJCQ/yVkUUAAkJD/JWBRQACQkP8lXFFAAJCQ
  844. /yVYUUAAkJD/JVRRQACQkP8lTFFAAJCQ/yVIUUAAkJD/JURRQACQkP8lfFFAAJCQ
  845. /yU8UUAAkJD/JThRQACQkP8lNFFAAJCQ/yUwUUAAkJD/JSxRQACQkP8lKFFAAJCQ
  846. /yUkUUAAkJD/JSBRQACQkP8lHFFAAJCQ/yUYUUAAkJD/JRRRQACQkP8lEFFAAJCQ
  847. /yUMUUAAkJD/JQhRQACQkP8lBFFAAJCQ/yUAUUAAkJD/JfxQQACQkP8l+FBAAJCQ
  848. /////wAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  849. AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  850. AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  851. AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  852. AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  853. QwBPAE4ATwBVAFQAJAAAAEsARQBSAE4ARQBMADMAMgAuAEQATABMAAAAU2V0Q3Vy
  854. cmVudENvbnNvbGVGb250RXgAVABlAHIAbQBpAG4AYQBsAAAAJQBkACAAJQBkACAA
  855. JQBkACAAJQBkACAAJQBkACAAJQBkACAAJQBkACAAJQBkAAoAAABDAE8ATgBJAE4A
  856. JAAAACUAZAAgACUAZAAKAAAAAABQAFIASQBOAFQAAABGAEMAUABSAEkATgBUAAAA
  857. QwBPAEwATwBSAAAATABPAEMAQQBUAEUAAABMAEEAUwBUAEsAQgBEAAAASwBCAEQA
  858. AABNAE8AVQBTAEUAAABEAEEAVABFAFQASQBNAEUAAABTAEwARQBFAFAAAABDAFUA
  859. UgBTAE8AUgAAAEYATwBOAFQAAABQAEwAQQBZAAAAAACkMEAAACZAALAwQACAG0AA
  860. wDBAANAaQADMMEAAwBlAANowQABgGUAA6jBAABAZQADyMEAAIBhAAP4wQACwF0AA
  861. EDFAAGAXQAAcMUAAYBZAACoxQAAwFEAANDFAAIATQABHQ0M6ICh0ZG02NC0xKSA1
  862. LjEuMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  863. AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkUAAAAAAAAAAAAADcUwAA
  864. +FAAALBQAAAAAAAAAAAAACBUAABEUQAA6FAAAAAAAAAAAAAAMFQAAHxRAADwUAAA
  865. AAAAAAAAAABAVAAAhFEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAjFEAAJpRAACoUQAA
  866. tlEAAMRRAADcUQAA7lEAAAxSAAAcUgAALlIAAD5SAABSUgAAalIAAIZSAACYUgAA
  867. qlIAAMRSAADMUgAAAAAAAOJSAAD0UgAA/lIAAAhTAAAQUwAAGlMAACZTAAAyUwAA
  868. PFMAAEhTAABUUwAAXlMAAGhTAAAAAAAAclMAAAAAAACEUwAAAAAAAIxRAACaUQAA
  869. qFEAALZRAADEUQAA3FEAAO5RAAAMUgAAHFIAAC5SAAA+UgAAUlIAAGpSAACGUgAA
  870. mFIAAKpSAADEUgAAzFIAAAAAAADiUgAA9FIAAP5SAAAIUwAAEFMAABpTAAAmUwAA
  871. MlMAADxTAABIUwAAVFMAAF5TAABoUwAAAAAAAHJTAAAAAAAAhFMAAAAAAABTAENs
  872. b3NlSGFuZGxlAJIAQ3JlYXRlRmlsZVcAGgFFeGl0UHJvY2VzcwBkAUZyZWVMaWJy
  873. YXJ5AKQBR2V0Q29uc29sZUN1cnNvckluZm8AALABR2V0Q29uc29sZU1vZGUAALYB
  874. R2V0Q29uc29sZVNjcmVlbkJ1ZmZlckluZm8AAAQCR2V0TG9jYWxUaW1lAABFAkdl
  875. dFByb2NBZGRyZXNzAAAsA0xvYWRMaWJyYXJ5VwAApQNSZWFkQ29uc29sZUlucHV0
  876. VwDzA1NldENvb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AAAAAAAAAAAAAAAAAAAAAAAAA
  892. AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  893. AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  894. AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  895. AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
  896. -----END CERTIFICATE-----
  897.  
  898. ==============================
  899. :Main Script body - USAGE DEMO
  900. ==============================
  901.  
  902. :# Enable Macros; facilitate nested variables !element[%index%]!
  903.  Setlocal enableDelayedExpansion
  904.  
  905. :# Ensure no Existing variables prefixed 'Btn'
  906.  For /f "Tokens=1,2 Delims==" %%G in ('Set Btn 2^> nul')Do Set "%%G="
  907.  
  908.  Set /A "Density=4", "minX=5", "maxX=45", "minY=5", "maxY=20"
  909.  Set "Live.Cell.Char=╬"
  910.  Set "Live.Cell.Char[i]=20"
  911.  
  912.  For %%z in (Live Dead)Do Call :ColorMod %%z.cell -l
  913.  
  914.  If "!Live.Cell.FG.Color!"=="" Set "Live.Cell.FG.Color=250;70;0"
  915.  If "!Live.Cell.BG.Color!"=="" Set "Live.Cell.BG.Color=0;80;160"
  916.  If "!Dead.Cell.FG.Color!"=="" Set "Dead.Cell.FG.Color=20;30;40"
  917.  If "!Dead.Cell.BG.Color!"=="" Set "Dead.Cell.BG.Color=0;0;0"
  918.  
  919. %= [demo][1] =% %Make.Btn% demo /S Option One /t
  920. %= [demo][2] =% %Make.Btn% demo /S Option Two /t
  921. %= [demo][3] =% %Make.Btn% demo /S Option Three /t
  922. %= [demo][4] =% %Make.Btn% demo /S "    Exit      " /bo 38 2 190 160 0 + 48 2 40 0 0 /bg 40 0 0 /fg 40 200 40
  923.  
  924. :loop REM [ demo -  Generic menu via a loop ]
  925. REM redefines buttons each loop with current color values. Note /N switch used to reset
  926. REM button group.
  927. %= [CellCol][1] =% %Make.Btn% CellCol /S Live.Cell /X 20/fg %!!% /bg %!!% /bo 33 /N
  928. %= [CellCol][2] =% %Make.Btn% CellCol /S Dead.Cell /fg %!!% /bg %!!% /bo 33
  929.  
  930. REM Expand Get.Click macro with arguments corresponding to the group names of buttons defined using make.btn
  931. REM Each loop Displays Buttons current toggle state. Use goto to break out of a loop to your target label.
  932.  %Get.Click% demo CellCol
  933.  
  934.  Title Y;X:!C{pos}! C:!Clicked[%Group%]! VC:!ValidClick[%Group%]!
  935.  %If.btn[demo]%[4] (
  936.   Call :YesNo Yes No "Are you sure?"
  937.   If "!Clicked[YN]!" == "Yes" (
  938.    cls
  939.   REM [ demo - Familiarise users with state definitions for toggle buttons. ]
  940.    Set btn[ | findstr /lic:"{state}"
  941.    Pause
  942.    %Clean.Exit%
  943.   )
  944.  )
  945.  
  946. Rem assess If button clicked belonged to a specific group, if true Passes the buttons text to the Function ColorMod
  947.  If "%Group%"=="CellCol" Call :ColorMod !Clicked[CellCol]!
  948.  
  949. Goto :loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement