Sign in to follow this  
Followers 0
Pathologic

Controlsend (or perhaps sendex?) interrupting other manually held keys?

1 post in this topic

Hey all,

In the general sense, is there any reason why the above commands would interrupt other keys that are currently being held down on the keyboard?

I'm using controlsend to send commands via a simplified version of sendex that I used to solve my earlier problem of sticking modifier keys, and a simply while loop with a rundown of if then elseif checks to send specific keys. However, every now and then, I will be holding down a key manually on the keyboard (for example, holding down up or down to scroll through a list), and the key gets "interrupted"; it's as if I've lifted the keypress when I haven't. 

 

#include <Misc.au3>
#include <MsgBoxConstants.au3>


Hotkeyset("{Pause}","Go")
Hotkeyset("{Scrolllock}","Bashg")

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

$s = 0
$bashg = 0


Func _SendEx($ss)
    While _IsPressed("10") Or _IsPressed("11") Or _IsPressed("12")
        Sleep(50)
    WEnd
    ControlSend("Listit","","",$ss)
EndFunc

Func Go()
   If $s == 1 then
   $s = 0
Else
   $s = 1
   EndIf
EndFunc

Func Bashg()
   If $bashg == 1 then
   $bashg = 0
Else
   $bashg = 1
   EndIf
EndFunc


While 1
      If $s == 1 and PixelGetColor(1890,429) == 0x00FF00 Then
            if PixelGetColor(1910,416) == 0x00FF00 and $bashg == 1 Then
                  _SendEx("{TAB}")
            EndIf  
            
            if PixelGetColor(1869,394) == 0x00FF00 Then
                _SendEx("{ENTER}")
            endif
        
            if PixelGetColor(1869,406) == 0x00FF00 Then
                _SendEx("{F3}")
             Elseif PixelGetColor(1889,396) == 0x00FF00 Then
                _SendEx("{F4}")
             Elseif PixelGetColor(1892,412) == 0x00FF00 Then
                _SendEx("{F5}")
             Elseif PixelGetColor(1867,427) == 0x00FF00 Then
                _SendEx("{F6}")
             Elseif PixelGetColor(1890,429) == 0x00FF00 Then
                _SendEx("{F7}")
             EndIf

        EndIf
    Sleep(150)
WEnd

 

I hope that's readable, I used the insert code button :s Pause enables the script in general, scrollock enables tabbing (sometimes I dont want that specific action). Everything else I think is pretty basic stuff. Is it a matter of too many keys being sent at the same time or something? It's not at times when I am pressing modifier keys on the keyboard or anything like that; generally speaking it's just while pressing directional keys or numpad keys.. could be any keys but I haven't checked with anything else. 

 

I guess I could add the keys I don't want interrupted to the _sendex function, but I kind of want the function to keep running in the background even while I'm holding those keys down. Any ideas? 

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