Assigns a key-combination to a shortcut, or identifies the key-combination assigned to a shortcut.
object.Hotkey = strHotkey
The syntax of strHotkey is:
[KeyModifier]KeyName
Note EXT+ means "Extended key." it appears here in case a new type of SHIFT-key is added to the character set in the future.
The KeyName is not case-sensitive.
A hotkey is a combination of keys that starts a shortcut when all associated keys are held down at the same time.
Note Another name for a hotkey is a Keyboard Shortcut.
In Windows 2000, valid Hotkeys always begin with CTRL + ALT.
The following example demonstrates the use of the HotKey property.
<package>
<job id="vbs">
<script language="VBScript">
set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\Shortcut Script.lnk")
oShellLink.TargetPath = WScript.ScriptFullName
oShellLink.WindowStyle = 1
oShellLink.Hotkey = "Ctrl+Alt+e"
oShellLink.IconLocation = "notepad.exe, 0"
oShellLink.Description = "Shortcut Script"
oShellLink.WorkingDirectory = strDesktop
oShellLink.Save
</script>
</job>
<job id="js">
<script language="JScript">
var WshShell = WScript.CreateObject("WScript.Shell");
strDesktop = WshShell.SpecialFolders("Desktop");
var oShellLink = WshShell.CreateShortcut(strDesktop + "\\Shortcut Script.lnk");
oShellLink.TargetPath = WScript.ScriptFullName;
oShellLink.WindowStyle = 1;
oShellLink.Hotkey = "Ctrl+Alt+e";
oShellLink.IconLocation = "notepad.exe, 0";
oShellLink.Description = "Shortcut Script";
oShellLink.WorkingDirectory = strDesktop;
oShellLink.Save();
</script>
</job>
</package>
Running Your Scripts | Running Your Scripts | WshSpecialFolders Object | WshShortcut Object