Jump to content

freezing with _IEImgClick (when image has javascript link)


Recommended Posts

Hi. I'm new to AutoIt and try to deal with web pages.

well, I solved most problems but still have a one problem.

There is my code:

system environment = AutoIt:3.3.4.0/X64 (Os:WIN_7/X64 Language:0412 Keyboard:00000412 Cpu:X64)

web page = http://sugang.snu.ac.kr/login.jsp

(assume that there is a IE instance which fully loaded)

#include <ie.au3>
#include <Debug.au3>

$oIE = _IEAttach("http://sugang.snu.ac.kr/login.jsp", "URL")
_IEImgClick($oIE, "view_board.gif", "src", 0, 0)

;lines for debugging
#cs
$img = _IEImgGetCollection($oIE, 1)
_DebugSetup("AutoIt Debug Window", True, 1)
_DebugOut(@YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC)
_DebugReportVar("image", $img.click, True)
#ce

MsgBox(0, '', 'image clicked')

In the webpage, If user clicks the image, javascript prompt message box.

And I want the AutoIt to click the image, and then handle with the message box - "Message of Webpage"

but autoit clicks the image, wait infinitely until user closes the message box. (So, the line

MsgBox(0, '', 'image clicked')
runned after user closed the message box)

By the information of Debug console, autoit 'knows' that image has clicked only after user closed the message box.

How can I handle/solve this problem?

Edited by archangel
Link to comment
Share on other sites

Look at example script #2 under _IEAction() in the help file. Use _IEImgGetCollection() to find an object reference to that IMG tag, then give it focus, then send it an "{ENTER}". This will keep the process from being blocked by the IE COM waiting for resolution of that dialog.

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...