Display (large) buttons on screen to send keyboard actions or start an application.
Revision history can be found in the source: WinButtons.au3
-d | Debug log mode, write extra debugging and logging information to WinButtons.log Most useful if placed as first on the commandline, then also logs during command line parsing. |
-d- | Debug log mode disabled. |
-f inifile | Filemode, read configuration from inifile, instead of WinButtons.ini. -f can be ommitted. |
-t <top> | Top pixel of the window that shows the buttons, -1 means vertical screen-center is used. |
-l <left> | Left pixel of the window that shows the buttons, -1 means horizontal screen-center is used. |
-w <width> | Width of the buttons to display. Default is 128. |
-h <height> | Height of the buttons to display. Default is 128. |
-m <margin> | Margin between buttons and the windows border, and between each button. Default is 2. |
-r <rows> | Number of rows to separate the available buttons in. Default is 1. |
-x | RunExit mode enabled. Closes WinButtons after a button is pressed and its command executed. |
-x- | RunExit mode disabled (default). |
-v | Vertical mode enabled, draw buttons from top to bottom instead of left to right. |
-v- | Vertical mode disabled (default). |
-mv | Movable mode enabled, allows dragging the form across the screen, when grabbed by its border or background, using the mouse. |
-mv- | Movable mode disabled (default). |
-ta | Taskbar mode enabled, show a taskbarbutton in the Windows taskbar. |
-ta- | Taskbar mode disabled (default). |
-b | Border enabled, show a border around the window. |
-b- | Border disabled (default). |
-cl | Close button enabled, show a close button on the window, the Window Border (-b) should also be enabled! |
-cl- | Close button disabled (default). |
-o | Ontop mode enabled, Button windows floats on top of all windows (default). |
-o- | Ontop mode disabled. |
-hnd handle | Add handle to the list of window handles to hide when -hide or -hidex command switch is used, an be specified multiple times |
-e | Enable ExitOnEsc mode (default), to close the WinButtons window by pressing <Esc> |
-e- | Disable ExitOnEsc mode, pressing <Esc> won't close the WinButtons window. |
-fs <size> | Fontsize for use on all buttons in points (default font is fixed at 9 pt) |
-a | Enable ActiveExe option, to generate a list of executable names that got focus during this WinButtons session. Appended to WinButtons-active-exes.log when WinButtons is closed. |
-ah | Enable Alternate Hide method for another way of hiding the windows. Can also be set using althide configuration setting. |
-ah- | Disable Alternate Hide. (default) |
-cs <separator> | Set an alternate Multiple Command separator string. Default is ^, proposed alternative is &&, as ^ can not be combined with -send |
-? | Help mode, display a messagebox with all available commandline options. |
Any commandline option overrides the corresponding setting from the inifile.
This is a sample [Settings] section of the inifile, all settings are shown with their default value. It applies to the current instance of WinButtons.
None of the values need to be present to have a working configuration, the defaults will then be used.
[Settings] debug=0 caption= runexit=0 left=-1 top=-1 buttonwidth=128 buttonheight=128 buttonmargin=2 vertical=0 border=0 closebutton=0 taskbar=0 movable=0 buttonrows=1 ontop=1 winsendkeys= exitonesc=1 fontsize=9 backcolor= excludeexes= althide= cmdseparator=
debug | Debug log mode enabled when set to 1 |
caption | The caption of the form showing all buttons. Border must be enabled to display the caption. Environment variables can be used by using %env.variable% |
runexit | RunExit mode. Normally after starting a command, the form stays in place, -runx command can be used to exit this instance of WinButtons or runexit set to 1 |
left | Left position of the form, -1 centers the form on the screen, after calculating the width of the form. |
top | Top position of the form, -1 centers the form on the screen, after calculating the height of the form. |
buttonwidth / buttonheight | Dimension of the button(s) in pixels. All buttons will have the same size. Default is 128 x 128. |
buttonmargin | Space between the buttons and the form-borders. Default is 2. |
vertical | Display a vertical column of buttons when set to 1. |
border | Display a border around the form when set to 1. |
closebutton | Display a standard Windows close button on the form. If taskbar = 0 a smaller close button is displayed. |
taskbar | Display WinButtons in the Windows taskbar. Allows this WinBottons instance to be selected using <Alt-Tab> or by mouse in the taskbar. |
movable | Makes the form movable when set to 1. |
buttonrows | Number of rows of buttons to display (assuming more than 1 button definition...). The count of buttons is divided by this number to determine the size of the form. If a number of buttons is not fully divisable by this number, void spaces are displayed instead of buttons. |
ontop | Determines if the button window is foating on top of all windows, or can be hidden behind other windows. Default set to 1, disabled when set to 0. |
winsendkeys | Specify the path/filename for WinSendKeys.exe (download from http://www.donationcoder.com/forum/index.php?topic=25389.0). Not checked for existence, just executed (can be in path).Will be read from WinButtons.ini, if not found in the current .ini file (and current file is not WinButtons.ini) |
exitonesc | When set to zero won't close the WinButtons windows when <Esc> is pressed. Is read from global ini, so sub-menus should probably provide a button to quit that menu. |
fontsize | The global fontsize to be used for all buttons. Can be overridden by specific button fontsize<n> setting. |
color | The default color of the button-face, can be overridden by a group or button setting |
textcolor | The default color of the text on the buttons, can be overridden by a group or button setting |
backcolor | The background color of the WinButtons window. Color values in rgb, most easy is to use hexadecimal notation with 0x prefix, like 0xff0000 for red. |
excludeexes | The comma-separated list of exe files, not to trigger a change of button context when [Groups] are defined. |
althide | Use Alternate Hide method (WinSetState instead of SetWindowPos) for hiding a Window, in case of re-painting issues. |
cmdseparator | Set the character(s) to be used as Multiple Command separator. Default is ^, proposed alternate could be &&, as ^ can not be combined with -send |
If a setting is not found for: debug, buttonwidth, buttonheight, buttonmargin, closebutton, border, taskbar, ontop, exitonesc, winsendkeys, fontsize, excludeexes, althide or cmdseparator in the current ini file, and we are not reading WinButtons.ini, then the setting is also searched in WinButtons.ini as a global configuration. Local override or command-line option always 'wins'.
Groups can be defined to switch the set of available buttons, based on the current application having focus. The selection is made based on the name of the exe file (no path) that is running.
This information can be obtained by enabling debug mode or -a commandline parameter, starting WinButtons, giving the required application focus, closing WinButtons and reading the last lines of the log file.
There's a list of the executable names that had focus during the lifetime of that WinButtons session.
Groups have 2 parameters:
group1=scite exename1=scite.exe
group<n> | The name of the group, to be used to identify the button-section. This name will be prefixed to '-Buttons' to find the correct set of buttons. So for this group to activate, a non-empty section [scite-Buttons] must be defined, listing a set of buttons as defined in the [Buttons] section readme. |
exename<n> | A comma-separated list of names of executables that should have focus to validate the context-switch to this button-group. The check is done non-case-sensitive. Application-exename(s) can be determined by starting WinButtons with -a commandline option, activvating the required app, closing WinButtons and retrieving the activated exename(s) from WinButtons-active-exes.log. It is also possible to trigger a group-switch by specific controls on a specific window of that exe, the format for the exename is: exename.exe[%["special window title"%]ControlName]. The (optional) window title can be specified like the special names in http://www.autoitscript.com/autoit3/docs/intro/windowsadvanced.htm in the section Advanced Window Descriptions. The ControlName can be specified as a regular expression, and should name the ClassnameNN value, as shown by the AutoIt Window Info tool. Usually these names as like Edit1, Edit2 etc. The regex would be Edit[1-3] for Edit1, Edit2 and Edit3. These names may not appear of be detectable in all Windows applications though. The regular expression syntax for these is explained in this page: http://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm and the full supported syntax over here: http://www.autoitscript.com/autoit3/pcrepattern.html |
If a group is used, some parameters from [Settings] can be overridden by setting them in that [<group>-buttons] section.
These overridable settings are: left, top, buttonwidth, buttonheight, buttonmargin, buttonrows, vertical, fontsize, color, textcolor and backcolor.
Variables can be defined in a [Variables] section, to be later used by other [Variables], [Settings] or [Buttons]/[<group>-Buttons] parameters or commands.
A variable could be defined like:
[Variables] Hello=Hello World! stdheight=60 stdwidth=2*:varStdHeight:
This variable can then be used in a command or caption, etc., by using a ":var" prefix and a ":" suffix, for example: :varhello: or :varStdWidth:
The :var prefix is required to be lowercase, variablenames are not case-sensitive.
The variables can be used in all configuration items that do _not_ resolve to an on/off value, like vertical or movable. Only numeric and string values get variables replaced.
An example configuration is included as copymenu.ini
Nested variables can be used, the replacement happens from inside out, like this example:
[Variables] stdheight=100 stdwidth=:varMultiply:varStdHeight:::varStdHeight: multiply40=4* multiply60=3* multiply100=2*
The use of :varStdWidth: resolves to: ":varMultiply:varStdHeight:::varStdHeight:"
The second iteration resolves to: ":varMultiply100:100"
The third iteration resolves to: "2*100"
Assigning this variable to buttonwidth in the [Settings] section, like below, will resolve to 200, as any calculation is also executed when reading numeric values from the configuration.
Example:
[Settings] buttonwidth=:varStdWidth:
Changing the value of stdheight to 60 will resolve in a buttonwidth of 180, and a stdheight of 40 results in buttonwidth=160.
Variables can also process parameters. An example:
[Variables] root=F:\Projecten\AutoIt\WinButtons\copytest rootx=. source1=:varRoot?1:\client\import dest1=:varRoot?1:\server\import filespec1=*.* source2=:varRoot:\server\import dest2=:varRoot:\client\import filespec2= source3=:varRoot:\client\export dest3=:varRoot:\server\export filespec3= source4=:varRoot:\server\export dest4=:varRoot:\client\export filespec4= command=:varCmd: :varSource?1=?2: :varDest?1=?2: :varFileSpec?1: :varParams: params=/E /MOV ?1 cmd=robocopy ; (Part of the Variables with parameters demo) [Buttons] button1=Copy IMPORT from &Client to Server i >> command1=-asc"Please confirm|:varCommand=1=x:":varCommand=1=x:
Parameter values are passed by using =<value> in the variable: :varCommand=1=x: passes values "1" and "x" when parsing variable Command. These parameters can be applied in the result by using ?<parameter number>, like: ?1 or ?2.
These passed values can again be used as parameter value by preceding them with "=", like: :varSource?1=?2: This results in variable Source1 being fetched (the first parameter to that variable), and passing x to Source1 (the second parameter passed from the command1 button).
In Source1 this value "x" is used to determine the requested Root variable, either Root or Rootx. If parameter 2 is not passed to Command, it defaults to an empty string.
Each button is required to have at least a, sequentially numbered, non-empty button<n>= value. If the text on a button should be empty, an empty caption<n>= value should be supplied.
[Buttons] button1= caption1= tooltip1= image1= command1= color1= textcolor1= buttonwidth1= buttonheight1= buttonarrangement1= fontsize1= condition1= conditionmode1= dropcommand1=
button<n> | The name of the button. If no caption<n> is supplied, this is also the text displayed on the button. & can be used to define a hotkey for that button, so button1=B&utton defines <Alt-U> as a hotkey for button 1. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
caption<n> | The caption to display on the button. If supplied it takes precedence over the standard button<n> value for display on the button. Allows an empty caption if defined as empty value. The same rules for hotkeys apply. Captions are wrapped if no color is used, as these attributes don't play nice together (yet). Environment variables can be used in a buttonid or a caption by using %env.variable%. The caption is also shown as a tooltip for each button, if no tooltip is defined. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
tooltip<n> | The tooltip to display for this button. Overrides the default 'caption' tooltip. AutoIt3 macros and variables can be used by enclosing them in @ or $, like @CRLF@ to insert a new-line. Full macro documentation in http://www.autoitscript.com/autoit3/docs/macros.htm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
image<n> | An optional icon (ico) or bitmap (bmp) file to display on the button. Doesn't allow for combination of icon/bitmap and text! If a hotkey is set using an & in the button or caption setting, then that hotkey is still enabled! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
command<n> |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dropcommand<n> |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
color<n> | Change the button surface color. Color values in rgb, most easy is to use hexadecimal notation with 0x prefix, like 0xff0000 for red. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
textcolor<n> | Change the caption color of the button, same notation as color<n> parameter. Colors can't currently be combined with a button image. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
buttonheight<n> | Change the height of this button only. If it's taller then the global buttonheight setting, then only this button will be taller, but all other buttons get a bigger margin. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
buttonwidth<n> | Change the width of this button only. If it's wider then the global buttonwidth setting, then only this button will be wider, but all other buttons get a bigger margin. If these values differ from the global buttonheight/buttonwidth values, then this button will be differently sized, and smaller button(s) will be centered in the available space. If a larger margin between buttons and/or the border is needed, then [Settings] value for buttonmargin should be increased, instead of giving all buttons a different size. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
buttonarrangement<n> |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
fontsize<n> | The size of the font in points, used for this button only. By default the [Settings] value of fontsize will be used, which defaults to 9pt. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
condition<n> |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
conditionmode<n> |
|