![]() |
|
[Shell] [Add-On Macro for menus] - auto-window-size-detecting screen-wide line echoer - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Shell] [Add-On Macro for menus] - auto-window-size-detecting screen-wide line echoer (/showthread.php?tid=5381568) |
[Add-On Macro for menus] - auto-window-size-detecting screen-wide line echoer - ImDeepWithWindows - Aug 21, 2016 this is just an Add-On macro for batch-files that have menus or splash-screens or other significant visual display like that, it checks the window-width of the CommandPrompt window the batch-file is running in then generates and displays an exactly screen-wide line (line is by default made out of underscores you can change that to any character you want and keep changing it threw out the whole time your batch-file is running). -- maybe im just comming up with a stupid idea cuz im on like no sleep, drunk, and on a bunch of xanax but i think this snipit of code for ppl to paste into their batch-files could rlly help ppl who are still kinda new to batch but getting better to have better looking menus and splash-screens and stuff and for ppl who know what theyre doing but just dont wanna do all that typing themselves, its two lines of code once you've paisted that macro in, 1) calling a section of the macro once in the begging of your script 2)everytime u want a screen-wide line in your CommandPrompt window to box-in menu options or something and u want those screen-wide lines to be always exactly screen-wide no matter if someone changed the size of the window since the batch-file was open or whatever all you have to do is type "%LineAcrossScreen%" then when that line of code "%LineAcrossScreen%" is being executed it checks how wide the CommandPrompt window is then generates a line thats exactly that width and echos it -- this definitely isnt my best but whatever it popped into my mind even if its the first thing that i post on here thats not high-level & useful its just a display gimmick idc it might help someone out how to use: -put it anywhere in your Batch-File where it'll get skipped over -to for lack of a better word to "activate" the maco type "call :SetUpLineBuilder" somewhere in your script before you need to use those screen-wide lines -after you've "activated" the macro everytime you need a screen-wide line just type "%LineAcrossScreen%" as if its a regular command, just put it on its own line. and it'll check how wide the commandPrompt window is at the time it is being executed then generates and display/echos a screen-wide line (this takes a fraction of a second it u wont even notice) -to change the character the line is made out of (again this is only after you've executed "call :SetUpLineBuilder") type: "%UseChar%{Character-you-wanna-use-go-here}" like if you wanted the line to be made of asterisks ("*") this time type "%UseChar%*" or if u want equal-signs ("=") "%UseChar%=" or if u want hash-tags ("#") "%UseChar%#" you get the pic (this just changes what the lines will be made of, it wont show the line when its executed, you'll have to execute another "%LineAcrossScreen%" after you change which character it is to do that) Code rem ******************************************************************************************************************************************[img]http://nhserver.x10host.com/hackforums/Add-On_macro/4.jpg[/img] also when u do "call :SetUpLineBuilder" in your batch-file you're just adding 4 commands to your batch-file that are in the form of variables (its just easier for someone who didnt write this to remember the words of the variables' names than the text they represent) 3 of these executable variables all have the same value "call :BuildLine" you can just pick the one thats easiest for you to remember tbh idk why i made 3 commands for that maybe being way to barred out, drunk, and on like 3hours of sleep for the last few days had something do do with it idk, anyway these commands in the form of executable variables are "%LineAcrossScreen%" & "%BuildLine%" & "%line%". those are the ones you execute when u want to echo that screen-wide line the last command is "%UseChar%", its the one that picks which character the screen-wide line is made of (default is underscore) u use it by putting the character you want to have the screen-wide lines made out of right next to it like this "%UseChar%_" ; "%UseChar%*" ; "%UseChar%=" ; "%UseChar%-" "%UseChar%#" heres a quick script using this AddOn macro so you can see how the commands are executed and still understand just incase i did a shitty job explaining, its the same script as in the picture Code @goto :batchRE: [Add-On Macro for menus] - auto-window-size-detecting screen-wide line echoer - SlowMehMo - May 5, 2018 Oh neat, ill see if i could edit this a bit, good idea and thinking outside the box RE: [Add-On Macro for menus] - auto-window-size-detecting screen-wide line echoer - ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™ - May 5, 2018 Here is as faster example! Code @echo off & setlocal EnableDelayedExpansion |