Deye Posted December 25, 2017 Posted December 25, 2017 (edited) @ keeping only certain tabs open flushing out the rest, worked out from this help and support topic Note that if chrome is busy processing something like waiting for a page to respond or anything like that there is a good chance the script then hangs expandcollapse popup#include <WinAPI.au3> Global $aProtected[5] = [4, "Gmail", "autoit", "Google Search", "YouTube"] Local $a = WinList("[CLASS:Chrome_WidgetWin_1]") If Not IsArray($a) Then Exit For $i = 1 To UBound($a) - 1 If $a[$i][0] Then _Process($a[$i][1]) Next Func _Process($hWnd) Local $hC = _WinAPI_GetClassName(_WinAPI_GetWindow($hWnd, $GW_CHILD)), $bClose = True, $x = 1, $tmp WinActivate($hWnd) ControlSend($hWnd, "", $hC & 1, "^t") ControlSend($hWnd, "", $hC & 1, "^t") ControlSend($hWnd, "", $hC & 1, "^{TAB}") $oBuffer = ObjCreate('Scripting.Dictionary') Do $bClose = True $tmp = WinGetTitle($hWnd, "") If $oBuffer.Exists($tmp) Then ControlSend($hWnd, "", $hC & 1, "^w") Else For $i = 1 To $aProtected[0] If StringInStr($tmp, $aProtected[$i]) Then $bClose = False ExitLoop EndIf Next If $bClose Then ControlSend($hWnd, "", $hC & 1, "^w") Else $x += 1 EndIf $oBuffer.Item($tmp) = 1 EndIf Sleep(300) ControlSend($hWnd, "", $hC & 1, "^+{TAB}") Until Not HWnd(ControlGetHandle($hWnd, "", $hC & $x + 1)) EndFunc ;==>_Process Edited December 25, 2017 by Deye Slowed down Earthshine 1
Earthshine Posted December 25, 2017 Posted December 25, 2017 (edited) Excellent work. Hey, this could be used in another thread where the guy couldn’t get his chrome tabs to close Edited December 25, 2017 by Earthshine Deye 1 My resources are limited. You must ask the right questions
Deye Posted December 25, 2017 Author Posted December 25, 2017 Earthshine, glad you liked it slowed it down now so it's more reliable and seizure free
DynamicRookie Posted January 3, 2018 Posted January 3, 2018 (edited) On 25/12/2017 at 6:07 AM, Deye said: @ keeping only certain tabs open flushing out the rest, worked out from this help and support topic Note that if chrome is busy processing something like waiting for a page to respond or anything like that there is a good chance the script then hangs expandcollapse popup#include <WinAPI.au3> Global $aProtected[5] = [4, "Gmail", "autoit", "Google Search", "YouTube"] Local $a = WinList("[CLASS:Chrome_WidgetWin_1]") If Not IsArray($a) Then Exit For $i = 1 To UBound($a) - 1 If $a[$i][0] Then _Process($a[$i][1]) Next Func _Process($hWnd) Local $hC = _WinAPI_GetClassName(_WinAPI_GetWindow($hWnd, $GW_CHILD)), $bClose = True, $x = 1, $tmp WinActivate($hWnd) ControlSend($hWnd, "", $hC & 1, "^t") ControlSend($hWnd, "", $hC & 1, "^t") ControlSend($hWnd, "", $hC & 1, "^{TAB}") $oBuffer = ObjCreate('Scripting.Dictionary') Do $bClose = True $tmp = WinGetTitle($hWnd, "") If $oBuffer.Exists($tmp) Then ControlSend($hWnd, "", $hC & 1, "^w") Else For $i = 1 To $aProtected[0] If StringInStr($tmp, $aProtected[$i]) Then $bClose = False ExitLoop EndIf Next If $bClose Then ControlSend($hWnd, "", $hC & 1, "^w") Else $x += 1 EndIf $oBuffer.Item($tmp) = 1 EndIf Sleep(300) ControlSend($hWnd, "", $hC & 1, "^+{TAB}") Until Not HWnd(ControlGetHandle($hWnd, "", $hC & $x + 1)) EndFunc ;==>_Process This is just what i needed, tysm But how i can add an exception to dont close a certain tab? EDIT: Nvm, i did not notice about the $aProtected variable, still nice work with this script, keeps clean my browser. Edited January 3, 2018 by DynamicRookie
water Posted January 3, 2018 Posted January 3, 2018 DR, it is not necessary to quote every post you want to reply to. It just clutters the thread. Simply click on the Reply button. And if needed refer to a post number or the name of the other poster Earthshine, DynamicRookie and JLogan3o13 3 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Deye Posted August 15, 2018 Author Posted August 15, 2018 (edited) Recent changes in chrome wont work with the above Only to show that things are still workable I uploaded a runnable example: Edited August 15, 2018 by Deye
Danp2 Posted August 15, 2018 Posted August 15, 2018 Why would you upload this without including source code? Deye 1 Latest Webdriver UDF Release Webdriver Wiki FAQs
Deye Posted August 15, 2018 Author Posted August 15, 2018 Hi Danp2, Sorry, didn't mean to mislead .. I'm using more or less the same method as above For now .., any one motivated to come up with there own can compare the results with this one if that's something to try .. i reckoned that there ain't something that is worth to promote with this and probably not something that is acceptable by the chrome team ! I'm also tying to test other things - encryption methods @compiles and stuff.. Thanks Deye
Deye Posted August 17, 2018 Author Posted August 17, 2018 (edited) Hi, Can any one only give an approval that this last version is running properly Its already at version 1.0.0.8 , Overcoming all former glitches .. * in my tests, if the browser is super busy then it may miss a tab that was intended to be closed, else all otherwise .. * IGWS: if your AV warns you of a virus then don't post back on such a thing (It isn't ) Thanks Deye Edited August 17, 2018 by Deye
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