How to catch special application keys?
Why not use these keys instead of Alt-/Win-/CTRL-combinations. This way I could ban the special key functions from the "normal" keyboard. Instead I can use well pictured buttons above the normal keyboard. Using multiple key-presses gives the extended keys a very intuitively use:
Pressing the Internet-Button twice could start the preferred Search Engine, pressing it triple could open the list of recently visited Internet-Pages.
Pressing the E-Mail-Button twice could open a new mail to send.
Pressing the My Documents-Button twice or triple could open different folders for different live spheres.
Every application button could have multiple functions.
So far so good. The problem: Not all of those keys generates recognizable by HK events (e.g. Buttons like "Messenger", "My Documents", and "My Pictures"). But they can be assigned to commands (e.g. compiled scripts) using manufacturers software.
Is there a possibility to detect multiple key-presses of these buttons? I could imagine, that a special scripts fired by them will detect, if it is fired twice or triple in a short period of time.
But, if you want to willingly skewer your CPU, here's the concept: (it's worked before)
If you right-click on a script's tray menu, and click Open, you'll see a gray window with various info about the script. What you might not know about this window is that it's always there, just hidden. So, you implement code at the top to check for this hidden window, and if it exists, you know that a different instance is already running, and you can act accordingly. #SingleInstance has to be turned off for this to work.
I want to emphasize one last time how inefficient and slow (relatively) this would be, but if it isn't going to be a problem for you, I can post some code that illustrates the concept.
It would be better to choose an obscure option in the driver that you're not likely to reproduce manually,
configure the manufacturer's software to send an alternate keystroke,
In effect, we meant the same thing, but I see now mine was poorly worded. That's kind of what I meant, halweg.
The keyboard that came with the MS Desktop uses the MS IntelliType Software. In difference to the mouse driver (IntelliPoint) it seems not to be possible to assign the application keys directly to keystrokes. They can be assigned to commands only (like "Close" "New").
Following jonny I explored the MS IntelliType software. I detected a file named commands.xml. It's a big one, but it shows the manner how internal commands may be assigned to Keystrokes. That’s very complex, because there are quite a lot of assignments for every country and every application.
The most interesting part of that file seems to be that:
<ALL> <Application UniqueName="StandardSupport"> <C309 Type="5" KeySeq="ctrl F4" /> <C201 Type="5" KeySeq="ctrl c" /> <C200 Type="5" KeySeq="ctrl x" /> <C301 Type="5" KeySeq="alt F4" /> <C302 Type="5" KeySeq="F1" /> <C202 Type="5" KeySeq="ctrl v" /> <C203 Type="5" KeySeq="ctrl z" /> <C205 Type="5" KeySeq="delete" /> <C100 Type="5" KeySeq="alt leftarrow" /> <C101 Type="5" KeySeq="alt rightarrow" /> <C103 Type="5" KeySeq="escape" /> <C300 Type="5" KeySeq="enter" /> <C319 Type="6" Activator="ZoomIn" /> <C320 Type="6" Activator="ZoomOut" /> <C1101 Type="6" Activator="HorizontalScroll" /> <C1003 Type="7" Subtype="0" /> </Application>The numbers at the beginning of the lines (i.e. C309) are the internal command codes (in this example "Close"). These commands can be assigned to application buttons by the IntelliPoint GUI or directly in the registry.
The most important thing: the keystrokes written in that file can be recognized by AHK. When assigning the C200 command ("Cut") to the messenger button, pressing that button will generate the CTRL and X press up and down events.
A2 01D d 3.50 STRG 58 02D d 0.00 X 58 02D u 0.00 X A2 01D u 0.00 STRGI tried it out – multiple presses are recognizable . Long presses not :? (probably because the generated key presses contains key up events without a time shift, the key up event follows directly the key down event, regardless if I still hold down the key).
That seems to be a problem with all application keys; the Volume_Mute key can't be recognized as a long press too.
It remains to spend some brain work in finding free keystrokes and commands to be free assigned. 8)
It seems like the special application keys that are not listed in the AHK-Help don't generate events.