Jump to content
Sign in to follow this  

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: (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
$img = _IEImgGetCollection($oIE, 1)
_DebugSetup("AutoIt Debug Window", True, 1)
_DebugOut(@YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC)
_DebugReportVar("image", $img.click, True)

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

Share this post

Link to post
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.


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

Share this post

Link to post
Share on other sites

Thanks a lot. :mellow:

I tried that solution and succeeded. though I prefer clicking method than send "{enter}" after focusing object...

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