Jump to content

How to prevent javascript pop-ups when using IE.au3


bwq
 Share

Recommended Posts

I wrote an auto-it script to automatically fill in details (login, password) on a website and then hit the submit button. When the script hits the submit button, the form's onsubmit="popup()" function is called, which opens a new IE window with some random info in it. The popup() function does this with the javascript "window.open".

Since my script is supposed to be totally invisible ($F_VISIBLE = 0) and everything else works just fine, I'd love to find a way to prevent the popups from showing up.

I did some Googling and since AutoIt uses VB (I assume), I found the following:

Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)

Cancel = True

End Sub

This should supposedly cancel the popups. I have no clue how to implement this though.

Link to comment
Share on other sites

Using:

Dim $oIE = _IECreate()
ObjEvent($oIE, 'AutoIt_')
;.
;.
;.


Func AutoIt_NewWindow2($oPpDisp, $fCancel)
   $fCancel = True
EndFunc

But it may not fire this event.

The event gets fired, but AutoIt handles it asynchronously, so the cancel has no effect.

You can disable the onclick handler... $oSubmit.onclick = ""

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...