How to Block IE Popup without "Send - {keys}"

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
phelipea
Posts: 1
Joined: 01 Aug 2017, 06:25

How to Block IE Popup without "Send - {keys}"

01 Aug 2017, 07:12

Hello!

I'm using ahk tool for a while and this forum helped me a lot! Thanks in advance for all your effort to help other users.

I'm facing some problem related to IE and COM, and my goal is to achieve a background automating using COM object instead of using the common ahk commands.

I'm copying info from an Excel tab and inserting those in a IE page, but almost every time the process ends (when I "click" on a Submit button), a Dialog Box pops up showing a message that I need to filter and an OK button for me to press in order to continue the whole process.

I'm intending to read the message that appears like this:

Code: Select all

if(InStr(pwb.Document.body.innerHTML, "Message that appears in the Popup"))
My question is: How can i disable this popup message (not just close it every time, because it'll still interrupt the user from other tasks when it flashes), in a way that I still could read the message that'll be shown and without blocking the Website to continue?

I've tried to Silent the handle like this:

Code: Select all

handleIE.silent := true
but didn't work. I tried to use this Persistent Script:

Code: Select all

#Persistent
SetTimer, ClosePopup, 50
return

ClosePopup:
WinClose, Title of the Dialog Box, Some Text inside the Dialog Box
return
and i didn't work again. I tried to get the Dialog Box by the class (there is only one class with that name in the HTML document) like this:

Code: Select all

handle.document.parentWindow.frames["main"].document.getElementsByClassName("alert-box alert")[0].close()
but again, didn't work. I tried to change the settings to block all Popups (and different configurations) but the message keps showing after almost every submit button clicked.

When I do the same process using Google Chrome and the Dialog Box appears, an option is showed as "Prevent this page from creating additional dialogs" and this solved the problem. How can I do this using IE? I'm tied up to IE because of the COMM object. I know it's possible to use Selenium libraries and JavaScript to perform this on Chrome, but the learning curve would be slower.


Any thoughts?

Thanks in advance!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 409 guests