arkane Posted July 8, 2007 Share Posted July 8, 2007 Hi, 1st, sorry for my english . Well I would like to know how I can do to hotokeyset the altgr key. I've tried Func _IsPressed($hexKey) Local $aR, $bO $hexKey = '0x' & $hexKey $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey) If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then $bO = 1 Else $bO = 0 EndIf Return $bO EndFunc Global $Paused while 1 If _IsPressed('A5') = 1 Then myfunc() (I also have tried alt+ctrl) Sleep(10) Wend but it works very bad... like if when I press alt gr, alt or control still keep pressed. Thx for your help ! Link to comment Share on other sites More sharing options...
arkane Posted July 8, 2007 Author Share Posted July 8, 2007 Nope, I mean the AltGr key (RMENU, the other alt key on the right of Space) Link to comment Share on other sites More sharing options...
James Posted July 8, 2007 Share Posted July 8, 2007 (edited) I know what you mean, but looking in the Helpfile, I cannot find the actual hex code for this key. I will look on MSDN for you and see what I can find. #include <Misc.au3> HotKeySet("A5", "MyFunc") While 1 Sleep(100) WEnd Func MyFunc() MsgBox(4096, "You pressed:", "The AltGr key!") EndFunc Doing this, and pressing Shift+A makes the popup appear. I do not see anywhere the key that you are looking for. I dont think this is allowed to be pressed by AutoIt. Edited July 8, 2007 by JBr00ks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
arkane Posted July 8, 2007 Author Share Posted July 8, 2007 Basicly, AltGr = Alt+Control, but "^!" doesn't work. Link to comment Share on other sites More sharing options...
James Posted July 8, 2007 Share Posted July 8, 2007 Try this: #include <Misc.au3> $DLL = DllOpen("user32.dll") While 1 Sleep(100) Wend If _IsPressed("11", $DLL) & _IsPressed("12", $DLL) Then MsgBox(4096, "", "") Exit EndIf Un-Tested! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
arkane Posted July 9, 2007 Author Share Posted July 9, 2007 I already have tessted this, but that doesn't work . Link to comment Share on other sites More sharing options...
James Posted July 9, 2007 Share Posted July 9, 2007 Hmm.. I am not sure. I didnt get around to looking on MSDN for the Alt+Gr help, so I will do so now. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
arkane Posted July 9, 2007 Author Share Posted July 9, 2007 (edited) oh, and I have forgotten, getasynckeystate need a decimal value. My code now looks like : while 1 If _IsPressed('11') = 1 and _IsPressed('12') = 1 Then Space2() sleep(10) endif Wend and Func Space2() Send("{Space down}") Sleep(10) Send("{Space up}") sleep(25) Send("{Space down}") Sleep(10) Send("{Space up}") EndFunc But it's like if space was permanantly pressed, and like if altgr was fonctionning at the same time (permanantly pressed too), but I want that altgr be really bypassed. Edited July 9, 2007 by arkane Link to comment Share on other sites More sharing options...
James Posted July 9, 2007 Share Posted July 9, 2007 (edited) OK, I found these links, just in General:WikiPediaTo start press the ALTGR key.The key to the ALTGR problemJust to let you know that European keyboards do not work with the AltGr key, apparently.#include <Misc.au3> $DLL = DllOpen("user32.dll") While 1 Sleep(100) Wend If _IsPressed("11", $DLL) = 1 & _IsPressed("12", $DLL) =1 Then MsgBox(4096, "", "") Exit EndIfDoesn't work aswell. I will keep looking. Edited July 9, 2007 by JBr00ks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
arkane Posted July 9, 2007 Author Share Posted July 9, 2007 (edited) It doesn't work with this include with my version, but this code was working if I wrote it like this : Func _IsPressed($hexKey) Local $aR, $bO $hexKey = '0x' & $hexKey $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey) If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then $bO = 1 Else $bO = 0 EndIf Return $bO EndFunc While 1 If _IsPressed('11') = 1 and _IsPressed('12') = 1 Then MsgBox(4096, "", "") EndIf Wend But as I said, it works correctly with a msgbox, but If I call a send command, It sends it permantly, and the algr key isn't bypassed ... Edited July 9, 2007 by arkane Link to comment Share on other sites More sharing options...
James Posted July 9, 2007 Share Posted July 9, 2007 (edited) Here we go: #include <Misc.au3> $DLL = DllOpen("user32.dll") While 1 If _IsPressed('11', $DLL) = 1 and _IsPressed('12', $DLL) = 1 Then MsgBox(4096, "", "") EndIf Wend Works just fine for me! Pressing either AltGr or Ctrl+Alt will msgbox. Edited July 9, 2007 by JBr00ks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
arkane Posted July 9, 2007 Author Share Posted July 9, 2007 Here we go: #include <Misc.au3> $DLL = DllOpen("user32.dll") While 1 If _IsPressed('11', $DLL) = 1 and _IsPressed('12', $DLL) = 1 Then MsgBox(4096, "", "") EndIf Wend Works just fine for me! Pressing either AltGr or Ctrl+Alt will msgbox. Lol, yeah, that's what I told you 3 or 4 posts before lol xD. but if I use : While 1 If _IsPressed('11') = 1 and _IsPressed('12') = 1 Then Space2() sleep(10) EndIf Wend Func Space2() Send("{Space down}") Sleep(10) Send("{Space up}") sleep(25) Send("{Space down}") Sleep(10) Send("{Space up}") EndFunc Everything is buggy : Altgr send space permantly to my game, it doesn't works on windows, on my game, the space sequence is sent permanantly, and visibly, the altgrkey isn't bypassed, and the pression of altgr creates some bugs in my game so the game detects, Space, and altgr. Plus, if I press AltGr, it's like if ctrl+alt was permanantly pressed too, and I need to repress them to unfreeze them.... Link to comment Share on other sites More sharing options...
James Posted July 9, 2007 Share Posted July 9, 2007 Oh sorry :blush: Thats because your sleep isnt long enough. Sleep uses miliseconds. Look at time conversion in my signature to work out how long you need to sleep for. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
arkane Posted July 9, 2007 Author Share Posted July 9, 2007 I can set a sleep(2000) that I still got all theses bugs =), So I don't think there is a problem with the Sleep time. Or maybe I'm wrong. Link to comment Share on other sites More sharing options...
kiwikid Posted July 10, 2007 Share Posted July 10, 2007 (edited) I can set a sleep(2000) that I still got all theses bugs =), So I don't think there is a problem with the Sleep time.Or maybe I'm wrong.I would agree with JBr00ks on this one. The other day I learned exaclty what could be accomplished in about 500ms as I was trapping for a doubleclick event, and it's not all that much. As for your game I would have a hard time believing you would need to press and release the spacebar twice in less than the amount in takes to double click a mouse. Lengthen them out to be about 200ms a piece and try that. Edited July 10, 2007 by kiwikid Link to comment Share on other sites More sharing options...
arkane Posted July 10, 2007 Author Share Posted July 10, 2007 It doesn't work . Link to comment Share on other sites More sharing options...
Cusem Posted August 23, 2009 Share Posted August 23, 2009 Anybody any news on the ALTGR key? My new notebook has one and it really annoys me since I use ALT-LeftArrow a lot in the browser, so I wanted to create a function to bypass it, but apparently this isn't so easy. The example above works, but it also triggers CTRL+ALT which I do use a lot (no not only CTRL-ALT-DEL >_< ). So hotkeysetting or detecting ispresseds from LCTRL+RALT would do the trick I guess? 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