Sign in to follow this  
Followers 0
miloOmelo

send stucks keys why ?

3 posts in this topic

#1 ·  Posted (edited)

#include <Misc.au3>

Global $hDLL = DllOpen("user32.dll")

HotKeySet("{SPACE}","RSendHold")

Send("{NUMLOCK on}")

While 1 

sleep(60)

Wend

 

Func RSendHold()

If _IsPressed("26", $hDLL) Then
Send("{NUMPADADD down}")
Send("{NUMPAD8 down}")
Send("{NUMPADADD up}")
Send("{NUMPAD8 up}")

Endif

If _IsPressed("28", $hDLL) Then
Send("{NUMPADADD down}")
Send("{NUMPAD2 down}")
Send("{NUMPADADD up}")
Send("{NUMPAD2 up}")
EndIf

 

If _IsPressed("25", $hDLL) Then
Send("{NUMPADADD down}")
Send("{NUMPAD4 down}")
Send("{NUMPADADD up}")
Send("{NUMPAD4 up}")
EndIf

 

If _IsPressed("27", $hDLL) Then
Send("{NUMPADADD down}")
Send("{NUMPAD6 down}")
Send("{NUMPADADD up}")
Send("{NUMPAD6 up}")
EndIf

EndFunc
DllClose($hDLL)

exit

=======================

keys get stuck sometimes ( usually left arrow - numpad4 or numpad 6) , i tested adding a little sleep (50) between the down and up release but same thing 

i want the script to wait for Spacebar - hotkey , then i want it to wait for either one of the arrow keys (the nampad respective numbers ) to be pressed so it immidiately sends the respecive sequences depending on the numkey that was pressed after the hotkey is triggered and then go to while loop and wait for next time spacebar is clicked

i want both the keypresses to be simulated as being held together as for example right key and + key are held down and send together like when we press and hold control alt del for taskmanager

i occasionaly get keys stuck , whats wrong with the script ?

Edited by miloOmelo

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

i found that function before posting , it seemed too complicated for me, i will use this though

ControlSend("", "", "", "text", 0)

i use to use this , it might work, however i have a feeling my code is not good even if i add 

ControlSend("", "", "", "text", 0)

after each "send up"

those 4 is statments should be replaced with a case statment but i dont know to compine case statments and _IsPressed or probably its exactly the same thing

 

tested,keys still occasionaly get stuck

added : 

Local $x
for $x=0 to $x=1

if statments

Next

 inside the function --> will test again , it might work now

edit, they do get unstuck but it it now locks those keys from being used other times it doesnt lock them, so its a mess

anyhow that link u posted reminded me 

ControlSend("", "", "", "", 0)

which works great, so thanks , i might need to do adjustments with arrow keys instead of numkeys and i used numkeys cause send help file didnt have keys for numpad side , i suppose it refers to them as arrows as well as the regular arrows, so ill use that and most likely it will be ok

See this - http://www.autoitscript.com/wiki/FAQ#Why_does_the_Ctrl_key_get_stuck_down_after_I_run_my_script.3F, it may help.

Edited by miloOmelo

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