Jump to content

Recommended Posts

Posted

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")

 

Posted

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

 

Posted

that worked perfectly! thank you so much. i'm still learning nested value loops, so you helped with multiple thing for me in your one answer!

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
  • Recently Browsing   0 members

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