Мануал по Wselect
Wselect Ver. 2.30 (c) 2005-2016, Horst Schaeffer
------------------------------------------------
Wselect открывает окно со списком для выбора в BAT/CMD. Элементы (построчно) из заданного файла, который может быть либо
фиксированнвм, либо автоматически в пакетном файле. Специальные параметры для стиля меню.
Важно: пожалуйста, прочитайте "Codepage.txt" если вы имеете дело только с простым текстом на английском языке.
Файл может иметь
любое количество линий.
Окно будет автоматически центрироватья и подгоняться под размер.
Выбор осуществляется с помощью мыши (двойной щелчок; один клик по меню) или стрелка вверх/вниз (+ ввод). Прервать можно, закрыв
окно. В результате возвращается значение errorlevel (рекомендуется для меню) или выборочно в строку с текстом.
Специальные функции в режиме меню
-----------------------------
Край (20 пикселей) по меню
Текст заголовка (необязательно)
Курсор в виде руки
Одним щелчком мыши выбор
Если выбрать пустой элемент, то ничего не происходит (может быть использован в качестве разделителей)
Панель выбора изначально скрыты (клавиатура: используйте стрелку вниз)
Общий Синтаксис:
---------------
Wselect ListFile WindowTitle OutputString [MenuHeader] [параметры] [> Выходной_файл]
Параметры:
ListFile исходный файл с элементом (линий)
WindowTitle будет отображаться в строке заголовка
OutputString будет отправлен в stdout (Стандартный вывод будет перенаправлен в файл);
знак: $item будет заменен на выбранный элемент
MenuHeader доступен с опцией /menu; знак (^) переноса строки;
посмотреть варианты цвета заголовка, высоты
Двойные кавычки являются обязательными для каждого из четырех параметров,
если они содержат пробелы или разделители.
Опции:
Варианты меню:
/quote производит двойные кавычки вокруг $item в выходную строку окна
/cmdCenter центрирует окно в CMD (по умолчанию: по центру)
/grid линии сетки
/margin отступ 20 пикселей вокруг списка (по умолчанию для /menu)
/ontop поверх всех окон
/fixedfont Lucida Console (вместо Verdana)
/fs=(value) размер шрифта; по умолчанию: /fs=9
/bg=#(rgb) цвет фона в шестнадцатеричном формате (так же как и в HTML); по умолчанию: bg=#FFFFFF
/fc=#(rgb) цветов шрифта, по умолчанию: fc=#000000
/dx=(pixels) горизонтальная позиция окна плюс/минус значение (например, /dx=+100)
/dy=(pixels) вертикальная позиция окна плюс/минус значение (например,/dy=-80)
/ps=(number) номер предварительно выбранного элемена - позиция курсора (исходное положение, 1..)
Варианты меню:
/menu режим меню
/hh=(pixels) высота заголовка (включает в себя пространство ниже; по умолчанию: 35 px)
/hc=#(rgb) для заголовка цвет текста по умолчанию: так же как и общий цвет шрифта
Все параметры и опции должны быть разделены пробелом (без запятых!).
Параметров не чувствительны к регистру.
Wselect returns errorlevel 1.. according to line/item number selected; max: 255
0 means: no selection / aborted
Wselect возвращает значение errorlevel 1.. по данным выбранной строки/пункта; максимум: 255
0 означает: выбор не сделан / прерван
Пример Меню:
-------------
Wselect Menu.txt "Wselect Demo" "$item" "Выберите действие:" /menu /hc=#CC0000 /cmdCenter
if %errorlevel%==0 goto :eof
if %errorlevel%==1 goto FirstItem
if %errorlevel%==2 goto SecondItem
rem etc...
Альтернативная обработка errorlevel:
goto Action-%errorlevel%
где метки :Action-0, :Action-1 .. и т. д. предполагается.
Важно:
Пустые строки (используется в качестве разделителя) считать для возврата ошибки!
Если OutputString используется без перенаправления ("$item" в примере) он будет отправлен на консоль, и может быть
использовано для отображения выбранного элемента. Если не используется, но указан MenuHeader, должна быть вставлена пустая строка ("").
List Example:
-------------
dir /b c:\some\where\*.zip > arclist.txt
Wselect arclist.txt "Archives" "set arcfile=$item" > temp.cmd
if not errorlevel 1 goto :eof
call temp.cmd
echo You selected: "%arcfile%"
pause
This produces a list of ZIP files (by DIR command), and offers them for selection.
The output string (the $item token is replaced with the selected file name) is written to a temporary batch file. When it is CALLed, this will execute the SET statement, and set the environment variable arcfile to the selected item for further processing.
Wselect also returns the errorlevel (1..max 255) of the selected item.
Null means "cancelled" ("if NOT errorlevel 1" or "if %erroelevel%==0")
Note: on errorlevel 0 the returned string will be empty.
The output can be sent to a text file, or to a batch file for subsequent execution. Use the redirection symbol ">" to overwrite or ">>" to append to the target file.
Experienced users may also use a FOR /F construct to avoid the production of a temporary batch file.
CodePage
--------
This program and the batch script are both assumed to run with the normal Windows character set ("ANSI") as used by a Windows editor like Notepad. The legacy "OEM" character/code assignment that was used under MS-DOS is no longer supported.
See file "codepage.txt" if you have to deal with special characters, like German "Umlauts" or letters with French accents etc. (code above 127, like "дйы"). Use the CHCP command for a character set conforming to Windows ANSI (example: CHCP 1252 for West Europe).
Quote marks
-----------
The selected item will be placed in the output string without quote marks by default. Use option /quote to enclose the item string in double quote marks, in case there are spaces or delimiters in the string, and you want to use it as command or path. SET or CD, for example, do not require quote marks. If you want to modify the returned string, make sure it is not enclosed in quote marks.
As a special feature (and in addition to the /quote option) Wselect will replace two single quote marks ('') with one double quote mark (") in the OutputString.
Color codes
-----------
A color code consists of the three hexadecimal values for red, green and blue, with two digits each. Example: /bg=#dce3c4. If you are not familiar with these codes, try a web tool like this:
http://www.colortools.net/color_picker_web-safe.html
Current directory
-----------------
The current directory is indicated by the command prompt in a console window. You may use file names without path or with relative paths, based on the current directory. The full path is safe in any case.
SET statement
-------------
Producing and executing a SET statement is in most cases convenient for further processing. Note, however, that the item text must not contain any symbols that may corrupt the temporary batch file (like redirection symbols, or ampersand).
Dual monitor
------------
If you have a secondary monitor, you may use the /DX option to displace the Wselect window beyond the desktop border. Make sure the window will be completely outside the desktop, otherwise the program will pull the window back into the first monitor.
History
-------
ver. 2.30 2016/12/19 Dual monitor aware for options /DX, /DY; internal modifications
/oemout no longer supported; new option: pre-select (item#)
ver. 2.20 2013/02/12 Menu header, options; margin now also available for lists
On errorlevel 0 the returned string will always be empty
ver. 2.13 2012/11/18 Grid lines are optional now: /grid
ver. 2.12 2011/07/02 Options added: /ontop /fc /dx /dy
ver. 2.10 2010/08/18 Enhanced menu mode
ver. 2.00 2010/03/22
Disclaimer
----------
This program is freeware (c) Horst Schaeffer. No warranty, no liability of any kind.
PureBasic Source:
http://www.horstmuc.de/source/wselect230.zip
mailto:horst.schaeffer@gmx.net
http://www.horstmuc.de/
*19 Dec 2016