Rob van der Woude's Scripting Pages

Help text for DropDownBox.cs

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

DropDownBox,  Version 1.17
Batch tool to present a DropDown dialog and return the selected item

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

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

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

Where:    "list"          is the list of items to populate the dropdown control
          "listcommand"   is a command whose standard output is used as a list
                          of items to populate the dropdown control
          "prompt"        is the optional text above the dropdown control
                          (default: none)
          "title"         is the window title
                          (default: "DropDownBox,  Version 1.17")

Options:  /C:index        use iCon at index from shell32.dll (default: 23)
          /D:"delimiter"  sets the Delimiter character for "list"
                          (default: semicolon)
          /F:"listfile"   use list from text File (one list item per line)
          /H:height       sets the Height of the input box
                          (default: 90; minimum: 90; maximum: screen height)
          /I:index        sets the zero based Index of the preselected item
                          (default: 0)
          /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)
          /RI or /R1      Return code equals selected Index + 1, or 0 on
                          (command line) errors or if "Cancel" was clicked
                          (default: 0 on "OK", 1 on error, 2 on "Cancel")
          /RO or /R0      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")
          /S              Sort list (default: unsorted)
          /T:tablength    sets the number of spaces for Tabs in prompt
                          (4..16; default: 4)
          /W:width        sets the Width of the input box
                          (default: 200; minimum: 200; maximum: screen width)

Notes:    The selected item text is written to Standard Out if "OK" is clicked,
          otherwise an empty string is returned.
          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.
          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 /RI return code equals selected index + 1, or 0 for "Cancel".
          With /RO return code equals selected index, or -1 for "Cancel".
          Command line switches /RI and /RO 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: 2022-10-05; loaded in 0.0048 seconds