mmoalem Posted May 17, 2023 Share Posted May 17, 2023 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 More sharing options...
Danp2 Posted May 17, 2023 Share Posted May 17, 2023 You could use ProcessClose. If that doesn't work for you, then there's WinClose (you could add WinList if needed). mmoalem 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Skeletor Posted May 18, 2023 Share Posted May 18, 2023 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 mmoalem 1 Kind RegardsSkeletor "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 More sharing options...
mmoalem Posted May 18, 2023 Author Share Posted May 18, 2023 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 More sharing options...
Danp2 Posted May 18, 2023 Share Posted May 18, 2023 Doubtful, but I guess it could happen. That's why I suggested WinClose as an alternative. 🙂 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Solution OJBakker Posted May 18, 2023 Solution Share Posted May 18, 2023 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. pixelsearch 1 Link to comment Share on other sites More sharing options...
mmoalem Posted May 18, 2023 Author Share Posted May 18, 2023 (edited) 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 May 18, 2023 by mmoalem Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now