It could be just me but I'm thinking typing in window names is error prone especially if the windows have arroneous titles. Heres a concept to select windows that store the names to memory.
Code:
ySec := -3
xMarg := 0x1f4 ;0xfa
btnTxt = Button 1,Button 2
StringSplit, btnTxt, btnTxt,`,
Gui, Add, Text, Section vtxt1, Press button, then select the 1st Window.
Gui, Add, Button, ys%ySec% xm+%xMarg% gselW1, % btnTxt1
Gui, Add, Text, Section xm , Press button, then select the 2nd Window.
Gui, Add, Button, ys%ySec% xm+%xMarg% gselW2, % btnTxt2
Gui +AlwaysOnTop
Gui Show, NA, winSltr
Return
selW1:
selTxt = Select the 1st Window!,,
StringSplit, selTxt, selTxt,`,
SetTimer, blinkTxt1, On
blinkTxt1:
count++
ControlSetText, Static1, % selTxt%count%, ahk_class AutoHotkeyGUI
WinGetActiveTitle, acWin
SplitPath, acWin, acWin,
If acWin != winSltr
{
ControlSetText, Static1, % "Win 1 is : " acWin, ahk_class AutoHotkeyGUI
ControlMove, Static1,,, % xMarg,, ahk_class AutoHotkeyGUI
SetTimer, blinkTxt1, Off
}
Sleep, 0x1f4
If count > 2
count=
Return
selW2:
selTxt = Select the 2nd Window!,,
StringSplit, selTxt, selTxt,`,
SetTimer, blinkTxt2, On
blinkTxt2:
count++
ControlSetText, Static2, % selTxt%count%, ahk_class AutoHotkeyGUI
WinGetActiveTitle, acWin
SplitPath, acWin, acWin,
If acWin != winSltr
{
ControlSetText, Static2, % "Win 2 is : " acWin, ahk_class AutoHotkeyGUI
ControlMove, Static2,,, % xMarg,, ahk_class AutoHotkeyGUI
SetTimer, blinkTxt2, Off
}
Sleep, 0x1f4
If count > 2
count=
Return
Still a bit messy and lots of redundancy.
For instance the active window titles should be stored to an array.
Now the new window name overwrites the active window var.
Wrote on win7, not tested on XP..
hth