Rob van der Woude's Scripting Pages

Help text for MultipleChoiceBox.cs

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

RadioButtonBox,  Version 1.00
Batch tool to present a Checkbox dialog and return the selected items

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

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

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

Where:   "list"          is a list of items to populate the checkbox group
         "listcommand"   is a command whose standard output is used as a list
                         of items to populate the checkbox group
         "prompt"        is the optional text above the checkbox group
                         (default: none)
         "title"         is the window title
                         (default: "MultipleChoiceBox,  Version 1.00")
Options: /A              show Aliases for command line switches (see Notes)
         /C:columns      sets the number of Columns for the checkbox 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:initial      Preselect the initial checkboxes' state (see Notes)
         /R:rows         sets then number of Rows for the checkbox group
                         (default: one row per list item)
         /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 /P the inital state of each checkbox can be set; e.g. /P:5
         wil set the 1st (1<<0 = 1) and 3rd (1<<2 = 4) checkboxes checked.
         Return code is a binary representation of the checked items, e.g. 5
         (0101) if only the 1st and 3rd checkboxes were checked, -1 on errors.
         Be aware that the return code may be useless after sorting the list.

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: 2022-10-05; loaded in 0.0139 seconds