Named constants
A builtin parameter with a fixed set of choices takes an Integer from one of these namespaces. The
names are replaced by their numbers when the script compiles, so they cost nothing at run time, and
the editor completes them after you type the namespace and a dot, showing each one's value and what
it means. They're case-sensitive, and a
misspelled one is a compile error. The number itself also works (VirtualKey.A is 65 is
0x41), but the name says what it means. A Steps field that takes a whole number takes the same
names.
| Namespace | Members = value | Used by |
|---|---|---|
MouseButton | Left=0 Right=1 Middle=2 X1=3 X2=4 Primary=5 Secondary=6 | MouseClick, MouseButtonDown/Up, MouseDoubleClick, MouseIsButtonDown; also what ContextGetStrokeButton returns (-1 when there's no button context). Primary is the button Windows treats as a left click and Secondary the one it treats as a right click, following Windows' "Primary mouse button" setting, so use them for an ordinary click or right-click. Left and Right are the physical buttons: with the primary and secondary buttons swapped in Windows' mouse settings, a MouseButton.Left click is the physical left button, which Windows treats as a right click. ContextGetStrokeButton reports the button after the swap as Primary or Secondary, so a right-button gesture reports Secondary whichever physical button drew it, and passing the value to MouseClick presses that same button. Recorded macros use Primary and Secondary. |
FileNotify | FileName=0x1 DirName=0x2 Attributes=0x4 Size=0x8 LastWrite=0x10 LastAccess=0x20 Creation=0x40 Security=0x100 | FolderWatchCreate's filterMask. These are bit flags, so combine them with |. |
AudioEndpoint | Playback=0 Capture=1 Communications=2 | Multimedia* volume and mute builtins |
WindowStyle | Normal=0 Minimized=1 Maximized=2 Hidden=3 | ShellRunProgram |
ShellVerb | Open=0 Edit=1 Print=2 RunAs=3 Properties=4 Explore=5 Find=6 | ShellRunProgram's verb, which also accepts any other verb as Text |
Location | TopLeft=0 TopCenter=1 TopRight=2 MiddleLeft=3 MiddleCenter=4 MiddleRight=5 BottomLeft=6 BottomCenter=7 BottomRight=8 | UIShowDisplayMessage's location, which also accepts a Text "x,y" screen point |
TextAlign | Left=0 Center=1 Right=2 | UIShowDisplayMessage/UIUpdateDisplayMessage |
LockResult | Acquired=0 TimedOut=1 Pinned=2 | returned by UtilityLockAcquire/UtilityLockAcquirePinned |
LockState | Free=0 HeldByMe=1 HeldByOther=2 Pinned=3 | returned by UtilityLockGetState |
SerialParity | None=0 Odd=1 Even=2 Mark=3 Space=4 | SerialOpenPort, SerialMonitorCreate |
SerialStopBits | One=0 OnePointFive=1 Two=2 | SerialOpenPort, SerialMonitorCreate |
DateTimeStyle | ShortDate=0 LongDate=1 ShortTime=2 LongTime=3 ShortDateTime=4 LongDateTime=5 FileStamp=6 | DateTimeFormat. All but FileStamp follow the user's Windows region settings, in that region's own calendar; FileStamp is always 20261001-140509, which sorts by time and is safe in a file name. |
DateTimePart | Year=0 Month=1 Day=2 Hour=3 Minute=4 Second=5 Weekday=6 | DateTimeGetPart. Gregorian, local time. Weekday is ISO: 1 is Monday, 7 is Sunday. |
VirtualKey | the Win32 virtual-key codes, named after .NET's Keys enum (listed below) | every Keyboard* builtin that takes an Integer key |
VirtualKey members
The Oem* keys are named by the symbol they produce on a US keyboard. The physical key varies with
the layout.
LButton RButton Cancel MButton XButton1 XButton2 Back Tab Clear Enter ShiftKey ControlKey Menu Pause CapsLock Escape Space PageUp PageDown End Home Left Up Right Down Select Print Execute PrintScreen Insert Delete Help D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z LWin RWin Apps Sleep NumPad0 NumPad1 NumPad2 NumPad3 NumPad4 NumPad5 NumPad6 NumPad7 NumPad8 NumPad9 Multiply Add Separator Subtract Decimal Divide F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 F16 F17 F18 F19 F20 F21 F22 F23 F24 NumLock Scroll LShiftKey RShiftKey LControlKey RControlKey LMenu RMenu BrowserBack BrowserForward BrowserRefresh BrowserStop BrowserSearch BrowserFavorites BrowserHome VolumeMute VolumeDown VolumeUp MediaNextTrack MediaPreviousTrack MediaStop MediaPlayPause LaunchMail SelectMedia LaunchApplication1 LaunchApplication2 OemSemicolon Oemplus Oemcomma OemMinus OemPeriod OemQuestion Oemtilde OemOpenBrackets OemPipe OemCloseBrackets OemQuotes Oem8 Oem102
Key-combo text (KeyboardPressKeyCombo)
KeyboardPressKeyCombo takes Text, not a constant: any number of modifier prefixes, then exactly
one key. One combo per call, with no repeat counts. Nothing may follow the key: "^cx" or
"Control+V" is an error, not a press of the first key.
| Prefix | ^ | + | % | @ |
|---|---|---|---|---|
| Modifier | Ctrl | Shift | Alt | Win |
The key is a single letter or digit (either case), or one of these names in braces, in any letter case: {ENTER}
{ESC} {TAB} {DEL} {BS} {SPACE} {HOME} {END} {PGUP} {PGDN} {LEFT} {RIGHT}
{UP} {DOWN} {INSERT} {F1}…{F24} {PRTSC} {CAPSLOCK} {NUMLOCK} {SCROLLLOCK}
{BREAK} {HELP} {CLEAR} {NUMPAD0}…{NUMPAD9} {MULTIPLY} {ADD} {SEPARATOR}
{SUBTRACT} {DECIMAL} {DIVIDE}. {ESCAPE} and {DELETE} also work.
Examples: "^c" Ctrl+C · "^+{ESC}" Ctrl+Shift+Esc · "%{F4}" Alt+F4 · "@d" Win+D ·
"^{HOME}" Ctrl+Home · "{enter}" Enter.
Coming from .NET's SendKeys? The prefixes and the names in braces follow Microsoft's
SendKeys syntax. This text adds
@ for the Windows key and {NUMPAD0}…{NUMPAD9}, {SEPARATOR} and {DECIMAL} for the numeric keypad's
own keys. It leaves out repeat counts ({LEFT 4}), several keys in one text ("^s{ENTER}"), groups in
parentheses ("+(ec)"), ~ for Enter, braced literal characters such as {+}, and the short names
{BKSP} and {INS}.