Hot Keys

Topics: Idea Requests, Problems
Nov 5, 2007 at 1:13 PM
Edited Nov 5, 2007 at 1:20 PM
I am having a lot of issues with the hot keys already being taken.
I would like to be able to do Windows + Numbers on the top row, but apparently Vista already has that set up for something else. So this is my first issue, do you know a way I can stop Vista from taking the combinations when I don't want it to?

Second issue is that a lot of the hot key features I don't really think I will be using, but I am not sure how to turn off the hot keys. Does removing all the checked boxes disable the hot key? You should probably make a note to add an option in the menus to disable the hot keys since it is either not possible currently, or is not apparent.
Coordinator
Nov 14, 2007 at 1:23 AM
Vista's shell, Explorer, is what currently is using the Windows Key + Numbers (they launch your quicklaunch icons in order from left to right). You might be able to stop it from doing this by simply hiding your quicklaunch bar, but of course that may not be an option (if you are like me). Even then, it may still steal those hotkeys from VVDM. So, right now, there probably isn't a way to stop Vista from stealing them, but in the future, I plan to implement my own version of hotkeys that use a global keyboard hook that will allow me to override all other programs' hotkeys.

You are right; it is not obvious how to disable them. You should be able to disable almost any hotkey by simply unchecking all three boxes. I'll make that more apparent in the future.
May 22, 2008 at 8:29 PM
Edited May 22, 2008 at 8:35 PM

Here is a solution that might help to work around this issue:

I wrote a script that lets you send keystrokes. To use please read the instructions at the beginning of the script at the bottom of this article.

Assuming you saved the script in the file "C:\Users\Your Username\AppData\Roaming\SK.vbs" and the file "dynwrap.dll" into the same folder, put the following links into the quick launch folder:

Link 1: C:\Windows\System32\wscript.exe "C:\Users\Your Username\AppData\Roaming\SK.vbs" #{NUM1}

Link 2: C:\Windows\System32\wscript.exe "C:\Users\Your Username\AppData\Roaming\SK.vbs" #{NUM2}

Link 3: C:\Windows\System32\wscript.exe "C:\Users\Your Username\AppData\Roaming\SK.vbs" #{NUM3}

Link 4: C:\Windows\System32\wscript.exe "C:\Users\Your Username\AppData\Roaming\SK.vbs" #{NUM4}

Place them into the 1st four positions on the quick launch bar. If you now press the Windows logo key plus one of the top row digits the script sends the Windows logo key plus the corresponding number pad key and switches to the corresponding virtual desktop.

Save the following code to "C:\Users\Your Username\AppData\Roaming\SK.vbs":


<Beginning of script code (don't include this line)>

' The SendKeys implementation in VBScript is incomplete and with Windows Vista and VB it is not supported.

' I wrote this (incomplete) function to support some additional keys — see replace statement in SendKeys.
' Additional you now can invoke keys that are accompanied by the Windows Logo Key. This key is represented
' by a preceding # character.

' I didn't (yet) implement a feature to apply the control, alt, shift or windows key to a complete string
' of keys. In this version each key has to be shifted separatedly. This means a construction like "+(abc)"
' cannot be used to type the letters "abc" in upper case. Instead you'd have to write "+a+b+c".

' To make this file usable it takes the command line parameter and enters it using the SendKeys function.

' Version 1.0 · Copyright © Thomas A. Osthege · Thomas.Osthege [-at-] EUROCOMP.info.

' This script depends on dynwrap.dll which can be downloaded from
' http://cwashington.netreach.net/downloads/com/dynawrapnt.zip.

' Before using this sscript dynwrap.dll must be registered with the command regsvr32 <folder>\dynwrap.dll.
' Regsvr32 must be run with administration rights.

' This file may be given away for free as long as my copyright note is not modified or deleted.

' You may modify this script any way you want, provided you send me a documented copy.

' list of virtual key codes (vbKey... is not supported by VBScript)
Public Const VK_ADD = &H6B
Public Const VK_ATTN = &HF6
Public Const VK_BACK = &H8
Public Const VK_CANCEL = &H3
Public Const VK_CAPITAL = &H14
Public Const VK_CLEAR = &HC
Public Const VK_CONTROL = &H11
Public Const VK_CRSEL = &HF7
Public Const VK_DECIMAL = &H6E
Public Const VK_DELETE = &H2E
Public Const VK_DIVIDE = &H6F
Public Const VK_DOWN = &H28
Public Const VK_END = &H23
Public Const VK_EREOF = &HF9
Public Const VK_ESCAPE = &H1B
Public Const VK_EXECUTE = &H2B
Public Const VK_EXSEL = &HF8
Public Const VK_F1 = &H70
Public Const VK_F2 = &H71
Public Const VK_F3 = &H72
Public Const VK_F4 = &H73
Public Const VK_F5 = &H74
Public Const VK_F6 = &H75
Public Const VK_F7 = &H76
Public Const VK_F8 = &H77
Public Const VK_F9 = &H78
Public Const VK_F10 = &H79
Public Const VK_F11 = &H7A
Public Const VK_F12 = &H7B
Public Const VK_F13 = &H7C
Public Const VK_F14 = &H7D
Public Const VK_F15 = &H7E
Public Const VK_F16 = &H7F
Public Const VK_F17 = &H80
Public Const VK_F18 = &H81
Public Const VK_F19 = &H82
Public Const VK_F20 = &H83
Public Const VK_F21 = &H84
Public Const VK_F22 = &H85
Public Const VK_F23 = &H86
Public Const VK_F24 = &H87
Public Const VK_HELP = &H2F
Public Const VK_HOME = &H24
Public Const VK_INSERT = &H2D
Public Const VK_LBUTTON = &H1
Public Const VK_LCONTROL = &HA2
Public Const VK_LEFT = &H25
Public Const VK_LMENU = &HA4
Public Const VK_LSHIFT = &HA0
Public Const VK_MBUTTON = &H4 ' NOT contiguous with L RBUTTON
Public Const VK_MENU = &H12
Public Const VK_MULTIPLY = &H6A
Public Const VK_NEXT = &H22
Public Const VK_NONAME = &HFC
Public Const VK_NUMLOCK = &H90
Public Const VK_NUMPAD0 = &H60
Public Const VK_NUMPAD1 = &H61
Public Const VK_NUMPAD2 = &H62
Public Const VK_NUMPAD3 = &H63
Public Const VK_NUMPAD4 = &H64
Public Const VK_NUMPAD5 = &H65
Public Const VK_NUMPAD6 = &H66
Public Const VK_NUMPAD7 = &H67
Public Const VK_NUMPAD8 = &H68
Public Const VK_NUMPAD9 = &H69
Public Const VK_PA1 = &HFD
Public Const VK_PAUSE = &H13
Public Const VK_PLAY = &HFA
Public Const VK_PRINT = &H2A
Public Const VK_PRIOR = &H21
Public Const VK_PROCESSKEY = &HE5
Public Const VK_RBUTTON = &H2
Public Const VK_RCONTROL = &HA3
Public Const VK_RETURN = &HD
Public Const VK_RIGHT = &H27
Public Const VK_RMENU = &HA5
Public Const VK_RSHIFT = &HA1
Public Const VK_SCROLL = &H91
Public Const VK_SELECT = &H29
Public Const VK_SEPARATOR = &H6C
Public Const VK_SHIFT = &H10
Public Const VK_SLEEP = &H10
Public Const VK_SNAPSHOT = &H2C
Public Const VK_SPACE = &H20
Public Const VK_SUBTRACT = &H6D
Public Const VK_TAB = &H9
Public Const VK_UP = &H26
Public Const VK_ZOOM = &HFB
Public Const VK_LWIN = &H5B
Public Const VK_RWIN = &H5C

' Create the wrapper object for dynamic DLL function calling
Dim UserWrap
Set UserWrap = CreateObject("DynamicWrapper")

UserWrap.Register "user32.dll", "MapVirtualKeyA", "i=ll", "f=s", "r=l"
UserWrap.Register "user32.dll", "VkKeyScanA", "i=c", "f=s", "r=l"
UserWrap.Register "user32.dll", "keybd_event", "i=ccll", "f=s", "r=l"

'Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal code As Long, ByVal maptype As Long) As Long
'Declare Function VkKeyScan Lib "user32" Alias "VkKeyScanA" (ByVal c As Byte) As Integer
'Declare Sub keybd_event Lib "user32" (ByVal vk As Byte, ByVal scan As Byte, ByVal Flags As Long, ByVal extra As Long)

With WScript
If .Arguments.Count = 1 Then SendKeys .Arguments(0), false ' send the command line text
End With

' duplicate VB SendKeys function using Windows API (Vista problem)
' I use Chr(0) as an indicator to say "next key is a virtual key already — don't convert".
' Wait isn't used currently.

Sub SendKeys(tKeys, Wait)
Dim I ' counter
Dim fCtrl ' control key pressed
Dim fAlt ' alt key pressed
Dim fShift ' shift key pressed
Dim fWin ' windows logo key pressed
Dim fIsVK ' key is virtual key already

' cursor movement
tKeys = Replace(tKeys, "{HOME}", Chr(0) & Chr(VK_Home), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{LEFT}", Chr(0) & Chr(VK_Left), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{PGDN}", Chr(0) & Chr(VK_Next), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{PGUP}", Chr(0) & Chr(VK_Prior), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{RIGHT}", Chr(0) & Chr(VK_Right), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{UP}", Chr(0) & Chr(VK_Up), 1, -1, vbTextCompare)

' special keys
tKeys = Replace(tKeys, "{BACKSPACE}", Chr(0) & Chr(VK_Back), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{BS}", Chr(0) & Chr(VK_Back), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{BKSP}", Chr(0) & Chr(VK_Back), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{CAPSLOCK}", Chr(0) & Chr(VK_Capital), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{DELETE}", Chr(0) & Chr(VK_Delete), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{DOWN}", Chr(0) & Chr(VK_Down), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{END}", Chr(0) & Chr(VK_End), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{ENTER}", Chr(0) & Chr(VK_Return), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{ESC}", Chr(0) & Chr(VK_Escape), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{HELP}", Chr(0) & Chr(VK_Help), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{SCROLL}", Chr(0) & Chr(VK_Scroll), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{SLEEP}", Chr(0) & Chr(VK_Sleep), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{SHIFT}", Chr(0) & Chr(VK_Shift), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{TAB}", Chr(0) & Chr(VK_Tab), 1, -1, vbTextCompare)

' function keys
tKeys = Replace(tKeys, "{F1}", Chr(0) & Chr(VK_F1), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F2}", Chr(0) & Chr(VK_F2), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F3}", Chr(0) & Chr(VK_F3), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F4}", Chr(0) & Chr(VK_F4), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F5}", Chr(0) & Chr(VK_F5), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F6}", Chr(0) & Chr(VK_F6), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F7}", Chr(0) & Chr(VK_F7), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F8}", Chr(0) & Chr(VK_F8), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F9}", Chr(0) & Chr(VK_F9), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F10}", Chr(0) & Chr(VK_F10), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F11}", Chr(0) & Chr(VK_F11), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F12}", Chr(0) & Chr(VK_F12), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F13}", Chr(0) & Chr(VK_F13), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F14}", Chr(0) & Chr(VK_F14), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F15}", Chr(0) & Chr(VK_F15), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F16}", Chr(0) & Chr(VK_F16), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F17}", Chr(0) & Chr(VK_F17), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F18}", Chr(0) & Chr(VK_F18), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F19}", Chr(0) & Chr(VK_F19), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F20}", Chr(0) & Chr(VK_F20), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F21}", Chr(0) & Chr(VK_F21), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F22}", Chr(0) & Chr(VK_F22), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F23}", Chr(0) & Chr(VK_F23), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{F24}", Chr(0) & Chr(VK_F24), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{INSERT}", Chr(0) & Chr(VK_Insert), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{INS}", Chr(0) & Chr(VK_Insert), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{PRTSC}", Chr(0) & Chr(VK_Print), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{PRINT}", Chr(0) & Chr(VK_Print), 1, -1, vbTextCompare)

' numeric keypad
tKeys = Replace(tKeys, "{NUMLOCK}", Chr(0) & Chr(VK_Numlock), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{ADD}", Chr(0) & Chr(VK_Add), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{.}", Chr(0) & Chr(VK_Decimal), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{DECIMAL}", Chr(0) & Chr(VK_Decimal), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{/}", Chr(0) & Chr(VK_Divide), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{÷}", Chr(0) & Chr(VK_Divide), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{DIVIDE}", Chr(0) & Chr(VK_Divide), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{*}", Chr(0) & Chr(VK_Multiply), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{×}", Chr(0) & Chr(VK_Multiply), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{MULTIPLY}", Chr(0) & Chr(VK_Multiply), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{-}", Chr(0) & Chr(VK_Subtract), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{SUBTRACT}", Chr(0) & Chr(VK_Subtract), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{NUM0}", Chr(0) & Chr(VK_Numpad0), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{NUM1}", Chr(0) & Chr(VK_Numpad1), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{NUM2}", Chr(0) & Chr(VK_Numpad2), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{NUM3}", Chr(0) & Chr(VK_Numpad3), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{NUM4}", Chr(0) & Chr(VK_Numpad4), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{NUM5}", Chr(0) & Chr(VK_Numpad5), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{NUM6}", Chr(0) & Chr(VK_Numpad6), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{NUM7}", Chr(0) & Chr(VK_Numpad7), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{NUM8}", Chr(0) & Chr(VK_Numpad8), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{NUM9}", Chr(0) & Chr(VK_Numpad9), 1, -1, vbTextCompare)

' windows logo key
tKeys = Replace(tKeys, "{WIN}", Chr(0) & Chr(VK_LWIN), 1, -1, vbTextCompare)
tKeys = Replace(tKeys, "{WINDOWS}", Chr(0) & Chr(VK_LWIN), 1, -1, vbTextCompare)

' {, }, ^, %, + and # keys
tKeys = Replace(tKeys, "{{}", "{")
tKeys = Replace(tKeys, "{}}", "}")
tKeys = Replace(tKeys, "{^}", "^")
tKeys = Replace(tKeys, "{%}", "%")
tKeys = Replace(tKeys, "{+}", "+")
tKeys = Replace(tKeys, "{#}", "#")

If Len(tKeys) = 0 Then Exit Sub

For I = 1 To Len(tKeys)
Select Case Mid(tKeys, I, 1)
Case "^": fCtrl = True ' indicate "shift"
Case "%": fAlt = True
Case "+": fShift = True
Case "#": fWin = True
Case Chr(0): fIsVK = true ' virtual key following
Case Else: Call SendKey(Mid(tKeys, I, 1), fCtrl, fAlt, fShift, fWin, fIsVK)
fCtrl = False
fAlt = False
fShift = False
fWin = False
fIsVK = false
End Select
Next 'I

' If Wait Then DoEvents
End Sub

' send one key

Sub SendKey(Key, Ctrl, Alt, Shift, Win, IsVK)
Dim iKeyVK
Dim iKeyScan
Dim iCtlScan
Dim iAltScan
Dim iShiftScan
dim iWinScan

With UserWrap
If IsVk Then
iKeyVK = Asc(Key) And &HFF
Else
iKeyVK = .VkKeyScanA(Asc(Key)) And &HFF
End If
iKeyScan = .MapVirtualKeyA(iKeyVK, 0)

If Ctrl Then
iCtlScan = .MapVirtualKeyA(VK_CONTROL, 0)
Call .keybd_event(VK_CONTROL, iCtlScan, 0, 0) ' Ctrl down
End If

If Alt Then
iAltScan = .MapVirtualKeyA(VK_MENU, 0)
Call .keybd_event(VK_MENU, iAltScan, 0, 0) ' Alt down
End If

If Shift Then
iShiftScan = .MapVirtualKeyA(VK_SHIFT, 0)
Call .keybd_event(VK_SHIFT, iShiftScan, 0, 0) ' Shift down
End If

if Win Then
iWinScan = .MapVirtualKeyA(VK_LWIN, 0)
Call .keybd_event(VK_LWIN, iWinScan, 0, 0) ' Windows down
End If

Call .keybd_event(iKeyVK, iKeyScan, 0, 0) ' Key down
Call .keybd_event(iKeyVK, iKeyScan, &H2, 0) ' Key up

If Win Then Call .keybd_event(VK_LWIN, iWinScan, &H2, 0) ' Windows up
If Shift Then Call .keybd_event(VK_SHIFT, iShiftScan, &H2, 0) ' Shift up
If Alt Then Call .keybd_event(VK_MENU, iAltScan, &H2, 0) ' Alt up
If Ctrl Then Call .keybd_event(VK_CONTROL, iCtlScan, &H2, 0) ' Ctrl up
End With
End Sub

<End of script code (don't include this line)>

Hope that helps someone

Thomas

P.S. Don't forget to register "dynwrap.dll" with regsvr32!

Jun 25, 2008 at 2:24 PM
Yeah, I am having the same issues with Vista. I can't hide quick launch toolbar as I can't live without it either.
ThomasAO could you please provide a more user friendly .zip package that include the .dll and how to register it (probably .bat file) and the script and some read me. That would help a lot

Thanks
Jun 26, 2008 at 8:37 PM

choco, I'll try to do that asap, but I'm currently pretty busy; so this might take a while.

Thomas