Log in

View Full Version : AHK script help (on the fly main change)



hotsuma
08-11-2008, 09:17 PM
Hello,

I have been playing around with AHK scripts and i am trying to find a way to set the variables in my script.

Basically i play two copies of wow windowed and i want to be able to press "C" and whichever window is active set that to variable "%chrMAIN%" and the other id is "%chrAlt%"

In the end i want to be able to play windowed and alt tab between them and with a press of "C" change whichever one i am on to my main.



I know how to make a toggle button but i would rather it detect which window i am currently looking at and set that variable to the main


or can i do this without pressing c? like it always checks what window i am looking at??

hotsuma
08-11-2008, 09:45 PM
this is the best i can guess but there has to be a better cleaner way to do it

~c::
KeyWait c
IfWinActive, World of Warcraft
{
WinGet, wowid, List, World of Warcraft
chrMAIN = %wowid1%
chrAlt = %wowid2%
If WinActive = %wowid1%
chrMAIN = %wowid1%
else
chrMAIN = %wowid2%
chrAlt = %wowid1%
}


i doubt the syntax will work with 2 things to do after the else and if winactive is the command i am looking for

hotsuma
08-12-2008, 12:53 AM
My next try, hopefully whenever i press "C" it will set the vars on the fly ill try it when i get home.

c::
KeyWait, c, D
IfWinActive, World of Warcraft
{

; Get both ID's variables
WinGet, wowid, List, World of Warcraft
winone = %wowid1%
wintwo = %wowid2%

; Get current window a variable
WinGet, active_id, ID, A
active = %active_id%

; Make the active chrMAIN & not active chrAlt
if %active% = %winone%
chrMAIN = %winone%
chrAlt = %wowid2%
else
chrMAIN = %wintwo%
chrAlt = %winone%
Return
}

Metalocalypse
08-12-2008, 10:55 AM
why not do it ingame instead of writing some code where you just promote the toon to leader.. wouldn't that save a lot of hassle?

hotsuma
08-12-2008, 06:55 PM
so i have wow in 2 windows on 1 screen , i want to be able to change mains quickly for collecting quest's and such.

what i have setup last night is this.

shift + 1 : char1 recieves shift + 1, char2 recieves shift + 2

shift + 2 : char1 recieves shift + 2, char2 recieves shift + 1

so i have setup 2 sets of spell bars shift1 (1 to =) no macros and shift 2 (1 to = ) all assist macros and follow etc both bar sets are identicle on each character.



Shift 1 on both characters is standard spells no macros or assist spells exactly like if i was only playing 1 character.

But when i press shift + 1 on either character it sends shift + 2 to the other and all those spells have macros with "/assist otherplayername" in the first line.

so now if i change to one char i press shift + 1 and keep playing like i am only on one character then if i change to the other i just press shift + 2 it changes the spell bars on both

hotsuma
08-12-2008, 11:58 PM
STILL WIP - not sure if this needs winactivate

NumPad1::

KeyWait, NumPad1, D

IfWinActive, World of Warcraft

{

WinMaximize, ahk_id %wowid1%

WinMinimize, ahk_id %wowid2%

WinActivate, ahk_id %wowid1%

ControlSend,,{shift down}{1 down}{1 up}{shift up}, ahk_id %wowid1%

ControlSend,,{shift down}{2 down}{2 up}{shift up}, ahk_id %wowid2%

Return

}



NumPad2::

KeyWait, NumPad2, D

IfWinActive, World of Warcraft

{

WinMinimize, ahk_id %wowid1%

WinMaximize, ahk_id %wowid2%

WinActivate, ahk_id %wowid2%

ControlSend,,{shift down}{2 down}{2 up}{shift up}, ahk_id %wowid1%

ControlSend,,{shift down}{1 down}{1 up}{shift up}, ahk_id %wowid2%

Return

}

Binaryzero
08-13-2008, 12:05 AM
Check out [AutoHotKey] AutoHotKey DualBox Script ('http://www.dual-boxing.com/forums/index.php?page=Thread&threadID=10880') and see if it helps...