Jump to content

Getting around javascript pop up


Recommended Posts

Hi all, I have been using quite a bit of ie.au3 and I'm trying to get around this javascript. I need to autoclick "Yes".

<a href='www.somewhere.com' onclick="if ( !confirm ('Are you sure you want to visit this site?') ) { return false; }"><img src='http://www.someimage.com' width=80 height=80 border=1></a>

Currently I have it set up such that I have two scripts, the main one with all my code and a second which basically keeps looping till it sees a pop up box with the appropriate header and then clicks a certain number of pixels to the "Yes" box.

I was wondering if there was any other way around it?

Thanks in advance.

Link to comment
Share on other sites

Is the pop-up window an IE window? If so, IEAttach to it. If it's a standard window, use WinExists?

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Is the pop-up window an IE window? If so, IEAttach to it. If it's a standard window, use WinExists?

Tried both, doesn't work. Somehow the window acts as a breakpoint for the code. In the following example, "second link" is the link where the javascript is activated.

-------------------------------------------------------------

Opt("TrayIconDebug", 1)

$o_IE = _IECreate ()

_IENavigate ($o_IE, "www.somewhere.com")

_IEClickLinkByText($o_IE, "first link",0,0)

sleep(4021)

_IEClickLinkByText($o_IE, "second link",0,0)

sleep(4003)

-------------------------------------------------------------

When I check the tray icon debug value, the code is waits at the line "sleep(4021)" until I do something with that popup box.

Edited by patlim4152
Link to comment
Share on other sites

I thought I should add that the second function I have running is just a simple line

-----------------------------------------------------

$forever =1

While $forever=1

If WinGetTitle("") = "Microsoft Internet Explorer" Then Send("{ENTER}")

WEnd

-----------------------------------------------------

Link to comment
Share on other sites

Your script won't find the "link" if it's not in the object variable in which it looks, or if it's not an IE window. Looks to me like it's an IE window, so you should be able to use IEAttach, specifying the correct options for the pop-up window. Or, use the same principles you are currently using in a WinExists If statement, then ControlSend "enter".

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
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...