Log in

View Full Version : does "if WinActivate" work?



hotsuma
08-14-2008, 10:32 PM
I was wondering if something like this would work:

----------------

1::

KeyWait, 1, D

{

if WinActivate, ahk_id %wowid1%
{
ControlSend,, 2, ahk_id %wowid1%

ControlSend,, Numpad2, ahk_id %wowid2%


} else {
ControlSend,, Numpad2, ahk_id %wowid1%

ControlSend,, 2, ahk_id %wowid2%}

Return

}

Imrac
08-16-2008, 01:11 AM
Yes it should:

1::
if WinActivate, ahk_id %wowid1%
{
ControlSend,, 2, ahk_id %wowid1%
ControlSend,, Numpad2, ahk_id %wowid2%
}
else
{
ControlSend,, Numpad2, ahk_id %wowid1%
ControlSend,, 2, ahk_id %wowid2%}
}
Return
**Note: Not Tested***

Lokked
08-16-2008, 10:43 AM
If you are using the below method of defining the Alt's windows versus the active window:


ClonesPush(strKeys)
{
global WowWinId1
global WowWinId2
IfWinNotActive, ahk_id %WowWinId1%
ControlSend, , %strKeys%, ahk_id %WowWinId1%
IfWinNotActive, ahk_id %WowWinId2%
ControlSend, , %strKeys%, ahk_id %WowWinId2%
}

Then you only need to do this:


~2::ClonesPush("{numpad2 down}{numpad2 up}")

This makes it so that whenever the active window presses 2, the alt will press Numpad 2.

hotsuma
08-21-2008, 02:28 AM
o i only just checked back , thanks that will help clean up my code a lot i was doing it the original way i posted thanks