Jump to content
Sign in to follow this  
d4rkdz

iexplorer pop up blocker

Recommended Posts

d4rkdz

hello there , i am facing a problem with popups ,the thing is when my script launches an ie window normally the popup blocker works just fine , with no new windows showing at all , however when it's embedded in a gui (_IECreateEmbedded()) , it doesn't work as fine and there are some annoying popups showing.

and yes i ran them on the same settings and same website.

Share this post


Link to post
Share on other sites
MuchTex

Have your script check for pop up IE windows with WinExists() and if there is an IE popup ad then close it with WinClose()

Share this post


Link to post
Share on other sites
d4rkdz

Not sure what your expectation is after posting this minimal information and not really asking a question.

It helps to be much clearer. ;)

ok,here you go good sir, this the script in the _IECreateEmbedded() explanition , i did edit to open http://www.popuptest.com/, even though my ie popup blocker is on , it still open all the popup windows unlike when i am using ie directly

#include 
#include 
#include 

_IEErrorHandlerRegister()

Local $oIE = _IECreateEmbedded()
GUICreate("Embedded Web control Test", 640, 580, _
(@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
GUICtrlCreateObj($oIE, 10, 40, 600, 360)
Local $GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)
Local $GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)
Local $GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
Local $GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)

GUISetState() ;Show GUI

_IENavigate($oIE, "http://www.popuptest.com/")

; Waiting for user to close the window
While 1
Local $msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $GUI_Button_Home
_IENavigate($oIE, "http://www.popuptest.com/")
Case $msg = $GUI_Button_Back
_IEAction($oIE, "back")
Case $msg = $GUI_Button_Forward
_IEAction($oIE, "forward")
Case $msg = $GUI_Button_Stop
_IEAction($oIE, "stop")
EndSelect
WEnd

GUIDelete()

Exit

Share this post


Link to post
Share on other sites
water

An embedded IE not necessarely does act the same way the full IE application does.

IIRC the embedded IE is an ActiveX control with limited functionality. So it is not sure that the addon that works in the browser does in the ActiveX control.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
d4rkdz

oh i see , so there is no way of using the blocker in the embedded IE even though the blocker comes with IE?

Share this post


Link to post
Share on other sites
Melba23

d4rkdz,

You could try with Dale Holm's Pseudo-Embedded code: :)

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <Constants.au3>
#include <IE.au3>

Dim $hGUI, $oIE, $sURL, $iLeft, $iTop, $iHeight, $iWidth

$sURL = "http://www.google.com"
$iLeft = 0
$iTop = 0
$iWidth = 1024
$iHeight = 768

$hGUI = GUICreate("Test", $iWidth, $iHeight)

$oIE = IECreatePseudoEmbedded($iLeft, $iTop, $iWidth, $iHeight, $hGUI)
_IENavigate($oIE, $sURL)
GUISetState(@SW_SHOW, $hGUI)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        _IEQuit($oIE)
        Exit
    EndIf
WEnd

Exit


Func IECreatePseudoEmbedded($i_Left, $i_Top, $i_Width, $i_Height, $h_Parent, $f_ShowWin = False, $i_Timeout = 30000)

    Local Const $i_Random = Random(10001, 99999, 1)
    Local $i_PID, $o_IE, $h_HWND, $h_Timer = TimerInit()

    $i_PID = Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe -k " & "about:blank-" & $i_Random, "", @SW_HIDE)

    $f_ErrorNotify = _IEErrorNotify()
    _IEErrorNotify(False)

    While Not IsObj($o_IE)
        $o_IE = _IEAttach("about:blank-" & $i_Random, "URL")
        If TimerDiff($h_Timer) > $i_Timeout Then
            _IEErrorNotify($f_ErrorNotify)
            Return SetError(1, 0, 0)
        EndIf
        Sleep(200)
    WEnd

    _IEErrorNotify($f_ErrorNotify)

    $h_HWND = _IEPropertyGet($o_IE, "hwnd")

    _WinAPI_SetParent($h_HWND, $h_Parent)
    _WinAPI_MoveWindow($h_HWND, $i_Left, $i_Top, $i_Width, $i_Height, True)
    _WinAPI_SetWindowLong($h_HWND, $GWL_STYLE, $WS_POPUP + $WS_VISIBLE)

    If $f_ShowWin Then
        WinSetState($h_HWND, "", @SW_SHOW)
    EndIf

    Return $o_IE

EndFunc   ;==>IECreatePseudoEmbedded

M23

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______Open Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
d4rkdz

d4rkdz,

You could try with Dale Holm's Pseudo-Embedded code: :)

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <Constants.au3>
#include <IE.au3>

Dim $hGUI, $oIE, $sURL, $iLeft, $iTop, $iHeight, $iWidth

$sURL = "http://www.google.com"
$iLeft = 0
$iTop = 0
$iWidth = 1024
$iHeight = 768

$hGUI = GUICreate("Test", $iWidth, $iHeight)

$oIE = IECreatePseudoEmbedded($iLeft, $iTop, $iWidth, $iHeight, $hGUI)
_IENavigate($oIE, $sURL)
GUISetState(@SW_SHOW, $hGUI)

While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then
_IEQuit($oIE)
Exit
EndIf
WEnd

Exit


Func IECreatePseudoEmbedded($i_Left, $i_Top, $i_Width, $i_Height, $h_Parent, $f_ShowWin = False, $i_Timeout = 30000)

Local Const $i_Random = Random(10001, 99999, 1)
Local $i_PID, $o_IE, $h_HWND, $h_Timer = TimerInit()

$i_PID = Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe -k " & "about:blank-" & $i_Random, "", @SW_HIDE)

$f_ErrorNotify = _IEErrorNotify()
_IEErrorNotify(False)

While Not IsObj($o_IE)
$o_IE = _IEAttach("about:blank-" & $i_Random, "URL")
If TimerDiff($h_Timer) > $i_Timeout Then
_IEErrorNotify($f_ErrorNotify)
Return SetError(1, 0, 0)
EndIf
Sleep(200)
WEnd

_IEErrorNotify($f_ErrorNotify)

$h_HWND = _IEPropertyGet($o_IE, "hwnd")

_WinAPI_SetParent($h_HWND, $h_Parent)
_WinAPI_MoveWindow($h_HWND, $i_Left, $i_Top, $i_Width, $i_Height, True)
_WinAPI_SetWindowLong($h_HWND, $GWL_STYLE, $WS_POPUP + $WS_VISIBLE)

If $f_ShowWin Then
WinSetState($h_HWND, "", @SW_SHOW)
EndIf

Return $o_IE

EndFunc ;==>IECreatePseudoEmbedded

M23

this code isn't running for me , it just open a blank window , any idea? Edited by Melba23
Fixed code

Share this post


Link to post
Share on other sites
Melba23

d4rkdz,

It works fine for me - did you run it exactly as posted? :huh:

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______Open Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
water

I had to replace "&#097;bout:blank-" with "about:blank-"


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
d4rkdz

yes, i even did what water said , still didn't work

"--> IE.au3 V2.4-0 Error from function _IENavigate, $_IEStatus_InvalidDataType"

Share this post


Link to post
Share on other sites
water

Here it is working fine after I did the changes I posted before. I'm running AutoIt 3.3.8.1 on Windows 7 64 bit with IE 9.

What's your environment?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
d4rkdz

autoit v3.3.8.1 , win 7 32bit , IE 9

Share this post


Link to post
Share on other sites
water

Can you post the code you use for testing?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
d4rkdz

oh my bad my bad , sorry , i did not notice that there were two "&#097;bout:blank-" it working right now.

Share this post


Link to post
Share on other sites
water

"A small leak will sink a great ship" ;)

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Melba23

d4rkdz and water,

Sorry about that - damned forum software changing posted text again. And yet it accepts it when I edit it the posts - which is when the problems usually start! :wacko:

M23

Edited by Melba23
Typo

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______Open Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
water

Melba,

no problem, that was easy to solve ;)

And btw: I hate this editor too :wacko2:

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Melba23

d4rkdz,

Now you have the code running, does it solve your problem? :huh:

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______Open Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
d4rkdz

yes it's solved , thanks for the help , both of you.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×