Sign in to follow this  
Followers 0
arkane

hotkeyset altgr ? :o

18 posts in this topic

Hi, 1st, sorry for my english :whistle:.

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 !

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If you mean press alt, then "g" and then "r" or both "g" and "r" at the same time then it will not work. You can't make a hotkey with more than 1 key that is not alt, ctrl, shift.

So any combination like alt+c+1 will not work or g+f+6 will not work, but a combination like alt+ctrl +g will work.

Edited by Dethredic

"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites

Nope, I mean the AltGr key (RMENU, the other alt key on the right of Space)

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by JBr00ks

Share this post


Link to post
Share on other sites

Basicly, AltGr = Alt+Control, but "^!" doesn't work.

Share this post


Link to post
Share on other sites

I already have tessted this, but that doesn't work :whistle:.

Share this post


Link to post
Share on other sites

#9 ·  Posted (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 by arkane

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

OK, I found these links, just in General:

WikiPedia

To start press the ALTGR key.

The key to the ALTGR problem

Just 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
EndIf

Doesn't work aswell. I will keep looking.

Edited by JBr00ks

Share this post


Link to post
Share on other sites

#11 ·  Posted (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 by arkane

Share this post


Link to post
Share on other sites

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....

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#16 ·  Posted (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 by kiwikid

Share this post


Link to post
Share on other sites

It doesn't work :whistle:.

Share this post


Link to post
Share on other sites

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?

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