Jump to content

close chrome and not edge


Go to solution Solved by OJBakker,

Recommended Posts

I have both Edge and Chrome open full screen - I want to get autoit to close the chrome browser and not edge. if i use mouse location it will close which ever one is in front which makes things more difficult. But if i want to close by class than i get the issue that both Edge and Chrome are showing class as Chrome_widgetwin (in AU3info)... is there a way of distinguishing them in class or another way to close Chrome?

Link to comment
Share on other sites

Yes, when you press Windows Key and R, you can call each browser by its "shortcut" name.


Microsoft Edge: msedge.exe
Google Chrome: chrome.exe
Mozilla Firefox: firefox.exe
Apple Safari: safari.exe
 

If ProcessExists("msedge.exe") Then
    ProcessClose("msedge.exe")
    MsgBox(52, "Success", "Microsoft Edge browser closed.")
Else
    MsgBox(20, "Not Found", "Microsoft Edge browser is not currently running.")
EndIf

 

Kind Regards
Skeletor

"Coffee: my defense against going postal."

Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI

Link to comment
Share on other sites

thanks both! processclose works well. However, I wonder if that is the best option as whwen I start chrome again it says that chrome didnt shutdown properly... can this cause chrome to get corrupted? 

Link to comment
Share on other sites

  • Solution

Use the windows title to select the browser you want and then use winclose.

The windows title will always end with "- browser name" so this should always work to select the correct browser.

Google Chrome: "title  - Google Chrome"
MS Edge: "title - Microsoft Edge" ; note there is 2 characters between Microsoft and Edge!

Using the default "window matching" mode will probably work, but to be certain the browsercheck is done only on the last part of the window title it is better to use a regular expression with RegExpTitle, see the manual for the details.

Link to comment
Share on other sites

thanks again to all of you - using 

WinClose("[REGEXPTITLE:(?i)(.* - Google Chrome)]")

and it works perfect!

 

sorry to mark only one of your posts as solution - didnt realise it wont allow me to mark more posts as solution!

Edited by mmoalem
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...