DigDeep Posted May 2, 2018 Share Posted May 2, 2018 Is there a way we can stop specific site URL to stop from opening, regardless of any browser? Something like, looking for Browsers URL address as "https://www.autoitscript.com/forum/forum/2-autoit-general-help-and-support/?do=add" and if existing then close the Browser TAB. Link to comment Share on other sites More sharing options...
Danp2 Posted May 2, 2018 Share Posted May 2, 2018 First thing that comes to mind is to add entries to the Hosts file that point elsewhere. What's the ultimate goal? Are you trying to keep the kiddies off of porn sites, or is this for business purposes, or what? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
DigDeep Posted May 2, 2018 Author Share Posted May 2, 2018 Business Purpose. I am trying to uninstall some applications which is not a problematic area but at the end of the uninstaller, few websites open with survey links. Which we don't want. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 2, 2018 Moderators Share Posted May 2, 2018 Is the application installed through an MSI or EXE? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Danp2 Posted May 2, 2018 Share Posted May 2, 2018 OIC. Simplest option that comes to mind is to close all browsers at the beginning of your script and then monitor / kill any instances that get launched in the interim. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
DigDeep Posted May 2, 2018 Author Share Posted May 2, 2018 @Danp2. If that would have been the case, I wouldn't have posted here What if there are other sites opened which are important and should not be closed. @JLogan3o13, application is installed through EXE but uninstalled via MSI. So when I run the below command with the keyname, it uninstalls and then launches the sites. RunWait(@ComSpec & ' /c MsiExec.exe /X{keyname} /qn', "", @SW_HIDE) Link to comment Share on other sites More sharing options...
Danp2 Posted May 2, 2018 Share Posted May 2, 2018 @DigDeep Well, I did say simplest. Handling this for multiple browser types could be complicated. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
DigDeep Posted May 2, 2018 Author Share Posted May 2, 2018 Is there anything we can get for IE? If yes, we can get a go through for other browsers. Link to comment Share on other sites More sharing options...
Danp2 Posted May 2, 2018 Share Posted May 2, 2018 This is a function I've used in the past to retrieve the active tab in IE -- ;=============================================================================== ; ; Function Name: _IEGetActiveTab() ; Description: Retrieve the IE Window Object of the currently active tab ; Parameter(s): None ; Requirement(s): AutoIt3 V3.2 or higher ; On Success - Returns an object variable pointing to the IE Window Object ; On Failure - Returns 0 and sets @ERROR ; @ERROR - 0 ($_IEStatus_Success) = No Error ; - 7 ($_IEStatus_NoMatch) = No Match ; Author(s): Dan Pollak ;=============================================================================== ; Func _IEGetActiveTab() Local $hwnd, $i, $title, $oIE ; get first IE instance $oIE = _IEAttach ("", "instance", 1) If @error = $_IESTATUS_Success Then ; get window title $hwnd = _IEPropertyGet($oIE, "hwnd") $title = WinGetTitle($hwnd) ;strip off trailing browser text $i = StringInStr($title, ' - ', 0, -1) If $i > 0 Then $title = StringLeft($title, $i - 1) EndIf $oIE = _IEAttach($title, "windowtitle") EndIf Return $oIE EndFunc You could use this as-is or you could use it as the basis for a function that loops through all tabs and kills any where the title matches a given list. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 2, 2018 Moderators Share Posted May 2, 2018 I misunderstood your OP, I thought you were just planning to install this and had caught the behavior on uninstall through testing. In that case I would have suggested simply opening the MSI (hidden in the exe wrapper) with ORCA and removing the custom action to open the web page on uninstall. But it sounds like this was missed before installation and you are beyond that point. More of an overall question, which may also lend itself to your issue, is why you're doing uninstalls during the middle of the day when the users are working? Why not follow best practice and do them overnight, using whatever tool (SCCM, Altiris, etc.) to inform the users there will be the need for a reboot? That would alleviate the problem of seeing the browser window pop up (not to mention a periodic reboot has been shown to cut support calls by a pretty hefty margin in general). "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted May 2, 2018 Share Posted May 2, 2018 You can still do the process of keeping browsers closed. Just start the script with a wait so that it does not force kill a browser if its open but instead waits until any pre-existing instances of a browser are closed and then runs the script. Your other options are to build your own uninstaller While 1 If ProcessExists("iexplore.exe") Then Sleep(10) ContinueLoop EndIf ExitLoop WEnd AdlibRegister("_KeepBrowsersClosed") ;Uninstall Script Func _KeepBrowsersClosed() If ProcessExists("iexplore.exe") Then ProcessClose("iexplore.exe") EndIf Tweak, add your other browsers, etc. Possibly have it run at login so it completes before users even get a chance to open a browser. 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