Sign in to follow this  
Followers 0
mladost1

Send keystrokes to program

6 posts in this topic

I have a simple question - is it possible to send keys to a not active window and if yes how?

~Thanks

Share this post


Link to post
Share on other sites



Controlsend()

Share this post


Link to post
Share on other sites

I'm rather looking for sending it to the whole application rather than to an exact control e.g. to a video game :)

Share this post


Link to post
Share on other sites

I'm rather looking for sending it to the whole application rather than to an exact control e.g. to a video game :)

Did you try controlsend? The help file says ...

ControlSend works in a similar way to Send but it can send key strokes directly to a window/control, rather than just to the active window.

If it doesn't work for you, try the exact same code for a non game window, its possible the game has protection against scripting.


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

But what should I put at the control ID variable in the ControlSend("title", "text", control ID, "string") function?

Share this post


Link to post
Share on other sites

Try WinGetHandle(). I would suggest looking at controls in the help file, and also Window Titles and Text (look up wingethandle, then click title special definitions)... good stuff.

Games though can be tricky, a lot of them have protection against bots and such.


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

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