MagnumXL Posted December 29, 2009 Share Posted December 29, 2009 (edited) I have been searching the forums for a couple of hours but cannot find how to do this. All I need to do is get the x/y coordinates of images on a webpage. Here is an excerpt from my code: $tmp = 0 $tmp2 = 1 While 1 $img = _IEImgGetCollection($ie_obj,$tmp) If $img = 0 Then MsgBox(0,"Debug", "End of collection reached (" & $tmp & ")") ExitLoop EndIf If StringInStr($img.src,"/testbed") And StringRight($img.src,4) = ".jpg" Then ReDim $a_images[$tmp2+1][3] $a_images[$tmp2][0] = $img.src $a_images[$tmp2][1] = $tmp $a_images[$tmp2][2] = $img $tmp2 += 1 EndIf $tmp += 1 WEnd $a_images[0][0] = $tmp $img_obj = _IEGetObjById($ie_obj,$a_images[1][2]);<---- I believe this is my problem line. this is just a test line to find the first image. MsgBox(0,"Debug","$img_obj: " & $img_obj) $imgx = _IEPropertyGet($img_obj,"screenx") $imgy = _IEPropertyGet($img_obj,"screeny") MsgBox(0,"Debug","$imgx: " & $imgx & @CRLF & "$imgy: " & $imgy) MouseMove($imgx+20,$imgy+20) I think my problem is I don't know how to pass the image id to the _IEGetObjByID properly (or at all for that matter). Thanks in advance for any help! Edited December 29, 2009 by MagnumXL Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 29, 2009 Share Posted December 29, 2009 If $img is already the object reference to the image element, and it was stored in [1][2] of the array, what would _IEGetObjById() do for you? Just use the object you already have. The first MsgBox() is also useless because you can't display a COM Object as text. You might try: $img_obj = $a_images[1][2] MsgBox(0,"Debug","$img_obj: " & ObjName($img_obj)) $imgx = _IEPropertyGet($img_obj,"screenx") $imgy = _IEPropertyGet($img_obj,"screeny") MsgBox(0,"Debug","$imgx: " & $imgx & @CRLF & "$imgy: " & $imgy) 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 More sharing options...
MagnumXL Posted December 29, 2009 Author Share Posted December 29, 2009 Worked like a charm. Thank you! I was just trying to overthink it as usual. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now