Jump to content

What is the code to tell if a Chrome browser is open?


Recommended Posts

I've looked but can't find the code to produce a "left mouse click" if no instance of a Chrome browser is open on my PC. That is, if I open a Chrome browser, and then it gets closed somehow, I want the code to notice this and the do a "left mouse click". Can anyone provide me with those few lines

Link to comment
Share on other sites

 

Local $hWnd = WinGetHandle("[CLASS:Chrome_WidgetWin_1]")
If $hWnd Then
    ConsoleWrite("$hWnd=" & $hWnd & @CRLF)
    While WinExists($hWnd)
        Sleep(100)
    WEnd
    ConsoleWrite("Chrome Win is closed" & @CRLF)

    Local $iMClick = MouseClick("left")
    ConsoleWrite("$iMClick=" & $iMClick & @CRLF)
Else
    ConsoleWrite("Chrome Win not found" & @CRLF)
EndIf

:welcome: to forum

I know that I know nothing

Link to comment
Share on other sites

Link to comment
Share on other sites

6 hours ago, Nine said:

There could be multiple instances of Chrome.  In your code, you only check one handle

I agree,
but here, since it's not specified, and what we're interested is,  if Chrome is open, I think it's sufficient
and the op can take a step further

I know that I know nothing

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...