Sure. Glad to help. Sorry for not understanding your intent. Here is commented code. I commented on the A part, and of course, the B part operates under the same logic. Feel free to ask if it's still not clear.
Code: Select all
ActiveA := 0 ; set inital state to false (window A has not yet been acted on as the active window)
ActiveB := 0
SetTimer, A ; run subroutine A every 250 ms
SetTimer, B
A:
If WinActive("window") && !ActiveA ; execute this code block if window is active and the flag Active A is not set to true (i.e., it is 0 or false)
{
ActiveA := 1 ; set the flag to true
do something
}
If !WinActive("window") ; when the window is not found to be active...
ActiveA := 0 ; set the flag to false so the other if statement's condition will allow it to act when the window becomes active
Return
B:
If WinActive("other window") && !ActiveB
{
ActiveB := 1
do something
}
If !WinActive("other window")
ActiveB := 0
Return