 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
muffen
Joined: 15 Sep 2008 Posts: 11
|
Posted: Mon Sep 15, 2008 11:24 pm Post subject: 2 x Star Wars Galaxies |
|
|
Hi,
I'm trying to write a script for Star Wars Galaxies such that I can control two characters at the same time.
Basically, I want certain keystrokes to be sent to two different Star Wars Galaxies windows at the same time.
However, I cannot seem to get the script to work.
I've searched the forums and also been looking on google and I've read the helpfile quite a bit.
I have tried adding messageboxes and it seems like the script is running through with no errors which is why I am at a loss here...
Any help would be greatly appreciated.
This is the script I have so far:
WinGet, swgid, List, Star Wars Galaxies
~7::
KeyWait 7
IfWinActive, Star Wars Galaxies
{
ControlSend,, 7, ahk_id %swgid1%
ControlSend,, 7, ahk_id %swgid2%
Return
}
WinGet, swgid, List, Star Wars Galaxies
~8::
KeyWait 8
IfWinActive, Star Wars Galaxies
{
ControlSend,, 8, ahk_id %swgid1%
ControlSend,, 8, ahk_id %swgid2%
Return
}
WinGet, swgid, List, Star Wars Galaxies
~9::
KeyWait 9
IfWinActive, Star Wars Galaxies
{
ControlSend,, 9, ahk_id %swgid1%
ControlSend,, 9, ahk_id %swgid2%
Return
}
WinGet, swgid, List, Star Wars Galaxies
~0::
KeyWait 0
IfWinActive, Star Wars Galaxies
{
ControlSend,, 0, ahk_id %swgid1%
ControlSend,, 0, ahk_id %swgid2%
Return
}
Return
Thank you! |
|
| Back to top |
|
 |
muffen
Joined: 15 Sep 2008 Posts: 11
|
Posted: Tue Sep 16, 2008 12:13 am Post subject: |
|
|
A small update, if I use "Send" it works, but obviously "Send" only sends the keystroke to the active window which defeats the whole purpose of writing this script.
... just thought I'd add it in case it makes any difference. |
|
| Back to top |
|
 |
muffen
Joined: 15 Sep 2008 Posts: 11
|
Posted: Tue Sep 16, 2008 1:31 pm Post subject: |
|
|
| I know SWG isn't the most commonly played game these days, but noone has used AHK to play 2xSWG's? |
|
| Back to top |
|
 |
Sivvy
Joined: 21 Jul 2008 Posts: 726 Location: Calgary, AB, Canada
|
Posted: Tue Sep 16, 2008 3:32 pm Post subject: |
|
|
| I assume it would be quite similar to World of Warcraft Multi-Boxing... Have you tried taking a look at those scripts? Do a forum search. |
|
| Back to top |
|
 |
muffen
Joined: 15 Sep 2008 Posts: 11
|
Posted: Tue Sep 16, 2008 3:38 pm Post subject: |
|
|
| Sivvy wrote: | | I assume it would be quite similar to World of Warcraft Multi-Boxing... Have you tried taking a look at those scripts? Do a forum search. |
The script I posted is based on a WoW script, and I did a forum search and looked through a multitude of them, and pretty much all of them use the functions as I have them.
Also, I verified the functions used and I cannot see any errors in the script I've posted, but it still doesn't work :-/ |
|
| Back to top |
|
 |
Sivvy
Joined: 21 Jul 2008 Posts: 726 Location: Calgary, AB, Canada
|
Posted: Tue Sep 16, 2008 3:45 pm Post subject: |
|
|
| Maybe try moving all of the"Return" statements outside the If statements. I think that may contribute. They are all inside the Braces. |
|
| Back to top |
|
 |
muffen
Joined: 15 Sep 2008 Posts: 11
|
Posted: Tue Sep 16, 2008 6:36 pm Post subject: |
|
|
Thanks for the suggestion, unfortunately, oving the return makes no difference.
I have actually realized that ControlSend is the part that is not working.
If I do it this way it works, although the swapping windows part is extremely annoying and I would prefer to not to it this way.
~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
} |
|
| Back to top |
|
 |
Bytales
Joined: 06 Sep 2008 Posts: 84
|
Posted: Tue Sep 16, 2008 7:34 pm Post subject: |
|
|
If win Exist, (window 1) by ahk class, make it active, send the click.
Try making active the window you want to click before each click ! |
|
| Back to top |
|
 |
muffen
Joined: 15 Sep 2008 Posts: 11
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|