Microsoft® Windows® Script Host Hotkey Property |
WSH Reference Version 1 |
Provides the hotkey of a shortcut object. A hotkey is a keyboard shortcut that starts or switches to a program.
object.Hotkey = strHotkey
Part Description object WshShortcut object. strHotkey Sequence of keys to assign.
The syntax of strHotkey is as follows, with Hotkey being case-insensitive:
Part Description modifier "ALT+" | "CTRL+" | "SHIFT+" | "EXT+"
keyname "A" .. "Z" |
"0".. "9" |
"Back" | "Tab" | "Clear" | "Return" |
"Escape" | "Space" | "Prior" | ...Hotkeys can activate only shortcuts located on the Windows-based desktop or the Windows Start menu.
The following example creates a shortcut and assigns a hotkey to the shortcut:Set WshShell = WScript.CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") Set oMyShortcut = WshShell.CreateShortcut(strDesktop & "\a_key.lnk") OMyShortcut.TargetPath = "%windir%\notepad.exe" oMyShortCut.Hotkey = "ALT+CTRL+F" oMyShortCut.Save WScript.Echo oMyShortCut.Hotkey