为快捷方式指派组合键,或确定指派给快捷方式的组合键。
object.Hotkey = strHotkey
strHotkey 的语法为:
[KeyModifier]KeyName
注意 EXT+ 表示“扩展键”。 此处是为了防止日后将新的 SHIFT-键类型添加到字符集内。
KeyName 不区分大小写。
热键是一组组合键,当同时按下所有相关键时将启动快捷方式。
注意 热键的另一个名称叫做“键盘快捷方式”。
在 Windows 2000 中,有效的热键总是以 CTRL + ALT 开头。
下面的示例演示 HotKey 属性的用法:
<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>