Thought I'd make a new thread as I have narrowed down the problem a bit more. It is a bit long but I would really appreciate some assistance!
I am trying to send keystrokes to two SWG (Star Wars Galaxies) windows at the same time, but it seems like ControlSend isn't working.
Here is the first version of the script.
Code:
WinGet, swgid, List, Star Wars Galaxies
~7::
KeyWait 7
IfWinActive, Star Wars Galaxies
{
ControlSend,, 7, ahk_id %swgid1%
ControlSend,, 7, ahk_id %swgid2%
Return
}
This didn't work, so I tried the following.
Code:
WinGet, swgid, List, Star Wars Galaxies
~7::
KeyWait 7
IfWinActive, Star Wars Galaxies
{
ControlSend,, 7, ahk_id %swgid1%
Sleep, 1000
ControlSend,, 7, ahk_id %swgid1%
Return
}
This should simply have sent the same key to the window twice, but still no luck.
So, I tried the Send command and created the following script.
Code:
WinGet, swgid, List, Star Wars Galaxies
~7::
KeyWait 7
IfWinActive, Star Wars Galaxies
{
Send, 7
Sleep, 1000
Send, 7
Return
}
This does in fact send the keystroke to the active window twice, so this works (but problem is obviously that I want to send keystrokes to two windows).
So, next step was to see if the windows were being handled correctly, so made this script.
Code:
~7::
KeyWait 7
IfWinActive, Star Wars Galaxies
{
IfWinActive, ahk_id %swgid1%
{
WinActivate, ahk_id %swgid2%
Sleep, 500
Send, 7
Sleep, 100
WinActivate, ahk_id %swgid1%
Sleep, 2000
Return
}
IfWinActive, ahk_id %swgid2%
{
WinActivate, ahk_id %swgid1%
Sleep, 500
Send, 7
Sleep, 100
WinActivate, ahk_id %swgid2%
Sleep, 2000
Return
}
Return
}
This works, but the swapping of windows is extremely annoying and obviously removes half the point of doing this.
So, my question, how can I send the keystroke to two windows, when ControlSend isn't working?
Thanks!