spikespaz Posted May 15, 2018 Share Posted May 15, 2018 I've got two media keys I would like to rebind to a function. I have the "Display Switch" key, Fn+F8, and the "Search" key, Fn+F9. I would also like to completely disable the button that turns off my internet connection, Fn+PrintScr. I have often attempted to take a screenshot and accidentally disconnected myself from a multiplayer game. How do I find the hex key codes of these multimedia keys? I see everywhere to use misc.au3/_IsPressed(), but that would require me to already know the key code. Thanks for any help. Link to comment Share on other sites More sharing options...
spikespaz Posted May 15, 2018 Author Share Posted May 15, 2018 I have the following code getting me the key codes in a message box. Now I can't figure out how to use the key code. Here is the script to get the key codes: #include <misc.au3> While True Sleep(1) For $k = 0 To 255 If _IsPressed(Hex($k)) Then MsgBox($MB_SYSTEMMODAL, "Key Pressed", Hex($k)) EndIf Next WEnd This is what I have tried to listen to the key press: ; Display Switch = 00000050 ; Search = 00000053 HotKeySet("{ASC 00000050}", "SendMsg") Func SendMsg() MsgBox($MB_SYSTEMMODAL, "Key Pressed", "Key Pressed") EndFunc But nothing happens. I have also tried {ASC 0x50} and other variations I could think of.And as I just wrote that last sentence I realized that ASC simply uses an ASCII character, not the key codes. Oh well, I'll leave it in the post. The question becomes: How do I use the hex key codes to trigger a function? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now