dantay9 Posted December 24, 2009 Share Posted December 24, 2009 (edited) I have a test script that is supposed to display a radar map. Eventually this will become part of a larger script. This widget came from widgetbox.com so I don't have that code for you. To get people to sign up for their pro package, widgetbox has put ads on their widgets. I have quickly come to the conclusion that I cannot disable the ads (mostly because I don't have the widget code and don't want to pay money for the membership). My next thought is to just exit out of the ads whenever they come up. I have come up with two methods to do this. My first and easiest method would be to use ControlClick. For some reason, this does not seem to work, although mouseclick does work. Don't know the reason there. The other way I could think of was to use _IEHeadInsertEventScript. I don't know javascript, but this seems like the better and cleaner way of closing out of the ads as they pop up. Is it possible to use _IEHeadInsertEventScript to solve this? If not, why isn't ControlClick closing out of the ad when the position is correct? expandcollapse popup#include <GUIConstantsEx.au3> #include <IE.au3> #include <WindowsConstants.au3> $GUI = GUICreate("Local Radar", 641, 539, -1, -1, BitOR($WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) $oIE = _IECreateEmbedded() $Browser = GUICtrlCreateObj($oIE, 0, 0, 641, 539) $sHTML = '<html>' & @CRLF $sHTML = '<body>' & @CRLF $sHTML = '<script type="text/javascript" src="http://skybomb0.110mb.com/WidgetBox.js">' & @CRLF $sHTML &= '</script>' & @CRLF $sHTML &= '<script>' & @CRLF $sHTML &= "if (WIDGETBOX) WIDGETBOX.renderWidget('56c9d577-32c1-49b4-8de1-61be6f8009b8');" & @CRLF $sHTML &= '</script>' & @CRLF $sHTML &= '</body>' & @CRLF $sHTML &= '</html>' & @CRLF FileDelete(@ScriptDir & "\WebSite.htm") FileWrite(@ScriptDir & "\WebSite.htm", $sHTML) _IENavigate($oIE, @ScriptDir & "\WebSite.htm") GUISetState(@SW_SHOW) $Timer = TimerInit() While 1 $Msg = GUIGetMsg() Switch $Msg Case 0 If TimerDiff($Timer) > 100 And CheckForAds() Then WinActivate($GUI) ControlFocus($GUI, "", $Browser) While CheckForAds() ;~ MouseClick("primary", $Pos[0] + 25 + 2, $Pos[1] + 33 + 25) ;this works ControlClick($GUI, "", $Browser, "primary", 1, 25, 33) ;but this doesn't Sleep(250) WEnd EndIf Case -3 Exit EndSwitch WEnd Func CheckForAds() Local $Pos = WinGetPos($GUI) Local $BlackScreen = 1769473 Local $WhiteScreen = 2024807142 Local $CheckSum = 2730298357 Local $Pixel = PixelChecksum($Pos[0] + 590, $Pos[1] + 490, $Pos[0] + 592, $Pos[1] + 492) If $Pixel <> $CheckSum And $Pixel <> $WhiteScreen And $Pixel <> $BlackScreen Then Return True Return False EndFunc ;==>CheckForAds Edited December 24, 2009 by dantay9 Link to comment Share on other sites More sharing options...
james3mg Posted December 24, 2009 Share Posted December 24, 2009 (edited) Do they always have the same title when they popup? You could just check if that window title exists, and if it does, do a WinClose() on it. unless I'm missing something, which is entirely possible I'm just not that good at the _IE functions, so I'm looking for another possability Edited December 24, 2009 by james3mg "There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110 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