Jump to content

Hotkeyset problem ...


Alexxander
 Share

Go to solution Solved by DW1,

Recommended Posts

hi all
i'am using hotkeyset("a", "a") in my script
 
it is working well when i press "a" 
but the problem is when i press shift + a or ctrl + a or any two keys with "a" it will not work
 
i want my function to run even if i pressed "a" with other key
i tried HotKeySet("{LSHIFT}a")for example..
but the problem is this only works if shift + a are presses at the same second
it won't work if i pressed shift the i waited 1 second the i presses "a" then i released shift
 
any ideas ?

Link to comment
Share on other sites

  • Solution

Sounds like _IsPressed() would work better for what you need

#include <Misc.au3>
;~ HotKeySet('a', 'a')
Global $i = 0

While 1
    If _IsPressed(41) Then a()
    Sleep(10)
WEnd

Func a()
    $i += 1
    ConsoleWrite('a' & $i & @CRLF)
    While _IsPressed(41)
        Sleep(10)
    WEnd
EndFunc   ;==>a
Link to comment
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
 Share

×
×
  • Create New...