Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AssignHotKey(Label, key, vkey, state = "on") {
- If (not StrLen(vkey)) {
- vkey := key
- }
- If (state != "off") {
- Hotkey, %VKey%, %Label%, UseErrorLevel
- }
- If (ErrorLevel) {
- If (errorlevel = 1)
- str := str . "`nASCII " . VKey . " - 1) The Label parameter (" Label ") specifies a nonexistent label name."
- Else If (errorlevel = 2)
- str := str . "`nASCII " . VKey . " - 2) The KeyName parameter specifies one or more keys that are either not recognized or not supported by the current keyboard layout/language. Switching to the english layout should solve this for now."
- Else If (errorlevel = 3)
- str := str . "`nASCII " . VKey . " - 3) Unsupported prefix key. For example, using the mouse wheel as a prefix in a hotkey such as WheelDown & Enter is not supported."
- Else If (errorlevel = 4)
- str := str . "`nASCII " . VKey . " - 4) The KeyName parameter is not suitable for use with the AltTab or ShiftAltTab actions. A combination of two keys is required. For example: RControl & RShift::AltTab."
- Else If (errorlevel = 5)
- str := str . "`nASCII " . VKey . " - 5) The command attempted to modify a nonexistent hotkey."
- Else If (errorlevel = 6)
- str := str . "`nASCII " . VKey . " - 6) The command attempted to modify a nonexistent variant of an existing hotkey. To solve this, use Hotkey IfWin to set the criteria to match those of the hotkey to be modified."
- Else If (errorlevel = 50)
- str := str . "`nASCII " . VKey . " - 50) Windows 95/98/Me: The command completed successfully but the operating system refused to activate the hotkey. This is usually caused by the hotkey being "" ASCII " . int . " - in use"" by some other script or application (or the OS itself). This occurs only on Windows 95/98/Me because on other operating systems, the program will resort to the keyboard hook to override the refusal."
- Else If (errorlevel = 51)
- str := str . "`nASCII " . VKey . " - 51) Windows 95/98/Me: The command completed successfully but the hotkey is not supported on Windows 95/98/Me. For example, mouse hotkeys and prefix hotkeys such as a & b are not supported."
- Else If (errorlevel = 98)
- str := str . "`nASCII " . VKey . " - 98) Creating this hotkey would exceed the 1000-hotkey-per-script limit (however, each hotkey can have an unlimited number of variants, and there is no limit to the number of hotstrings)."
- Else If (errorlevel = 99)
- str := str . "`nASCII " . VKey . " - 99) Out of memory. This is very rare and usually happens only when the operating system has become unstable."
- MsgBox, %str%
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement