Rob van der Woude's Scripting Pages

Help text for RadioButtonBox.cs

(view help text of RadioButtonBox.cs as plain text)

RadioButtonBox,  Version 1.01
Batch tool to present a Radio Button dialog and return the selected item

Usage:   RADIOBUTTONBOX   "list"  [ "prompt"  [ "title" ] ]  [ options ]

   or:   RADIOBUTTONBOX   /F:"listfile"  [ "prompt"  [ "title" ] ]  [ options ]

   or:   listcommand  |  RADIOBUTTONBOX  [ "prompt"  [ "title" ] ]  [ options ]

Where:   "list"          a list of items to populate the radio button group
         "listcommand"   is a command whose standard output is used as a list
                         of items to populate the radio button group
         "prompt"        is the optional text above the radio button group
                         (default: none)
         "title"         is the window title
                         (default: "RadioButtonBox,  Version 1.01")
Options: /A              show Aliases for command line switches (see Notes)
         /C:columns      sets then number of Columns for the radio button group
                         (default: 1)
         /D:"delimiter"  sets the Delimiter character for "list"
                         (default: semicolon)
         /DE             DEdup: remove duplicates from "list"
         /F:"listfile"   use list from text File (one list item per line)
         /H:height       sets the window Height (default: autosized to make
                         content fit; minimum: 90; maximum: screen height - 68)
         /I:index        use Icon at index from shell32.dll (default: 23)
         /K              sKip first item of list (e.g. a header line)
         /L[:"captions"] Localize or customize button captions
                         (e.g. /L:"OK=Why Not?;Cancel=No Way!")
         /MF             use Monospaced Font in prompt (default: proportional)
         /NM             make dialog Non-Modal (default: modal, i.e. on top)
         /P:index        sets the zero based index of the Preselected item
                         (default: 0)
         /R:rows         sets then number of Rows for the radio button group
                         (default: one row per list item)
         /RC0            Return Code equals selected 0-based index, or -1 on
                         (command line) errors or if "Cancel" was clicked
                         (default: 0 on "OK", 1 on error, 2 on "Cancel")
         /RC1            Return Code equals selected 1-based index, or 0 on
                         (command line) errors or if "Cancel" was clicked
                         (default: 0 on "OK", 1 on error, 2 on "Cancel")
         /S              Sort list (default: unsorted)
         /T:tablength    sets the number of spaces for Tabs in prompt
                         (4..16; default: 4)
         /W:width        sets the window Width (default: autosized to make
                         content fit; minimum: 200; maximum: screen width - 16)

Notes:   The selected item text is written to Standard Out if "OK" is clicked,
         otherwise an empty string is returned.
         Most command line switches have one or more aliases, e.g. instead
         of /R:5 you can use /ROWS:5 to make your batch files more readable;
         use command line switch /A to get a list of all available aliases.
         Use either "list" or /F:"listfile" or "listcommand".
         Linefeeds (\n), tabs (\t) and doublequotes (\") are allowed in the
         prompt text (but not in the title); with tabs, /MF is recommended.
         To get a custom title without prompt, use " " for prompt.
         If specified without captions, switch /L forces localized button
         captions (e.g. "Cancel" button caption is "Annuleren" on Dutch
         systems); if only a single custom caption is specified, the other
         one is localized (e.g. with /L:"OK=Gaan" on Dutch systems, "OK"
         button caption is "Gaan", "Cancel" button caption is "Annuleren").
         Return code 0 for "OK", 1 for (command line) errors, 2 for "Cancel".
         With /RC0 return code equals selected index, or -1 for "Cancel".
         With /RC1 return code equals selected index + 1, or 0 for "Cancel".
         Command line switches /RC0 and /RC1 are mutually exclusive.

Credits: On-the-fly form based on code by Gorkem Gencay on StackOverflow:
         http://stackoverflow.com/questions/17546909
         Code to retrieve localized button captions by Martin Stoeckli:
         http://martinstoeckli.ch/csharp/csharp.html#windows_text_resources
         Code to extract icons from Shell32.dll by Thomas Levesque:
         http://stackoverflow.com/questions/6873026

Written by Rob van der Woude
http://www.robvanderwoude.com

page last uploaded: 2018-02-15, 10:51