Read Mode

GetInput - An Astonishing Batch Plugin | By Aacini

GetInput Function | By Aacini

Beauty? - Everyone Seeks it in their work! We all want to create beauty within our limits. That's the same thing Aacini has created with this little 3.50 KBs of GetInput Function. The way it works, Seems very much similar to the "CmdMenuSel.exe Plugin". But, The only difference is that - Now, you can select the area of your choice to check hover. Otherwise, in CmdMenuSel Plugin, You Only can specify the Options and The Layout on the console is auto-arranged and rigid. So, Instead of only changing the menu option text, Now we can also control the area of selection.

You can Download the Plugin and related files from the End of article. And, The first time I encountered the output of this plugin, via an example file provided by Aacini. The reaction was as close to the gif below. 😁 Creating Such an awesome batch Plugin, with such a small file Size is a tremendous thing, over the CmdMenuSel.exe - which has almost 900 KBs of file Size. Because of this efficient approach, GetInput Can be considered as next version of the CMDMenuSel.exe.

The plugin is so much fast and efficient that, it must be the first choice for the Batch programmers to get input in their Projects. Lets Talk about its usage and advantages.
Related Post: CmdWiz - CMD Helper Tool | By misol101
How to Use?
As we have already discussed that, this plugin can only be used for getting Input from users, doesn't matter - if it is mouse input or Keyboard input. It gives output according to the input provided by user. You can then, manipulate the plugin's output in your batch program to do specific task.

Syntax: GetInput [/T msecs] [/I] [{"chars"|keycode}...] [/M left top right bottom ... [/H [h1 h2 h3 ...]] ]
/T msecs                     Time to wait in milliseconds.
/I                                  Ignore case of letters in given "chars" and keycodes.
"chars"                         Valid input Ascii characters.
keycode                       Valid input key code(s).
/M l t r b ...                   Coordinates of input selection boxes for mouse clicks.
/H h1 h2 h3 ...              Color attributes for "Hover" effect. See: COLOR /?

Description From Author 😋

Gets input from both keyboard and mouse. This program read input from keyboard and mouse and return it via ERRORLEVEL.
  • If no parameter is given, it waits for a key press or mouse button click and return a value that indicate the input accordingly to the table given below.
  • If /T switch is given, it waits the maximum number of milliseconds specified; if the value is zero, it returns immediately. If there is no previous input or new input in the given lapse, the returned value is zero.
  • Extended and cursor control keys can be specified via numeric key codes; see the table of equivalences below. 
  • If /I switch is given, the letters in "chars" string and keycodes uses case-insensitive match.
    • If a list of valid input is given, it returns the *position* of the input key in the list starting at one. 
    • If both characters and key codes are intermixed, they all are numbered accordingly to their positions.
  • If a list of coordinates for selection boxes is given, the *position* of the selected box in the list is returned starting at one.
    • This means that the valid keys and the selection boxes share the same values and there is no way to distinguish them, unless both lists were specifically created to do so.
  • If /H switch is given, the "Hover" effect when the mouse pointer pass over the selection boxes is enabled. The hover color will be a standard one.
    • Or several colors may be given after /H switch for all boxes.
    • If there are less colors than boxes, the last color will be reused
    • The color at the first position of a box will be used to redraw the original contents *of the whole box*.
  • When no /M switch (list of selection boxes) is given, mouse button click positions are returned as negative ERRORLEVEL values.
    • To get the position of a mouse click, use this method:

_____________General Code Sample (Download Link @ END)_____________

If %errorlevel% gtr 0 (echo Key pressed: %errorlevel%) ELSE (

      rem Mouse button clicked

      set /A "input=-%errorlevel%, row=input >> 16, col=input & 0xFFFF"

      if !col! lss 32768 (echo LEFT button clicked at !row!,!col!

      ) else (

         set /A col-=32768

         echo RIGHT button clicked at !row!,!col!




  • To specify a right-button click in /M switch selection boxes, add 32768 to column coordinates, that is, to both left and right ones. 
  • Screen coordinates start in 0 0 at the left-top corner of the screen.

Table of equivalences for input key codes given or values returned:

  • Keyboard keys have positive values.
    • Control-keys in 1..31 range: Ctrl_C=3, TabKey=9, EnterKey=13, EscKey=27, etc.
    • Shift_Tab (BackTab) is a special case; its value was chosen as 31.
    • Ascii characters in 32..191 range: Space=32, A=65, a=97, etc.
    • Alt-keys in 192..255 range: Alt_1=209, Alt_A=225, Alt_Z=250, etc.
    • Extended-keys in 256..511 range:
    • PageUp=289,
    • PageDown=290, 
    • EndKey=291, 
    • HomeKey=292, 
    • LeftArrow=293, 
    • UpArrow=294
    • RightArrow=295, 
    • DownArrow=296, 
    • InsKey=301, 
    • DelKey=302, 
    • F1=368, ..., F12=379.
    • In Shift-extended key combinations, add 256: Shift_PageUp=545, etc.
    • Extended keys values use the Virtual Key Code value plus 256. See: Link

And, Its a hell lot of technical explanation. The Work of Aacini speaks itself abut the level of Hardwork and Quality of his work. We, as a Batch Community - Really appreciate his efforts and salutes him for providing all of his work for everyone's use. Its very difficult to find such souls these days on earth. 
"The sole meaning of life is to serve humanity."
-Leo Tolstoy
That's All, From the official description by the Author. And i think, It covers almost everything about the Plugin itself. IF you are still in Doubt, or There's something in the article needed to be changed or updated. Feel Free to leave a comment below about it. I'll Try To Help you out. Thanks for your time. 

Keep Sharing, Keep Learning...
Be Happy, Spread Happiness...

Download Link:


1 comment:

  1. As soon as I saw this article I replaced my cmdmenusel plugin with GetInput, Awesome plugin Aacini


Powered by Blogger.