Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

How exactly AHK Send work?


  • Please log in to reply
1 reply to this topic
tarcinli
  • Members
  • 2 posts
  • Last active: Feb 06 2015 02:15 PM
  • Joined: 25 May 2013

I have a bot written in Java and I have a problem with actual keyboard inputs interfering with my messages.

 

I'm using PostMessage thru JNA and it sends {Down} every sec. But if user presses ctrl key down before it sends it, it is treated as ctrl+down and behaves differently. I tried same thing in AHK

IfWinExist BlueStacks App Player
{
    WinActivate
    Loop, 10 {
        Send {Down}
        Sleep 1000
    }
}

This works perfect. Even when I spam ctrl button while it is running, it does not interfere with it.

 

Although I tried using ControlSend since it should work on background windows, but it didn't work.(Same ControlSend in autoIT works tho)

So how does ahk do it?

I tried to read source code of ahk but it is really hard to understand what is going on without visual studio.

 

I tried sleeping until ctrl is up(via GetKeyState) before sending my input but that's not ideal case ofcourse. And there can still be race condition.

Does ahk use sendinput with AttachThreadInput or postmessage or blockinput or whatever



pensaer
  • Members
  • 23 posts
  • Last active: Aug 04 2015 01:19 AM
  • Joined: 06 Apr 2015

I'm new but with what I experienced you can't block the loop unless you exit the app