Specific questions:
1. Is this the entire script, or is there more code?
2. Are other scripts also running?
3. What other keys or buttons are being pressed?
Would also read about key jamming.
viewtopic.php?p=460331#p460331
About the hook:
1. When the hook is used, it is also installed.
2. Wildcard hotkeys always use the keyboard hook, as do any hotkeys eclipsed by a wildcard hotkey.
3. If at least one variant of a keyboard hotkey has the tilde modifier, that hotkey always uses the keyboard hook.
4. The $ prefix forces the keyboard hook to be used.
5. Mouse hotkeys always use the mouse hook.
6. "Up" hotkeys and their key-down counterparts (if any) always use the keyboard hook.
7. Custom combinations involving keyboard keys always use the keyboard hook, as do any hotkeys which use the prefix key as a suffix.