UIStuff plugin for Take Command / TCC / TCC/LE

beta version 0.80.0.4     2024-04-03

Charles Dye

Purpose:

This plugin adds a few miscellaneous user-interface features. You can get or set the screen resolution for any monitor, the wallpaper image and style, the desktop background color, the screen saver settings, and the master sound volume and mute state. You can create, modify, display, or parse shortcut files. You can display or set file associations and shell verbs.

This plugin might be useful for setting user defaults in a logon script, customizing freshly-imaged computers, or to temporarily change settings while running some particularly demanding program.

Windows XP or later is required.

Installation:

To use this plugin, copy the files UIStuff.dll and UIStuff.chm to some known location on your hard drive. (If you are still using the 32-bit version of Take Command, take UIStuff-x86.dll instead of UIStuff.dll.) Load the plugin with a PLUGIN /L command, for example:

plugin /l c:\bin\tcmd\test\uistuff.dll

If you copy this file to a subdirectory named PlugIns within your Take Command program directory, the plugin will be loaded automatically when TCC starts.

Plugin Features:

New commands:
BGCOLOR CONICON INSTALLFONTS LISTFONTS MINIMIZEALL
MKSC SCREENRES SCRNSAVER SETFOCUS SETMOUSEPOS
SHELLVERB SOUNDVOL UISTUFFHELP WALLPAPER
New functions:
@FIRSTFONT @IMGCOLOR @NEXTFONT @RGBCOMPL @RGBLUM
@SCINFO @SCREENRES @SHELLVERB @SHFOLDER
New variables:
_BGCOLOR _BGCOLORNAME _BROWSER _MOUSEX _MOUSEY
_MUTE _MUTED _SAFEMODE _SOUNDVOL _SSVRNAME
_SSVRTIME _SSVRUP _VOLUME _WALLPAPER _WALLSTYLE
_WINOSVER

Syntax Note:

The syntax definitions in the following text use these conventions for clarity:

BOLD CODEindicates text which must be typed exactly as shown.
CODEindicates optional text, which may be typed as shown or omitted.
Bold italicnames a required argument; a value must be supplied.
Regular italicnames an optional argument.
ellipsis…after an argument means that more than one may be given.

New Commands:

BGCOLOR — Display or change the desktop background color.

Syntax:
BGCOLOR /S color

/Ssave color to the registry
colorthe name or RGB value of the color to set

You may specify the color as a single RGB value in either hexadecimal (e.g. #8B4513) or decimal (9127187); as three separate values for red, green, and blue, in that order (0x8b 0x45 0x13 or 139 69 19); or as a W3C color name (SaddleBrown).

If you specify the color in hexadecimal with a leading # sign, it must be either three or six hex digits long. If it’s three digits long, each digit is doubled; #8ac is the same as #88aacc. Alternatively, you can use a leading 0x and the rules above do not apply; the number of digits is not significant.

The color change only affects the current session and will be lost at logout, unless /S is specified. Note that /S must be typed before any color name.

rem  Set the background color to dark slate gray:
bgcolor darkslategray


See also: the _BGCOLOR variable, which which reports the current background color as a hexadecimal value; the _BGCOLORNAME variable, which reports it as a W3C color name if possible; the @IMGCOLOR function, which returns the color of a pixel in a graphics file; and the @RGBCOMPL function, which returns a complementary color.



CONICON — Set the icon for the console window.

Syntax:
CONICON /C /D /I:n filename…

/Cuse the icon in TCC.EXE; equivalent to "%_cmdspec"
/Drestore the system default console icon
/I:nthe icon’s index within the file

This command is only useful in a standalone console window. Changes to the console icon in a Take Command tab are not visible.

rem  Show several different console icons:
for /l %i in ( 3, 1, 11 ) ( conicon "%@shfolder[37]\shell32.dll" /i:%i & delay 1 )
conicon /c



INSTALLFONTS — Install font files.

Syntax:
INSTALLFONTS /O /X filename…

/Ooverwrite existing files in the Fonts directory
/Xdelete source files after successful install
filename…the files to install

You must specify at least one filename. Wildcards are supported.

Matching files will be copied to C:\Windows\Fonts, and entries will be created in the registry.

This command requires elevation (‘Run as Administrator’). So far, I have only tested it with .TTF and .OTF files.

rem  Install fonts from the C:\Download directory:
installfonts c:\download\*



LISTFONTS — List available fonts.

Syntax:
LISTFONTS /C:charset /D:flags /F:family /P:pitch /T:type name

/C:charsetcharacter set; see below
/D:flagsdisplay extra info: L line numbers, F family and pitch, S script, T font type, K final count
/F:familyfilter by font family: R Roman (serif), S Swiss (sans-serif), M modern (unstressed), H hand (script), D decorative, N no family specified
/P:pitchfilter by pitch: F fixed pitch, V variable pitch
/T:typefilter by font type: R raster fonts, V vector fonts, O OpenType fonts, T TrueType fonts
namemay contain wildcards

LISTFONTS dumps a list of all matching fonts to standard output.

/C:charset lets you specify the character set to be supported. The default is 0, to list only fonts which include Western (Roman) letters.

0ANSI (Western — the default)
1don’t care
2symbol
128Shift JIS (Japanese)
129Hangul (Korean)
130Johab (Korean)
134GB 2312 (simplified Chinese)
136Big-5 (traditional Chinese)
161Greek
162Turkish
163Vietnamese
177Hebrew
178Arabic
186Baltic
204Cyrillic (Russian)
222Thai
238Eastern Europe
255OEM character set

listfonts *black*



MINIMIZEALL — Minimize or restore all windows.

Syntax:
MINIMIZEALL /U

/Uundo the previous MINIMIZEALL

rem  Minimize all windows for three seconds:
minimizeall & delay 3 & minimizeall /u



MKSC — Create, modify, or display a shortcut file.

Syntax: (to create or modify a shortcut file)
MKSC linkfile target /A:args /Bx:value /C:comment /D:directory /I:iconfile /J:index /K:key /M:mode /N:flags /U:level /Z

Syntax: (to display shortcut files)
MKSC linkfile /F:fields /N:flags /P /S

linkfilethe shortcut file to create, change, or display
targetthe filename or object that the shortcut points to
/A:argscommand-line arguments to be passed to the target
/Bx:valueset various console properties
/C:commenta descriptive comment
/D:directorythe default directory
/F:fieldsspecify which information to display
/I:iconfilefilename of an .EXE or .DLL file containing an icon
/J:indexnumber of the icon in iconfile to use; 0 = the first
/K:keya hotkey which can be used to launch the shortcut
/M:modethe suggested window mode: Normal, MINimized, or MAXimized
/N:flagsdisable features; flags may include:
C — disable highlighting (display mode only)
D — don’t canonicalize directory
E — suppress many error messages (display mode only)
H — don’t search into hidden subdirectories; only useful with /S
I — don’t canonicalize iconfile
J — don’t search into junctions; only useful with /S
T — don’t canonicalize target
Z — don’t search into system subdirectories; only useful with /S
/Ppage output
/Srecurse into subdirectories; only useful when displaying shortcuts
/U:levelthe UAC level: Normal or Elevated
/Zoverwrite read-only files

This command can be used for three different tasks: to create a new shortcut file, to modify an existing shortcut file, or to dump the contents of shortcut files to standard output.

Create a shortcut file:

You can create a new shortcut to a file or a folder; a TCC command, alias, or batch file; or one of a small number of Explorer objects. To create a shortcut, pass a filename for the new shortcut as the first argument, linkfile. The second argument, target, is required when creating a new shortcut; it specifies the file or object that the shortcut will open.

rem  Create a shortcut to the calculator:
mksc "%@shfolder[16]\Calculator.lnk" "%windir\system32\calc.exe" /k:control-alt-=


Other kinds of files are legal too. If the file is a document, Windows will use the registered program to open it. You can even create a shortcut to a directory:

rem  Create a shortcut to the Fonts folder:
mksc "%@shfolder[16]\Fonts.lnk" "%windir\Fonts"


To create a shortcut to an internal command, alias, or batch file, specify "%_cmdspec" as the target. Set args to either /C or /K followed by the desired command. (/C causes TCC to close immediately after running the command; /K keeps it open after the command finishes.) For instance, to create a shortcut which runs the command TIME /S, you might use:

rem  Create a shortcut to run TIME /S command:
mksc "%@shfolder[16]\Sync System Time.lnk" "%_cmdspec" /a:"/c time /s" /m:min


MKSC also recognizes a short list of Explorer objects. You can use any of the following as target:

<Desktop>the desktop
<Computer>the list of drives
<Documents>the default save location for many applications
<Music>the suggested save location for music files
<Pictures>the suggested save location for graphics files
<Video>the suggested save location for video files
<Printers>the list of printers
<Network>Network Neighborhood; LAN locations
<Connections>network interfaces
<Recycle Bin>deleted-but-recoverable files
<Control Panel>Windows configuration utilities
<Recent>list of shortcuts to recently-opened files
<SendTo>Explorer’s list of send-to locations

Note that all of the above must be quoted to protect the angle brackets. See Objects Supported for more information.

rem  Create a shortcut to My Computer:
mksc "%@shfolder[16]\My Computer.lnk" "<Computer>"


The linkfile should normally end in .LNK. If you do not specify an extension, MKSC will supply the extension by default. Directory aliases are supported in linkfile.

Target should name a file, directory, or one of the Explorer objects listed above. Directory aliases are supported, and the filename is automatically canonicalized (“truenamed”) when the shortcut file is created. If the target is not qualified at all — if it has no drive letter or directory — the plugin will search the path for a matching file. You can bypass canonicalization and the path search with /NC, which stores a non-canonical filename; doing this also disables directory aliases in target. Canonicalization will also be skipped if the target begins with a percent sign followed by a letter.


/A:args specifies the command-line arguments for a target program. Different programs support different arguments, and some ignore them altogether. See the program’s documentation for information about its command-line options.

/AX:args works like /AX:, but supports the use of C-style character escapes in the string. If you need problematic characters like double quotes or backquotes in the arguments list, you can use /AX: with escapes like \q or \k. Note that any backslashes in the arguments must be doubled.


/C:comment specifies a descriptive comment to be stored in the shortcut file. Explorer can display this comment in a tooltip when you hover the mouse pointer over the shortcut icon.

/CX:comment works like /C:, but expands C-style character escapes in the comment. If you need a backslash in the comment, you must double it.


/D:directory sets the starting directory for the target program. Some programs use this as a default directory; others ignore it. The directory is canonicalized, and directory aliases are supported. You can use /ND to store a non-canonicalized filename; this will also disable directory aliases in directory. If you give a directory of *, MKSC will choose an appropriate directory based on target: the parent directory if target is a filename, target itself if it names a directory, and nothing if target names an object. If the directory begins with a percent sign followed by a letter, canonicalization will be disabled automatically. If the directory is a ~ or begins with ~\, the tilde will automatically be replaced with the string %USERPROFILE%; this also will disable canonicalization.

/M:mode sets the default window state for the target program. Most programs will honor this option, but a few set their own window size at startup; /M won’t appear to affect these. Mode should be one of Normal, MINimized, or MAXimized; case is not significant, and only the letters shown in uppercase are required.

/K:key specifies a hotkey which can be used to launch the target with a keystroke. The exact requirements for this feature to work don’t seem to be documented anywhere. For best results, I suggest that (1) the shortcut file should be created in the user’s desktop directory; and (2) the hotkey should be in the form Control-Alt-letter, Control-Alt-digit, or Control-Alt-Numdigit. See Hotkeys for a list of the hotkey names supported by this command; note that some of them differ from the names used by KEYSTACK. You can also specify a hotkey of None, which will remove any hotkey associated with the shortcut.

/I:iconfile and /J:index specify the icon which Explorer uses to display the shortcut. When creating a shortcut, you should specify both or neither. When modifying an existing shortcut file, you can use /J:index alone to select a different icon within the same iconfile.

/U:level sets the UAC level for the shortcut; level is either Normal or Elevated (only the first letter is significant). If it’s not specified, the default level is Normal. This option has no effect under Windows XP.


Console properties:

MKSC allows you to set or change many of the console properties stored in a shortcut. Setting console properties for things that don’t run in a console window is possible, but pointless. Console properties options all start with /B.


/BB:n sets the console font’s weight. n is 400 for normal, 700 for bold.

/BF:font set the console font’s name. Quote it if it contains spaces. If font doesn’t match the name of an actual font, or if it isn’t suitable for use in a console window, Windows will substitute some other font at random — generally the ugliest available.

/BG:x,y sets the desired size of the console font. x is the width, and y is the height. If you’re using a TrueType font, the width is not relevant and may be set to 0.

/BB, /BF, and /BG all affect the console font. If you want to set one of them, it’s probably a good idea to set all three.


/BA:n sets the console’s auto-position option. 0 disables auto-positioning; the console window will open at the screen position specified in the “Layout” tab. 1 allows the system to position the window automatically; the coordinates in the “Layout” tab will be ignored.

/BC:n sets the cursor size. n is a percentage, 10 to 100. (This setting does not affect TCC, which sets its own cursor size.)

/BD:n set the console’s default colors. You may specify the new value either as decimal, or hexadecimal with a leading 0x. The usual value is 0x0007, white on black.


/BHn:color lets your redefine the console palette. n is the color index, 0 (black) through 15 (bright white). Color is a W3C color name or an RGB value. You may give a name, or a three- or six-digit hex value preceded by a number sign. For example, you could use either /BH7:ORANGE or /BH7:#FFA500 to redefine ‘white’ as orange.

You can give more than one color name, separated by commas or semicolons, to define multiple consecutive colors. For example, /BH0:#000,#009,#090,#099,#900 would set values for black, blue, green, cyan, and red.


/BI:n sets the console’s insert mode. 0 disables insert (the console defaults to overtype mode); 1 enables it. (This setting does not affect TCC, which has its own default edit mode settings.)

/BO:x,y sets the console window’s starting screen position (its origin). Using this option automatically disables the auto-position option, as if /BA:0 had been specified.

/BP:n set the console’s “popup” colors. You may specify the new value either as decimal, or hexadecimal with a leading 0x. (TCC does not use these colors for anything; CMD.EXE uses them for its command history popup.)

/BQ:n sets the console’s QuickEdit mode. 0 disables QuickEdit, 1 enables it.


/BS:x,y sets the size of the console scrollback buffer. x is the width and y is the height.

/BS also has an optional third argument to set the height of the visible window: /BS:x,y,h. The height h must be between 5 and 100, and not greater than the screen buffer height y. If you do not specify h, the plugin will supply a reasonable value.

Modify a shortcut file:

To modify an existing shortcut file, the syntax is the same, except that the target parameter is optional. You don’t have to specify a target when changing an existing shortcut, and you probably shouldn’t.

Display shortcut files:

To display the contents of shortcut files, specify only a linkfile. It may contain wildcards to dump multiple shortcut files, and you can use /S to recurse into subdirectories. To prevent MKSC from searching into junctions, use /NJ; to skip hidden subdirectories, use /NH; to skip system subdirectories, use /NZ. If linkfile names a directory, all .LNK files in that directory will be shown.

You can use /F:fields to choose which fields to display. Fields is letters:

Tthe link target
Acommand-line arguments
Dstartup directory
Khotkey
Ccomment
Mstart mode
Iicon filename and index
UUAC level (only under Vista and later)
Nnormal (default) fields; short for TADKCMIU
Bconsole screen buffer info, if available
Fconsole font info, if available
Hthe console palette, if available

If no fields are specified, the default is TADKCMIU.


/P causes MKSC to pause after each screenful of data.

mksc /s "%@shfolder[23]"



• Note: You must quote any argument containing spaces, angle brackets, or any other special characters.


See also: the @SCINFO function, which returns values from a shortcut file, and the @SHFOLDER function, which returns the pathname to a folder.



SCREENRES — Display or change the screen resolution.

Syntax:
SCREENRES /A /C:bits /D /L /M:monitor /NR /Q /R:rate /X:width /Y:height

/Ashow resolution for all monitors
/C:bitschange the color depth
/Ddon’t save new settings in the registry
/Llist available display modes
/M:monitorzero-based number of the monitor to display or change
/NRno report on a successful change
/Qdo not prompt for confirmation when making changes
/R:ratechange the refresh rate
/X:widthchange the display width
/Y:heightchange the display height

Specifying any of /C:bits, /R:rate, /X:width, or /Y:height will change the display settings. If you use /X:width you should also supply a /Y:height, and vice versa. If you don’t supply a /M:monitor, the primary monitor will be changed.

If you make any changes to the display settings without specifying /Q, SCREENRES will prompt you to enter a random three-digit number to verify that you can still read the display. If you don’t enter the same number within fifteen seconds, the display will revert to its previous settings.

rem  Set the primary monitor to 1280 by 1024 pixels:
screenres /x:1280 /y:1024


Option /L will cause SCREENRES to list available display modes, instead of setting or displaying the current mode. The primary monitor will be shown by default, unless you specify a different one with /M:monitor or use /A to list available modes for all monitors. If you combine /L with any of /X:width, /Y:height, /C:bits, or /R:rate, the list will only include modes matching the specified values. Note that just because a display mode is listed as available does not mean that your monitor is capable of displaying it!


See also: the @SCREENRES function, which returns information about the current display settings.



SCRNSAVER — Display or change the screen saver settings.

Syntax:
SCRNSAVER /A /D /E /N /S /T:timeout /U filename

/Aactivate (run) the screen saver
/Ddisable the screen saver
/Eenable the screen saver
/Nno screen saver
/Ssecure (show login screen when the screen saver is dismissed)
/T:timeoutidle time before the screen saver is started
/Uunsecure (no login screen)
filenamethe screen saver filename; must end in .SCR

If the filename does not have a path, the Windows system directory will be assumed. If it does not have an extension, .SCR will be appended automatically.

The timeout may be specified either in seconds, or in mm:ss format (or even hh:mm:ss for extremely long delays.) /T:300 is the same as /T:5:00. The maximum timeout value is 24 hours (86400 seconds).

If /A is specified, the selected screen saver will be run after any settings changes.

rem  Run "Mystify" after 5 minutes of inactivity:
scrnsaver /e /t:5:00 mystify.scr


See also: the _SSVRNAME and _SSVRTIME variables, which return the current screen saver filename and timeout respectively.



SETFOCUS — Give focus to the specified window.

Syntax:
SETFOCUS /C:class /Q "title"

/C:classthe window class name
/Qquietly
titlethe caption of the window to focus

The title and class names may contain wildcards. If no title or class is specified, TCC will be given the focus.

Note that the title must be the last option on the command line.

Under some versions of Windows, “stealing” the focus from another window is subject to privilege levels. You may not be able to move the focus away from an administrative window such as the Registry Editor unless TCC is also running with administrative privileges.



SETMOUSEPOS — Move the mouse pointer to the specified screen coordinates.

Syntax:
SETMOUSEPOS /Q /X:x /Y:y

/Qquietly
/X:xthe new horizontal position
/Y:ythe new vertical position

This command might be useful on a kiosk system which just displays web pages. If you don’t want the mouse cursor to be visible, move it to the lower-right corner with:

setmousepos /x:%@dec[%@screenres[,X]] /y:%@dec[%@screenres[,Y]]

The range of valid coordinates will depend on your screen size.



SHELLVERB — Display or change file associations and shell verbs.

Syntax:
SHELLVERB /C /D:string /M:string /Q /R /S /T:ftype /U /V:verb /Z ftype=command

/Creplace any safechars in command with ASCII
/D:stringdescriptive name for the file type; shown in Explorer
/M:stringdescriptive name for the verb, used in menus
/Qdo it quietly
/Rremove file association or shell verb
/Sdisplay or change system-wide settings (the default)
/T:filetypespecify the file type; only useful when ftype is an extension
/Udisplay or change per-user settings
/V:verbthe shell verb to display or change
/Zmake the specified verb the default
ftypemay be either an extension or a descriptive file type
commandthe command Windows should execute for the specified verb

This command can display or change file associations and “shell verbs” — the actions that Explorer can perform on a file. It can be used as a combination of the ASSOC and FTYPE commands, but it can also display and customize file types in ways that ASSOC and FTYPE cannot.

Windows Explorer uses a two-layer approach in determining how to work with a file. The extension (the final part of the filename, everything after the last period) is mapped to a file type, and the file type in turn has various actions associated with it. For example, a file named ReadMe.txt has the extension TXT, which maps to the file type “txtfile”. The file type txtfile then has certain actions defined — Open, Print. This command’s ftype parameter may be either an extension (beginning with a period), or else a descriptive file type. If ftype is an extension, SHELLVERB will automatically use the associated file type, or else create a new one.

Complicating matters further, Windows actually keeps multiple sets of file-association info: one set of system-wide file associations which applies to all users; and a per-user set of associations for each user, allowing him to override the system-wide settings. SHELLVERB can list or change either set. Specify /S to work with the system-wide file assocations, or /U to use the current user’s personal assocations. You can use both together. If you don’t specify either /S or /U, /S is the default.


To display the file type and actions associated with an extension, just type SHELLVERB followed by the extension. Note that the extension should begin with a period:

shellverb .txt

You can also use wildcards in the extension:

shellverb .htm*

If the ftype does not begin with a period, it’s interpreted as a file type instead. (Wildcards don’t work in this format.)

shellverb regfile


Notice that most file types have an “Open” verb. This verb is used to open, edit, or play a file, typically by double-clicking on its icon. You can use the =command syntax to set the command used to open a file. For example, if we want all .ZZZ files to open in Notepad:

shellverb .zzz=notepad.exe "%%1"

Note the use of "%1" as a placeholder for the filename in the command string. (Double the percent sign to prevent TCC’s variable expansion from expanding the variable reference before the SHELLVERB command gets it.)

You can set the command for other verbs with the /V: option:

shellverb /v:print .zzz=notepad.exe /p "%%1"

If you don’t specify /V:verb, the Open verb will be used by default. If you specify /V (without any verb), the default verb will be used; this is usually Open, but not always.


If you examine the .REG extension with

shellverb .reg

you’ll see that the Open verb has an alternate name: Mer&ge. I call this the verb’s “menu name”. This is generally done for one of two reasons: to give the command a more intuitive name (Merge instead of Open), or to set an accelerator key (the ampersand makes the G an accelerator key). You can set the menu name for a verb using the /M: option:

shellverb /v:Open /m:"&Edit" .zzz=notepad.exe "%%1"

creates an Open verb for .ZZZ files, which will appear as Edit (hotkey E) in the context menu.


The default verb, the one used when double-clicking on a file’s icon, is marked with an asterisk. Usually, but not always, this is Open. You can set the default verb with /Z:

shellverb /z /v:edit .reg

Now double-clicking on a .REG file will open it in Notepad, rather than trying to install it using RegEdit. /Z requires that you specify the verb to make the default with /V:; in fact you can combine the two options:

shellverb /z:edit .reg


You can set the descriptive name for a file type (shown in Explorer) with /D:string. Use /D: alone, without a string, to remove the descriptive name. Note that new or changed descriptions usually don’t take effect until Explorer restarts — after you reboot or log out.

shellverb /d:"Configuration file" .cfg


When ftype is an extension (i.e., when it begins with a period), SHELLVERB automatically supplies the appropriate file type, either using the file type already associated with that particular extension, or else creating a file type from the extension. For example, if you supply a ftype of .ZZZ and there is no file type associated with that extension, then SHELLVERB will create a new file type “zzzfile”. This is usually the desired behavior. However, on rare occasion you may want to associate an extension with some other file type; /T:filetype allows this. /T essentially replicates the functionality of the ASSOC command; however, you can combine it with other options to, say, associate an extension with a file type, set a description for the new file type, and define an Open verb, all in one command.

shellverb /t:TCC.Batch .btm


To remove an extension’s association with a file type:

shellverb /r .zzz

To remove a verb from a file type:

shellverb /r /v:print .zzz

To remove a file type altogether: (Warning — this deletes an entire tree from the registry, and cannot be undone!)

shellverb /r zzzfile

Note that SHELLVERB /R ZZZFILE deletes a file type and all the information associated with it (the description and all its defined verbs), while SHELLVERB /R .ZZZ merely breaks the connection between the extension and the file type. Usually the latter is to be preferred.

If you use /R to remove something, you will be prompted first. Use /Q to suppress the prompt and perform the action immediately. /Q also prevents the report that you get after making other changes.


If you specify /C, any characters in the command in the range U+FF01 through U+FF5E will be replaced with ASCII equivalents. For example, you can include an %@CHAR[0XFF05] in the command, and /C will translate it to a percent sign. This can be handy when copying shell verbs using the @SHELLVERB function.


Putting it all together, we can define a new file type for .BTM files, describe it, and define some basic shell verbs:

rem  Create a new file type for .BTM files:
shellverb /t:btmfile /d:"Take Command batch file" .btm

rem  Create an Open verb to run .BTM files:
shellverb /m:"R&un" .btm="%_cmdspec" /c "%%1"

rem  Create an Edit verb to edit them like .TXT files:
shellverb /c /v:Edit .btm=%@shellverb[.txt,open,128]

rem  Create a Print verb to print them using Notepad:
shellverb /v:Print .btm=notepad.exe /p "%%1"

rem  If BDEBUGGER is available, create a Debug verb:
iff isinternal bdebugger then
    shellverb /v:Debug /m:"Debu&g" .btm="%_cmdspec" /c bdebugger "%%1"
endiff


See also: the @SHELLVERB function, which returns the command string for the given shell verb.



SOUNDVOL — Display or change the master sound volume.

Syntax:
SOUNDVOL /B /M /O /Q /U volume

/Bbeep after changing settings
/Mmute the sound
/Odisplay the current settings on-screen
/Qquietly
/Uunmute the sound
volumenew volume level, 0 — 100

If /Q is not specified, the current volume will be displayed.

rem  Crank it all the way up:
soundvol 100


See also: the _VOLUME and _MUTE variables, which return the current master sound volume and mute state respectively.



UISTUFFHELP — Open the UIStuff plugin help file.

Syntax:
UISTUFFHELP /C /F /S /S:text /V topic

/Cselect the ‘Contents’ tab
/Fselect the ‘Favorites’ tab
/Sselect the ‘Search’ tab
/S:textselect the ‘Search’ tab and search for text
/Vshow detailed plugin version info
topicthe page to display

The UISTUFFHELP command will locate and open this plugin’s help file. In most cases, the internal HELP command, and the F1 and Ctrl-F1 keys, will be more convenient. The main advantage of this command is that it can be used to open the help file to any desired topic, not only to the names of commands, functions, and variables.

Note that any /C /F or /S must precede any topic on the command line. (This command has a very simple-minded parser.)



WALLPAPER — Display or change the desktop wallpaper.

Syntax:
WALLPAPER /B /C /N /R /S /T filename

/Bbest style
/Ccenter the wallpaper
/Nno wallpaper
/Rrecursive
/Sstretch the wallpaper
/Ttile the wallpaper
filenamea graphics file to display on the desktop

The filename specifies a graphics file with an extension of .BMP, .JPG, .JPEG, .PNG, .GIF, .TIF, or .TIFF. Alternatively, it may name a directory which contains graphics files of those types, in which case WALLPAPER will pick one at random. Directory aliases are supported in filename.

If there is a bitmap on the clipboard, you can use it as wallpaper by specifying a filename of CLIP:

/B chooses a style automatically, based on the image size and the primary monitor’s resolution. Small images (not more than a quarter of the screen width or a third of the screen height) will be tiled. Larger images (at least 60% of the screen width) with a similar width/height ratio to the screen’s will be stretched to fit. All others will be centered.

/N removes any wallpaper.

If no arguments are specified, the current filename will be displayed.

rem  Tile the background with "Santa Fe Stucco.bmp":
wallpaper /t "c:\windows\santa fe stucco.bmp"

rem  Pick a random image file from the user's Pictures folder:
wallpaper /b /r "%@shfolder[39]"


• Note: Setting the wallpaper under Windows Vista or Windows 7 will disable any slide show.


See also: the _WALLPAPER and _WALLSTYLE variables, which return the current wallpaper filename and display style respectively.

New Functions:

@FIRSTFONT — Returns the name of the first matching font.

Syntax:
%@FIRSTFONT[name,charset,type,pitch-and-family]

namemay contain wildcards
charsetsee below
typeone of: R raster fonts, V vector fonts, O OpenType fonts, or T TrueType fonts
pitch-and-familyone of: R Roman, S Swiss, M modern, H hand (script), D decorative, or N no family;
    and/or one of: F fixed pitch, or V variable pitch

If no matching font is found, @FIRSTFONT returns an empty string. If a matching font is found, its name is returned, and you can continue enumerating fonts with @NEXTFONT.

Supported charset values include:

0ANSI (Western — the default)
1don’t care
2symbol
128Shift JIS (Japanese)
129Hangul (Korean)
130Johab (Korean)
134GB 2312 (simplified Chinese)
136Big-5 (traditional Chinese)
161Greek
162Turkish
163Vietnamese
177Hebrew
178Arabic
186Baltic
204Cyrillic (Russian)
222Thai
238Eastern Europe
255OEM character set

rem   List available script fonts:

set font=%@firstfont[,,,h]
do while defined font
   echo %font
   set font=%@nextfont[]
enddo



@IMGCOLOR — Returns the color of a pixel in an image file.

Syntax:
%@IMGCOLOR[filename,position]
%@IMGCOLOR[filename,x,y]

filenamethe image file to examine
positionwhich pixel’s color to return:
   1 — the top left
   2 — the top center
   3 — the top right
   4 — the center left
   5 — the center of the image
   6 — the center right
   7 — the bottom left
   8 — the bottom center
   9 — the bottom right
x,ythe coordinates of the pixel to return

The filename specifies a graphics file with an extension of .BMP, .JPG, .JPEG, .PNG, .GIF, .TIF, or .TIFF. Directory aliases are supported in filename.

If you do not specify a position or x,y coordinates, the default is to grab the pixel at the center. The x and y values may be decimal, or hexadecimal with a leading 0x. If x is negative, it is interpreted as pixels from the right edge; a negative y is pixels up from the bottom.

The selected pixel’s color is returned as a six-digit hexadecimal value, #rrggbb; for example, #5b6d85. It can be used as the color argument to the BGCOLOR command.

rem  Set the background color to match the wallpaper:
if "%_wallpaper" ne "*none*" bgcolor %@imgcolor["%_wallpaper"]


See also: the BGCOLOR command, which sets the background color; the @RGBCOMPL function, which returns a complementary color; and the @RGBLUM function, which returns a luminance value for a given color.



@NEXTFONT — Returns further matching font names.

Syntax:
%@NEXTFONT[]

This function continues an enumeration started with @FIRSTFONT. When there are no more matching fonts, @NEXTFONT returns an empty string.



@RGBCOMPL — Returns a complementary color.

Syntax:
%@RGBCOMPL[color,rotate]

colormay be specified as #rrggbb or as a W3C color name.
rotatedegrees to rotate the color’s hue; defaults to 180

If you specify the color in hexadecimal with a leading # sign, it must be either three or six hex digits long. If it’s three digits long, each digit is doubled; #8ac is the same as #88aacc. Alternatively, you can use a leading 0x and the rules above do not apply; the number of digits is not significant.

The input color is plotted on a color wheel, and the color opposite (180° around, or according to rotate) is returned. The resulting color is returned as a six-digit hexadecimal value, #rrggbb; for example, #5b6d85. It can be used as the color argument to the BGCOLOR command.

rem  Set the background color to contrast with the wallpaper:
if "%_wallpaper" ne "*none*" bgcolor %@rgbcompl[%@imgcolor["%_wallpaper"]]


See also: the BGCOLOR command, which sets the background color; the _BGCOLOR variable, which returns the current background color; and the @IMGCOLOR function, which returns a color from a graphics file.



@RGBLUM — Returns a luminance value for a color.

Syntax:
%@RGBLUM[color]

colormay be specified as #rrggbb or as a W3C color name.

If you specify the color in hexadecimal with a leading # sign, it must be either three or six hex digits long. If it’s three digits long, each digit is doubled; #8ac is the same as #88aacc. Alternatively, you can use a leading 0x and the rules above do not apply; the number of digits is not significant.

A luminance value from 0 (darkest) to 1000 (brightest) is returned. You can use this to pick a contrasting color. For example, if a background has a luminance of less than 500, white would make a good contrasting color for text; if it’s at least 500, then black would be a better choice.

The three color channels are given different weights: green is 58.7% of the luminance value, red is 29.9%, and blue is 11.4%.

rem  Is yellow bright or dark?
if %@rgblum[yellow] ge 500 ( echo It's bright! ) else ( echo It's dark! )


See also: the _BGCOLOR variable, which returns the current background color; and the @IMGCOLOR function, which returns a color from a graphics file.



@SCINFO — Returns values from a shortcut file.

Syntax:
%@SCINFO[filename,field]

filenamethe file to examine
fieldwhich field to return:
0the target filename or object name (default)
1the command-line arguments
2the working directory
3the descriptive comment
4the hotkey
5the startup window mode
6the icon filename
7the icon index
8the UAC level
32the width of the console screen buffer
33the height of the console screen buffer
34the width of the visible window
35the height of the visible window
36the console font name
37the font width in pixels (may be 0 for TrueType fonts)
38the font height in pixels
39the font weight: 400 = normal, 700 = bold
40the cursor size: 25 = small, 100 = large
41QuickEdit mode: 0 = disabled, 1 = enabled
42auto position window: 0 = disabled, 1 = enabled
43insert mode: 0 = overstrike, 1 = insert
44default console colors as hex, e.g. 0x0007 = white on black
45console popup colors as hex, e.g. 0x00F5 = magenta on bright white
46console window position (if auto position is disabled) as x,y

†   Console property. If the shortcut does not contain a console properties block, @SCINFO will return -1.

The filename is required. Quote it if is contains commas or other special characters. Wildcards are not allowed, but directory aliases are supported.

If field is 0 or absent, @SCINFO will attempt to return the shortcut’s target. The return value will be quoted. It may be empty if the target is an object which the plugin doesn’t recognize.

A field of 1, 2, or 3 returns the shortcut’s command-line arguments, working directory, or description, respectively. These return values are all quoted; any of them may return an empty string if the respective field is not defined in the shortcut.

A field of 4 returns the shortcut’s hotkey. This value is not quoted. It will return None if the shortcut has no hotkey defined.

A field of 5 returns the shortcut’s startup window mode. This value is not quoted; possible values are Normal, Maximized, and Minimized.

Values of 6 and 7 return the shortcut’s icon filename and offset, respectively. The filename will be quoted. If there is no icon, the filename will be empty and the index will be 0.

If field is 8, the shortcut’s UAC level will be returned; possible values are Normal and Elevated. (Under Windows XP and earlier, the value is always Normal.) The returned string is not quoted.


If you add 256 to the field number, the return string will not be automatically quoted. If you add 512, the return string will be escapified.

rem  Read info from a shortcut file:
set shortcut="%userprofile\desktop\test.lnk"
set target=%@scinfo[%shortcut,0]
set args=%@scinfo[%shortcut,1]
set dir=%@scinfo[%shortcut,2]


See also: the MKSC command, which creates, modifies, or displays shortcut files.



@SCREENRES — Returns the current settings for the specified monitor.

Syntax:
%@SCREENRES[monitor,info]

monitorzero-based number of the monitor to examine
infowhat to return:
 0 or I — all info in one long string
 1 or X — screen width (pixels)
 2 or Y — screen height (pixels)
 3 or C — color depth (bits per pixel)
 4 or R — refresh rate (Hz)
 8 or T — horizontal and vertical only

If you do not specify a monitor, the primary monitor will be examined by default.

Instead of a number, you may specify the info to return as a letter or word; only the first letter is significant.

rem  Get display settings for the primary monitor:
set screenwidth=%@screenres[,1]
set screenheight=%@screenres[,2]
set screenbpp=%@screenres[,3]


See also: the SCREENRES command, which displays or changes the current screen resolution.



@SHELLVERB — Returns the command string for the specified shell verb.

Syntax:
%@SHELLVERB[ftype,verb,flags]

ftypeeither an extension or a descriptive file type
verbif omitted, the default verb is used
flagsbitmapped:
 1 — user-specific file association
 2 — systemwide file association
 128 — map dangerous characters to SafeChars

Verb must be the actual verb name, not its cosmetic or “menu” name.

If bit 7 of flags is set, the following characters in the command string will be replaced with high-order Unicode equivalents:

Character:ASCII:Remapped to:
percent sign%37 / 0x25U+FF05
ampersand&38 / 0x26U+FF06
open parenthesis(40 / 0x28U+FF08
close parenthesis)41 / 0x29U+FF09
less-than sign<60 / 0x3CU+FF1C
greater-than sign>62 / 0x3EU+FF1E
open bracket[91 / 0x5BU+FF3B
close bracket]93 / 0x5DU+FF3D
caret^94 / 0x5EU+FF3E
grave accent / backquote`96 / 0x60U+FF40
vertical bar¦124 / 0x7CU+FF5C

If the extension, filetype, verb, or command string is unknown, this function returns the string *ERROR*.

See also: the SHELLVERB command, which displays or changes file associations and shell verbs.



@SHFOLDER — Returns the full pathname of a Windows special folder.

Syntax:
@SHFOLDER[n]

This function works much the same as the internal function of the same name. However, it can accept the index n as decimal, hexadecimal, or a descriptive CSIDL name. Also, error checking is tighter; if you pass this @SHFOLDER something it doesn’t understand, it will complain.

Not all values of n refer to actual directories, and not all values are supported under all versions of Windows. If you pass a value which doesn’t work on your system, this function will return an empty string.

When using the symbolic names, case is not significant, spaces and underscores are ignored, and you may omit the leading CSIDL_; “My Music” is equivalent to CSIDL_MYMUSIC.


DecHexNameReturns:
00x00CSIDL_DESKTOPthe desktop
20x02CSIDL_PROGRAMSthe user’s “Programs” menu
50x05CSIDL_PERSONALthe user’s “Documents” folder
60x06CSIDL_FAVORITESthe user’s “Favorites” folder
70x07CSIDL_STARTUPthe user’s “Startup” programs folder
80x08CSIDL_RECENTshortcuts to the user’s recently opened files
90x09CSIDL_SENDTOthe user’s “Send To” shortcuts
110x0bCSIDL_STARTMENUthe user’s Start menu
130x0dCSIDL_MYMUSICthe user’s “Music” folder
140x0eCSIDL_MYVIDEOthe user’s “Videos” folder
160x10CSIDL_DESKTOP­DIRECTORYthe user’s Desktop folder
190x13CSIDL_NETHOODthe user’s network shortcuts
200x14CSIDL_FONTSthe system fonts directory
210x15CSIDL_TEMPLATESthe user’s templates folder
220x16CSIDL_COMMON_­STARTMENUStart menu for all users
230x17CSIDL_COMMON_­PROGRAMS“Programs” menu for all users
240x18CSIDL_COMMON_­STARTUP“Startup” programs folder for all users
250x19CSIDL_COMMON_­DESKTOP­DIRECTORYDesktop folder for all users
260x1aCSIDL_APPDATAthe user’s application data folder
270x1bCSIDL_PRINTHOODthe user’s printer shortcuts
280x1cCSIDL_LOCAL_­APPDATAthe user’s local applications data
290x1dCSIDL_ALTSTARTUPthe user’s nonlocalized Startup folder
300x1eCSIDL_COMMON_­ALTSTARTUPnonlocalized Startup folder for all users
310x1fCSIDL_COMMON_­FAVORITES“Favorites” folder for all users
320x20CSIDL_INTERNET_­CACHEthe user’s Internet Explorer cache
330x21CSIDL_COOKIESthe user’s Internet Explorer cookies
340x22CSIDL_HISTORYthe user’s Internet Explorer history
350x23CSIDL_COMMON_­APPDATAapplication data for all users
360x24CSIDL_WINDOWSthe Windows directory
370x25CSIDL_SYSTEMthe Windows system directory
380x26CSIDL_PROGRAM_­FILESdefault location for applications
390x27CSIDL_MYPICTURESthe user’s “Pictures” folder
400x28CSIDL_PROFILEthe user’s profile directory
410x29CSIDL_SYSTEMX86x86 system directory on x64 Windows
420x2aCSIDL_PROGRAM_­FILESX86x86 applications on x64 Windows
430x2bCSIDL_PROGRAM_­FILES_­COMMONshared application components
440x2cCSIDL_PROGRAM_­FILES_­COMMONX86shared x86 app components on x64 Windows
450x2dCSIDL_COMMON_­TEMPLATEStemplates folder for all users
460x2eCSIDL_COMMON_­DOCUMENTSdocuments folder for all users
470x2fCSIDL_COMMON_­ADMINTOOLS“Administrative tools” folder for all users
480x30CSIDL_ADMINTOOLSthe user’s “Administrative tools” folder
530x35CSIDL_COMMON_­MUSIC“Music” folder for all users
540x36CSIDL_COMMON_­PICTURES“Pictures” folder for all users
550x37CSIDL_COMMON_­VIDEO“Video” folder for all users
560x38CSIDL_RESOURCESthe system resources directory
590x3bCSIDL_CDBURN_­AREAused for burning CDs

New Variables:

_BGCOLOR — Returns the desktop background color.

Syntax:
%_BGCOLOR

The color will be returned as a six-digit hexadecimal number with a leading # sign.

rem  Save the current background color:
set backcolor=%_bgcolor


See also: the BGCOLOR command, which sets or displays the background color; and the _BGCOLORNAME variable, which reports it as a W3C color name if possible.



_BGCOLORNAME — Returns the desktop background color as a W3C color name.

Syntax:
%_BGCOLORNAME

If no matching name is found, the color will be returned in hexadecimal, the same as _BGCOLOR.

rem  Save the current background color:
set backcolor=%_bgcolorname


See also: the BGCOLOR command, which sets or displays the background color; and the _BGCOLOR variable, which reports it as a hexadecimal number.



_BROWSER — Returns the filename of the default web browser.

Syntax:
%_BROWSER

The filename will be returned in double quotes. On any error, this function returns an empty string.

rem  Make a shortcut to open Google in the default browser:
mksc "%@shfolder[16]\Google.lnk" %_browser /a:http://www.google.com/



_MOUSEX — Returns the current horizontal position of the mouse pointer.

Syntax:
%_MOUSEX

This variable might be useful with SETMOUSEPOS if you want to move the mouse pointer relative to its current position.

The range of possible return values depends on your monitor size.



_MOUSEY — Returns the current vertical position of the mouse pointer.

Syntax:
%_MOUSEY

This variable might be useful with SETMOUSEPOS if you want to move the mouse pointer relative to its current position.

The range of possible return values depends on your monitor size.



_MUTE — Returns the master sound mute state.

Syntax:
%_MUTE

The value returned is 1 if the sound is muted, or 0 otherwise.

rem  Check whether the audio is muted:
if %_mute == 1 echo The audio is muted!


See also: the SOUNDVOL command, which sets the master sound volume and mute state; and the _VOLUME variable, which returns the current volume.



_MUTED — Returns the master sound mute state.

Syntax:
%_MUTED

The value returned is 1 if the sound is muted, or 0 otherwise.


•  Note: This is the old name of the _MUTE variable, retained for backward compatibility with older versions of this plugin. Please use _MUTE instead. _MUTED may disappear in future versions of UIStuff.



_SAFEMODE — Indicates whether Windows was started in safe mode.

Syntax:
%_SAFEMODE

The documented return values are:

0Normal boot
1Clean boot
2Clean boot with network support


_SOUNDVOL — Returns the master sound volume level.

Syntax:
%_SOUNDVOL

The value returned is in the range 0 through 100.


• Note: This is the old name of the _VOLUME variable, retained for backward compatibility with older versions of this plugin. Please use _VOLUME instead. _SOUNDVOL may disappear in future versions of UIStuff.



_SSVRNAME — Returns the filename of the current screen saver.

Syntax:
%_SSVRNAME

If no screen saver is defined, the value returned is *None*. Note that the returned filename will be quoted.

rem  Get the current screen saver filename:
set screensaver=%_ssvrname


See also: the SCRNSAVER command, which configures the screen saver; and the _SSVRTIME variable, which returns the current screen saver timeout value.



_SSVRTIME — Returns the current screen saver timeout, in seconds.

Syntax:
%_SSVRTIME

rem  Get the current screen saver timeout:
set timeout=%_ssvrtime


See also: the SCRNSAVER command, which configures the screen saver; and the _SSVRNAME variable, which returns the current screen saver filename.



_SSVRUP — Indicates whether the screen saver is currently running.

Syntax:
%_SSVRUP

The return value is 1 if the screen saver is currently running, 0 if it is not.

rem  Check whether the screen saver is running:
if "%_ssvrup" == "1" echo You can't read this yet (%_time).


See also: the SCRNSAVER command, which can be used to start the screen saver.



_VOLUME — Returns the master sound volume level.

Syntax:
%_VOLUME

The value returned is in the range 0 through 100.

rem  Display the current master volume level:
echo The master sound volume is at %_volume%%%.


See also: the SOUNDVOL command, which sets the master sound volume and mute state; and the _MUTE variable, which returns the current mute state.



_WALLPAPER — Returns the filename of the current desktop wallpaper.

Syntax:
%_WALLPAPER

If no wallpaper is defined, the value returned is *None*. Note that the returned filename will be quoted.

rem  Get the current wallpaper filename:
set wallpaper=%_wallpaper


• Note: If the wallpaper was converted or resized by the WALLPAPER command, the return value will be the converted filename, not the original source file.


See also: the WALLPAPER command, which sets the current wallpaper; and the _WALLSTYLE variable, which reports the current wallpaper style.



_WALLSTYLE — Returns the current wallpaper style.

Syntax:
%_WALLSTYLE

The style is returned as a string; possible values are Centered, Tiled, or Stretched.

rem  Check whether the wallpaper is stretched:
if "%_wallstyle" == "Stretched" echo The wallpaper is stretched to fit.


See also: the WALLPAPER command, which sets the current wallpaper; and the _WALLPAPER variable, which reports the current wallpaper filename.



_WINOSVER — Returns the Windows version and build numbers.

Syntax:
%_WINOSVER

The version will be reported as major.minor.build with periods between components.



Reference Information:


W3C Color Namesused in BGCOLOR and _BGCOLORNAME
Objects Supportedby the MKSC command
Hotkeysfor the MKSC command
Character Escapessupported in the MKSC command
Highlight VariableChoose your colors.
Startup Messageand how to suppress it
Acknowledgmentssome of my guides through the jungle
ChangesWhat’s new?
Status and Licensing 


W3C Color Names:

BGCOLOR, _BGCOLORNAME, and MKSC all use W3C color names, not the much shorter list of VGA colors familiar from most TCC commands and functions. Here is a list of the color names supported by this plugin, with their equivalent values. (Names containing “gray” may be spelled using “grey” if you prefer.)

  AliceBlue 0xF0F8FF   LightSalmon 0xFFA07A
  AntiqueWhite 0xFAEBD7   LightSeaGreen 0x20B2AA
  Aqua 0x00FFFF   LightSkyBlue 0x87CEFA
  Aquamarine 0x7FFFD4   LightSlateGray 0x778899
  Azure 0xF0FFFF   LightSteelBlue 0xB0C4DE
  Beige 0xF5F5DC   LightYellow 0xFFFFE0
  Bisque 0xFFE4C4   Lime 0x00FF00
  Black 0x000000   LimeGreen 0x32CD32
  BlanchedAlmond 0xFFEBCD   Linen 0xFAF0E6
  Blue 0x0000FF   Magenta 0xFF00FF
  BlueViolet 0x8A2BE2   Maroon 0x800000
  Brown 0xA52A2A   MediumAquaMarine 0x66CDAA
  BurlyWood 0xDEB887   MediumBlue 0x0000CD
  CadetBlue 0x5F9EA0   MediumOrchid 0xBA55D3
  Chartreuse 0x7FFF00   MediumPurple 0x9370DB
  Chocolate 0xD2691E   MediumSeaGreen 0x3CB371
  Coral 0xFF7F50   MediumSlateBlue 0x7B68EE
  CornflowerBlue 0x6495ED   MediumSpringGreen 0x00FA9A
  Cornsilk 0xFFF8DC   MediumTurquoise 0x48D1CC
  Crimson 0xDC143C   MediumVioletRed 0xC71585
  Cyan 0x00FFFF   MidnightBlue 0x191970
  DarkBlue 0x00008B   MintCream 0xF5FFFA
  DarkCyan 0x008B8B   MistyRose 0xFFE4E1
  DarkGoldenrod 0xB8860B   Moccasin 0xFFE4B5
  DarkGray 0xA9A9A9   NavajoWhite 0xFFDEAD
  DarkGreen 0x006400   Navy 0x000080
  DarkKhaki 0xBDB76B   OldLace 0xFDF5E6
  DarkMagenta 0x8B008B   Olive 0x808000
  DarkOliveGreen 0x556B2F   OliveDrab 0x6B8E23
  DarkOrange 0xFF8C00   Orange 0xFFA500
  DarkOrchid 0x9932CC   OrangeRed 0xFF4500
  DarkRed 0x8B0000   Orchid 0xDA70D6
  DarkSalmon 0xE9967A   PaleGoldenrod 0xEEE8AA
  DarkSeaGreen 0x8FBC8F   PaleGreen 0x98FB98
  DarkSlateBlue 0x483D8B   PaleTurquoise 0xAFEEEE
  DarkSlateGray 0x2F4F4F   PaleVioletRed 0xDB7093
  DarkTurquoise 0x00CED1   PapayaWhip 0xFFEFD5
  DarkViolet 0x9400D3   PeachPuff 0xFFDAB9
  DeepPink 0xFF1493   Peru 0xCD853F
  DeepSkyBlue 0x00BFFF   Pink 0xFFC0CB
  DimGray 0x696969   Plum 0xDDA0DD
  DodgerBlue 0x1E90FF   PowderBlue 0xB0E0E6
  FireBrick 0xB22222   Purple 0x800080
  FloralWhite 0xFFFAF0   Red 0xFF0000
  ForestGreen 0x228B22   RosyBrown 0xBC8F8F
  Fuchsia 0xFF00FF   RoyalBlue 0x4169E1
  Gainsboro 0xDCDCDC   SaddleBrown 0x8B4513
  GhostWhite 0xF8F8FF   Salmon 0xFA8072
  Gold 0xFFD700   SandyBrown 0xF4A460
  Goldenrod 0xDAA520   SeaGreen 0x2E8B57
  Gray 0x808080   Seashell 0xFFF5EE
  Green 0x008000   Sienna 0xA0522D
  GreenYellow 0xADFF2F   Silver 0xC0C0C0
  Honeydew 0xF0FFF0   SkyBlue 0x87CEEB
  Hotpink 0xFF69B4   SlateBlue 0x6A5ACD
  IndianRed 0xCD5C5C   SlateGray 0x708090
  Indigo 0x4B0082   Snow 0xFFFAFA
  Ivory 0xFFFFF0   SpringGreen 0x00FF7F
  Khaki 0xF0E68C   SteelBlue 0x4682B4
  Lavender 0xE6E6FA   Tan 0xD2B48C
  LavenderBlush 0xFFF0F5   Teal 0x008080
  LawnGreen 0x7CFC00   Thistle 0xD8BFD8
  LemonChiffon 0xFFFACD   Tomato 0xFF6347
  LightBlue 0xADD8E6   Turquoise 0x40E0D0
  LightCoral 0xF08080   Violet 0xEE82EE
  LightCyan 0xE0FFFF   Wheat 0xF5DEB3
  LightGoldenrodYellow 0xFAFAD2   White 0xFFFFFF
  LightGray 0xD3D3D3   WhiteSmoke 0xF5F5F5
  LightGreen 0x90EE90   Yellow 0xFFFF00
  LightPink 0xFFB6C1   YellowGreen 0x9ACD32

Objects Supported:

These are the Explorer objects explicitly supported in the target parameter to the MKSC command:

<Desktop>the desktop
<Computer>the list of drives
<Documents>the default save location for many applications
<Music>the suggested save location for music files
<Pictures>the suggested save location for graphics files
<Video>the suggested save location for video files
<Common Documents>the suggested location for shared documents
<Common Music>the suggested location for shared music files
<Common Pictures>the suggested location for shared graphics files
<Common Video>the suggested location for shared video files
<Printers>the list of printers
<Network>Network Neighborhood; LAN locations
<Connections>network interfaces
<Recycle Bin>deleted-but-recoverable files
<Control Panel>Windows configuration utilities
<Recent>list of shortcuts to recently-opened files
<SendTo>Explorer’s list of send-to locations
<Search>the Windows file-search utility
<Help and Support>Help and Support Center
<Run...>Explorer’s mini-command line
<E-mail>the registered email application
<Set Program Access and Defaults>configure default applications

Note that all of the above must be quoted to protect the angle brackets.

If you supply a name in angle brackets and it doesn’t match any of the above, MKSC will search for items with a matching display name in: (1) Control Panel, (2) Administrative Tools, (3) Printers, and (4) Windows’s “Constant Special Item ID List”, in that order.

Hotkeys:

These are the key names recognized by the MKSC command. Be aware that they differ somewhat from the key names used by the KEYSTACK command. In particular, MKSC distinguishes between the number keys on the numeric keypad, and those above the alphabetic keys.


Modifier keys: use one or more of these before a named key. Case is not significant. Modifiers listed on the same line are equivalent.

Control-Ctrl-C- the Ctrl key
Alt- A- the Alt key
Shift- S- the Shift key

Named keys. Case is not significant. Some have two names; names on the same line are equivalent.

NameAlternate name Comments
A — Z letter keys
0 — 9 number keys on the top row
Num0 — Num9 numbers on the numeric keypad when NumLock is on
BackspaceBksp  
Tab  not recommended
EnterReturn not recommended
Esc  not recommended
PageUpPgUp also 9 on the keypad when NumLock is off
PageDownPgDn also 3 on the keypad when NumLock is off
Home also 7 on the keypad when NumLock is off
End also 1 on the keypad when NumLock is off
Left also 4 on the keypad when NumLock is off
Right also 6 on the keypad when NumLock is off
Up also 8 on the keypad when NumLock is off
Down also 2 on the keypad when NumLock is off
InsertIns also 0 on the keypad when NumLock is off
DeleteDel also . on the keypad when NumLock is off
Num** * on the numeric keypad
Num+  + on the numeric keypad
Num-  - on the numeric keypad
Num/  / on the numeric keypad
F1 — F12  function keys
;Semicolon 
=Equals 
,Comma 
-Minus 
.Period 
/Slash the key with the question mark on U.S. keyboards
Grave` the key with the swung dash on U.S. keyboards
[LeftBracket 
]RightBracket 
\Backslash 
'Apostrophe 
SpaceSpacebar not recommended

• Note: Some key combinations are reserved by Windows, and others may not be recognized. Also, while it may be possible to use a named key without any modifiers, it’s probably a Bad Idea.

Character Escapes:

The MKSC command recognizes these escape sequences:

Code:Expands to:Example:
\aASCII BEL character (0x07)
\bASCII backspace (0x08)
\ccomma
\eASCII ESC character (0x1b)
\fform feed (0x0c)
\kgrave accent (0x60)
\nline feed (0x0a)
\qdouble quotes (0x22)
\rcarriage return (0x0d)
\sspace (0x20)
\ttab (0x09)
\vvertical tab (0x0b)
\\backslash (0x5c)
\unnnnUnicode character, up to U+FFFF\u03a3 → Σ
\UnnnnnnnnUnicode character, up to U+10FFFF\U0001f63a → 😺
\nnnoctal value, up to 777\101 → A
\xnnnnhexadecimal value, up to FFFF\x0041 → A
\#nnnnndecimal value, up to 65535\#65 → A

Note that case is significant for the letter after the backslash. All must be lowercase, except for \Uxxxxxxxx.

Case is not significant in hexadecimal values. \uxxxx and \xxxxx read up to four hexadecimal digits; \Uxxxxxxxx reads up to eight. You may use fewer than four (or eight) digits if the following character is not a valid hex digit.

Similarly, octal character escapes read up to three octal digits. You may use fewer than three if the following character is not an octal digit. Decimal escapes read up to five decimal digits; you may use fewer than five if the following character is not a digit.

Highlight Variable:

MKSC features highlighted output. You can customize this feature by setting an environment variable Highlight:

rem  Disable highlight:
set highlight=none

rem  Set the highlight foreground:
set highlight=bright cyan

rem  Set both foreground and background:
set highlight=bri whi on blu

rem  Numbers are also supported:
set highlight=46

If the Highlight environment variable is not defined, the plugin will check the registry for a value named Highlight of type REG_SZ. The plugin will search, in this order:

•  HKEY_CURRENT_USER\Software\JPPlugins\UIStuff(affects this plugin only)
•  HKEY_CURRENT_USER\Software\JPPlugins(affects several of my plugins)

You can also use /NC to disable highlighting in MKSC.

Startup Message:

This plugin displays an informational line when it initializes. The message will be suppressed in transient or pipe shells. You can disable it for all shells by defining an environment variable named NOLOADMSG, for example:

set /e /u noloadmsg=1

Acknowledgments:

The Windows XP (and earlier) mixer API is the kind of Byzantine, bodged-together Rube Goldberg monstrosity that gives “crawling horror” a bad name. This page (by Alberto di Bene?) was instrumental in saving my sanity.

… And then Microsoft said “Let there be Vista.” And lo, there was much confusion. Setting the master volume using the old API doesn’t work in Vista and later. The new interface is much simpler to use, and this page (by Sayyeid Mostafa Hashemi) was extremely helpful to me in making it work. Of course, the new Vista method won’t work in Windows XP and earlier; so this plugin must incorporate two utterly different routines to get and set the volume and mute state. Isn’t Windows amazing?

This page, by Kent Reisdorph, was useful in battling through the bizarre complexities of the Windows shell namespace. (May 2021: Page is gone; try the Wayback Machine.)

The syntax of the SCREENRES command borrows shamelessly from Anders Kjersem’s QRES utility.

I compress the binary using UPX.

Changes:


Version:Date:Changes:
0.80.0.42024-04-03Updates the QuickHelp for the UISTUFFHELP command.
0.80.0.32024-04-02Minor tweak to FindMyWindow.cpp: now Windows Terminal detection does not rely on the WT_SESSION environment variable.
0.80.0.22024-03-13Trivial code tweaks.
0.80.0.12024-03-13Minor tweaks to ForceForegroundWindow().
0.80.02024-01-04MKSC updated to use conlist.cpp v1.1 to better support Ctrl-C and Ctrl-Break. SETFOCUS updated to use FindMyWindow.cpp; now it recognizes Windows Terminal.
0.79.32023-11-16The “Plugin not loaded” message is no longer shown in transient or pipe shells. When it is shown, it now includes the plugin’s name.
0.79.2.42023-10-18Updated to the current version of NewHelp.cpp.
0.79.2.32023-10-13Tweaked ShowCmdHelp() to also report VER_PATCH.
0.79.2.22023-10-12Updated the plugin’s web address.
0.79.22023-07-25Updated w3ccolors.cpp to the current version.
0.79.12023-07-21Updated OsdCmd.cpp and conlist.cpp. Rearranged code to make UISTUFFHELP /V more informative. Other minor code tweaks. Removed FTP download link from the docs.
0.79.02023-06-13Removed all calls to QueryIsFile() to work around around an issue in TCC v30.00.20.
0.78.32023-05-18Moved SOUNDVOL’s OSD display slightly up and to the left.
0.78.22023-04-18Now \b correctly expands to ASCII backspace in MKSC. Updated to the latest versions of ExpandEscapes.cpp and conlist.cpp.
0.78.12023-04-03Tweaks to SOUNDVOL’s OSD display.
0.78.02023-02-01Moved all the sound volume stuff out to SoundVol.cpp. The volume and mute variables are now _VOLUME and _MUTE respectively. _SOUNDVOL and _MUTED are retained for backward compatibility, but deprecated.
0.77.122023-01-02Minor tweaks to SOUNDVOL’s OSD display.
0.77.112022-12-27Rewrote _BROWSER for Windows 10.
0.77.102022-12-26Updates and fixes for SOUNDVOL.
0.77.92022-01-12Removed MKSC’s /X and /Y, and replaced them with /AX: and /CX:.
0.77.82021-12-19MKSC: Added /NE to suppress many error messages. Fixed a problem with extensionless files being incorrectly included.
0.77.72021-12-16MKSC: Split /FB into /FB (buffer info) and /FF (font info). Added /F? to list available fields. Documented the optional third argument to /BS.
0.77.62021-12-15Added MKSC /FH to dump the console color palette. Renamed MKSC’s /BKn: option to /BHn: (think H for hue).
0.77.52021-12-15Now MKSC /BKn: can accept multiple color names, separated by commas or semicolons, to define more than one color at a time.
0.77.22021-12-08MKSC: Reworked /N a bit. Now /NC disables highlighting, and /NT prevents canononicalizing the target filename. Also added a semi-undocumented /N? which describes the available /N flags.
0.77.12021-11-29MKSC and @SCINFO: Added the ability to decode installer ‘Darwin’ ID strings, and return either a product name or a GUID.
0.77.02021-11-26Removed SETTHEME, which hasn’t worked as designed since Windows 7.
0.76.42021-11-24Fix for MKSC crashing on an unknown symbolic name.
0.76.32021-11-23Added /P to MKSC.
0.76.22021-11-23OsdCmd.cpp version 1.0.7.2. Further code tweaks.
0.76.12021-11-23Added /Y to MKSC.
0.76.02021-11-23In @SCINFO, adding 512 to info escapifies the return string. Now all commands display help text via ShowCmdHelp().
0.75.22021-07-30Added /X and /NZ to MKSC. Minor tweaks to the version info resource; now the platform (x64 or x86) is included.
0.75.12021-05-18INSTALLFONTS bug fix: only save the filename to the registry, not the full pathname. Added /X.
0.75.02021-05-18Removes STARTPIN and TASKBARPIN, which haven’t worked since Windows Vista. (Thanks, Microsoft!) Adds INSTALLFONTS. Changed the .DLL filenames; now the 32-bit build is UIStuff-x86.dll, and the 64-bit version is UIStuff.dll. Newer version of the OSD code. Various other tweaks and updates.

Status and Licensing:

Consider this beta software. It may well have issues. Try it at your own risk. If you find bugs, you can report them in the JP Software support forum.

UIStuff is currently licensed only for testing purposes. I may make binaries and source code available under some free license once I consider it ready for use.

Download:

You can download the current version of the plugin from http://charlesdye.net/dl/uistuff.zip.