Sign in to follow this  
Followers 0
sillyfool

Control Send and Inactive Windows

2 posts in this topic

#1 ·  Posted (edited)

So I've taken bits and pieces of information from all over the place and put them together. It does what I want it to do for the most part. There are just a few issues that have me wondering.

Here's the code:

WinSetTitle ("game","","game 2")
WinWaitActive("game")


HotKeySet("{PAUSE}", "Start")
HotKeySet("!{PAUSE}","Quit")

TogglePause()

func Start()
HotKeySet("{PAUSE}")
HotKeySet("{PAUSE}", "TogglePause")
ToolTip('SendSpace started.',0,0)
While 1
ControlSend("game", "", "", "{SPACE}")
ControlSend("game 2", "", "", "{SPACE}")
Sleep(Random(120000,240000))
WEnd
EndFunc

Func TogglePause()
ToolTip('SendSpace Stopped.',0,0)
HotKeySet("{PAUSE}")
HotKeySet("{PAUSE}", "Start")
While 1
sleep(100)
WEnd
EndFunc

func Quit()
Exit
EndFunc

So here's my situation. I have two instances of the game open. I changed one of the instance's title to game 2 to differentiate between the two windows. Now when I run the script it successfully manages to send "Space" to both windows when they're inactive only when game was the last one to be active. However, if game 2 was the last window to be active the script only successfully sends "Space" to game 2 and not game.

I was wondering how I could fix the code such that the script successfully sends "Space" regardless of which window, game or game 2, I had active last.

I'm new to AutoIt and any clarification would be greatly appreciated.

Edited by sillyfool

Share this post


Link to post
Share on other sites



The troubling word here is: game.

http://www.autoitscript.com/forum/forum-2/announcement-13-forum-rules/


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0