giganut 109 Posted March 29, 2018 Report Share Posted March 29, 2018 Hello everyone, if your using the ExBrowser then you may have noticed that from time to time the Selenium drive can hang and stay running on your system, Chrome can do the same thing. The clean up commands don't always work, so I came up with this code to ensure that every time you close your bot thous processes get killed no matter what. If your like me and have a tone of money invested into plugin you can run this code, the plugins used in the code are as follows below. ->> Hope this helps.... Bigtable.dll ->> http://network.ubotstudio.com/forum/index.php/topic/16308-free-plugin-large-data/Advanced Systems.dll ->> http://network.ubotstudio.com/forum/index.php/topic/16318-sell-plugin-advanced-systems/Advanced Ubot 2.dll ->> http://network.ubotstudio.com/forum/index.php/topic/17500-sell-plugin-advanced-ubot-2/ ChromeDriverKiller2(#ChromeKillerCode2) /* -------------------------------------------------------------------------------------------- */ on load("Bot Loaded") { plugin command("Advanced Ubot.dll", "run as administrator") plugin command("Advanced Ubot 2.dll", "on closing", "Are you sure you want to close?", "Closing", "Warning", "Yes/No/Cancel", "ChromeDriverKiller2(#ChromeKillerCode2)", "", "", "True", "", "True", 5) } /* -------------------------------------------------------------------------------------------- */ define ChromeDriverKiller2(#ChromeKillerCode2) { set(#chromePID,$plugin function("Advanced Systems.dll", "$system get process id", "chrome", "False", "False", "True"),"Global") plugin command("Bigtable.dll", "large List from text", "chromePID", #chromePID, $new line, "replace") set(#chromePIDtotal,$plugin function("Bigtable.dll", "Large list total", "chromePID"),"Global") set(#ChromeDriverPID,$plugin function("Advanced Systems.dll", "$system get process id", "chromedriver233x", "False", "False", "True"),"Global") plugin command("Bigtable.dll", "large List from text", "ChromeDriverPID", #ChromeDriverPID, $new line, "replace") set(#ChromeDriverPIDTotal,$plugin function("Bigtable.dll", "Large list total", "ChromeDriverPID"),"Global") set(#ChromePID,$plugin function("Advanced Systems.dll", "$system get process id", "Chrome", "False", "False", "True"),"Global") plugin command("Bigtable.dll", "large List from text", "ChromePID", #ChromePID, $new line, "replace") set(#ChromePIDTotal,$plugin function("Bigtable.dll", "Large list total", "ChromePID"),"Global") set(#GoogleChromePID,$plugin function("Advanced Systems.dll", "$system get process id", "Google Chrome", "False", "False", "True"),"Global") plugin command("Bigtable.dll", "large List from text", "GoogleChromePID", #GoogleChromePID, $new line, "replace") set(#GoogleChromePIDTotal,$plugin function("Bigtable.dll", "Large list total", "GoogleChromePID"),"Global") if($comparison(#chromePID,"!= Does not equal",$nothing)) { then { loop(#chromePIDtotal) { plugin command("Advanced Systems.dll", "system process actions", $plugin function("Bigtable.dll", "Large list item", "chromePID", 0), "Kill") plugin command("Bigtable.dll", "Large list Remove item", "chromePID", 0) } } } if($comparison(#GoogleChromePID,"!= Does not equal",$nothing)) { then { loop(#GoogleChromePIDTotal) { plugin command("Advanced Systems.dll", "system process actions", $plugin function("Bigtable.dll", "Large list item", "GoogleChromePID", 0), "Kill") plugin command("Bigtable.dll", "Large list Remove item", "GoogleChromePID", 0) } } } if($comparison(#ChromePID,"!= Does not equal",$nothing)) { then { loop(#ChromePIDTotal) { plugin command("Advanced Systems.dll", "system process actions", $plugin function("Bigtable.dll", "Large list item", "ChromePID", 0), "Kill") plugin command("Bigtable.dll", "Large list Remove item", "ChromePID", 0) } } } if($comparison(#ChromeDriverPID,"!= Does not equal","")) { then { loop(#ChromeDriverPIDTotal) { plugin command("Advanced Systems.dll", "system process actions", $plugin function("Bigtable.dll", "Large list item", "ChromeDriverPID", 0), "Kill") plugin command("Bigtable.dll", "Large list Remove item", "ChromeDriverPID", 0) } } } } 2 Quote Link to post Share on other sites
Bot-Factory 602 Posted March 29, 2018 Report Share Posted March 29, 2018 Hello. Thanks for your effort. This actually should not be necessary. The EXB Plugin tracks all process IDs of processes that are launched. The only thing when something can remain on the system is when your bot crashes. Because then the exit code is not able to catch it. But the plugin only tracks the processes that it launched in that instance. So the cleanup will not kill any browser or driver that was launched by other processes.The reason for that is, that many users are running multiple bots on a system. And therefore it's not possible to investigate which bot started what.What I could add of course is a special cleanup command, that will kill all Chrome, Firefox and Driver processes on a system no matter what.Like Ultimate Clenup. That one could be used to clean a system in case you're absolutely sure you want to do that and there are no other bots running for example. I can add that in the next version. I think that should be a bit easier than using additional plugins and code? Let me know what you think. PS: The name of the drivers and processes can change between versions! RegardsDan Quote Link to post Share on other sites
giganut 109 Posted March 29, 2018 Author Report Share Posted March 29, 2018 They stay running on my windows 10 all the time, you can see browsers that are left running and drivers when the bot gets closed, and sometimes the browser dose not close when a bot is closed so this kills them. I use this because clients ask me why browsers are still running, so they think there is something meticulous happening in thous browsers, for me this is very necessary. Such a command would be great. Chrome tries to be tricky and name there browser "LIKE" different names to confuse kill processes such as this. "LIKE" different names: chromeChromeGoogle Chrome Quote Link to post Share on other sites
Bot-Factory 602 Posted March 29, 2018 Report Share Posted March 29, 2018 They stay running on my windows 10 all the time, you can see browsers that are left running and drivers when the bot gets closed, and sometimes the browser dose not close when a bot is closed so this kills them. I use this because clients ask me why browsers are still running, so they think there is something meticulous happening in thous browsers, for me this is very necessary. Such a command would be great. Chrome tries to be tricky and name there browser "LIKE" different names to confuse kill processes such as this. "LIKE" different names: chromeChromeGoogle Chrome Hm that's very interesting. I'll do some more tests with that cleanup routine when I have some time next week. Because in my tests that worked perfectly fine.But maybe something has changed in recent browser versions. And that code is already couple of months old. And unfortunately I don't have the resources to test every single feature with every browser update.That's why I release beta versions and ask for feedback from the users. So thanks for the info. PS: Next time send me a ticket as well please, so I don't miss it. Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted March 30, 2018 Report Share Posted March 30, 2018 For now you can use this to kill all chrome's shell("TASKKILL /F /IM chrome.exe /T") it's freeIf you would like to know about what TASKKILL does open a command prompt and type TASKKILL /?Regards,CD 2 Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted March 30, 2018 Report Share Posted March 30, 2018 You can also use the FREE "Advanced Shell" plugin freom ubotdev.com and do all that and some. 1 Quote Link to post Share on other sites
Bot-Factory 602 Posted May 8, 2018 Report Share Posted May 8, 2018 Latest EXB Update (1.3.2.6) has an option for cleanup command to kill all those processes automatically. Hope it helps. RegardsDan Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.