Jump to content

WinActivate with conflicting/same titles


Schwoby
 Share

Recommended Posts

i am attempting to activate two different 'Google Chrome' windows. one is a specific window title that never changes and maintains the focus during/between script runs. the other window title will change on a regular basis. if i do something like this:

Opt("WinTitleMatchMode", 2)
WinActivate("Google Chrome")
WinActivate("<Static Name> - Google Chrome")

when i click on the non-static window first, then run the script, it works as desired. if the static window is active most recently (of the chrome windows), then the script activates the static window twice. does anyone know of a way to properly script a sudo statement like:

WinActivate("Google Chrome") Where NOT WinActive("<Static Name> - Google Chrome")

 

Link to comment
Share on other sites

You could do something like this --

Local $aList = WinList("Google Chrome")

    ; Loop through the array displaying only visable windows with a title.
    For $i = 1 To $aList[0][0]
        If StringInStr($aList[$i][0], "<Static Name>") = 0 Then
            WinActivate($aList[$i][1])
            ExitLoop
        EndIf
    Next

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...