Sign in to follow this  
Followers 0
magician13134

Detecting secondary keys?

5 posts in this topic

#1 ·  Posted (edited)

There are several keys I have on my keyboard like media keys, G keys, etc. that I would like to be able to detect as with _IsPressed(). Is there any Windows dll or other similar call I could make to pick up on these? Thanks very much.

Edited by magician13134

Share this post


Link to post
Share on other sites



There are several keys I have on my keyboard like media keys, G keys, etc. that I would like to be able to detect as with _IsPressed(). Is there any Windows dll or other similar call I could make to pick up on these? Thanks very much.

If I understand you correctly, you are wanting to use _IsPressed() with one of those "fancy" keyboards. You can do what Zedna suggested and create a script to tell you the virtual key codes, but that's not really necessary. You have to understand those "extra" keys might be Function keys. On a typical keyboard you can see F1 - F12. Someone could re-label F1 to read "Help" or F2 to read "Re-name" or F5 to read "Refresh"... you get the point, right?

If you look at the Remarks section under _IsPressed() in the Help file you'll see the following. And before you say, "yeah, but my keyboard doesn't have an F15 or F22 key".... stop and think about what this thread is about ;).

7C-7F F13 key - F16 key

80H-87H F17 key - F24 key

My guess would be that a help file for the keyboard or your computer would either explain the "virtual key codes" or which F13 - F24 key those special keys use/represent. Granted I'm making a ton of assumptions here and I could be wrong. But its worth a try any ways, right? So if you have a "Play" and "Zoom" key you'd want your code to look like this:

#include <Misc.au3>

;; Vitrual Key Codes:
;; FA   Play key
;; FB   Zoom key

If _IsPressed("FA") Then
    ;; play it again Sam
ElseIf _IsPressed("FB") Then
    ;; zoom zoom in your Mazda
Else
    ;; blah, blah, blah
EndIf

Now if you want to get really White and Nerdy, like Weird Al... then you can build your helper script like Zedna suggested. But you'll want to read up on DllCall() and the GetKey... functions within User32.dll out at msdn.microsoft.com. I personally think all you need is the Virtual-Key Code link :P Call me lazy for not waiting to give you the DllCall() code, but the truth is I'm just not White and Nerdy enough to know how :).

Let us know what you come up with! Hope this helped.

Share this post


Link to post
Share on other sites

I'm not sure if you folks here know this term, but Tag for the keycode link.

Share this post


Link to post
Share on other sites

I'm not quite sure I follow any of that, firstly Zedna, I've tried that and they don't come ever show up... Secondly, they aren't F keys, mostly G keys, and some media keys... I have the Logitech G-15 keyboard if that helps, and I don't really understand the vritual keys....

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0