Sign in to follow this  
Followers 0
markyrocks

[solved] is it possible to get a link's coordinate by using _IePropertyGet()?

3 posts in this topic

#1 ·  Posted (edited)

I've been reading and writing code using the ie udf  all night and i just can't figure it out.  I don't see why its not possible.  but i can't seem to get it right.

this was basically the last thing i tried

$url="autoitscript.com"

$ie=_IECreate($url)

$pID=_IEGetObjByName($ie,$url)
$linkx=_IEPropertyGet($pID,"screenx")
    $linky=_IEPropertyGet($pID,"screeny")
MsgBox("","","link coord" & $linkx & "," & $linky)

heres what i was playing around with before... both of my codes are based off of the examples.  no matter what i do it returns 0,0,,,,

 

Local $oLinks = _IELinkGetCollection($ie)

For $oLink In $oLinks
if $oLink.href = $url Then
    $sLink=$oLink.href
    $linkx=_IEPropertyGet($sLink,"screenx")
    $linky=_IEPropertyGet($slink,"screeny")
msgbox("","",$linkx & "," & $linky)
 MouseMove($linkx,$linky,1)
 ExitLoop
    EndIf
;~ Next

 

Edited by markyrocks
solved

Share this post


Link to post
Share on other sites



ok so i've learned a couple things since i posted last.  one it seems that when i use _iegetobjbyname() it returns nothing..... so im obviously doing something wrong there.

the second thing i've learned is in the actual function _ielinkclickbytext() the way it actually clicks is by $oLink.click() I assume that the ,click() must be imbedded in autoit source code.  also i'd assume that its probably not even really a click it probably just works the same way _ienavigate() works.

Func _IELinkClickByText(ByRef $oObject, $sLinkText, $iIndex = 0, $iWait = 1)
    If Not IsObj($oObject) Then
        __IEConsoleWriteError("Error", "_IELinkClickByText", "$_IESTATUS_InvalidDataType")
        Return SetError($_IESTATUS_InvalidDataType, 1, 0)
    EndIf
    ;
    Local $iFound = 0, $sModeLinktext, $oLinks = $oObject.document.links
    $iIndex = Number($iIndex)
    For $oLink In $oLinks
        $sModeLinktext = String($oLink.outerText)
        If $sModeLinktext = $sLinkText Then
            If ($iFound = $iIndex) Then
                $oLink.click()
                If @error Then ; Trap COM error, report and return
                    __IEConsoleWriteError("Error", "_IELinkClickByText", "$_IESTATUS_COMError", @error)
                    Return SetError($_IESTATUS_ComError, @error, 0)
                EndIf
                If $iWait Then
                    _IELoadWait($oObject)
                    Return SetError(@error, 0, -1)
                EndIf
                Return SetError($_IESTATUS_Success, 0, -1)
            EndIf
            $iFound = $iFound + 1
        EndIf
    Next
    __IEConsoleWriteError("Warning", "_IELinkClickByText", "$_IESTATUS_NoMatch")
    Return SetError($_IESTATUS_NoMatch, 0, 0) ; Could be caused by parameter 2, 3 or both
EndFunc   ;==>_IELinkClickByText

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

well this seems to be working with the example...... too tired to do any real world testing But i guess this is a good start to something bc i googled this subject and there doesn't seem to be anything.  So maybe i'm onto something?  or maybe noone has ever needed this info?

#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE = _IE_Example("basic")
Local $oLinks = _IELinkGetCollection($oIE)
WinMove('',"",467,178)     ;i tried moving the window to some different locations to make sure it was working as expected
sleep(500)
For $oLink In $oLinks
    $sLink=$oLink.href
$namey=$olink.document.parentwindow.screentop + $oLink.offsettop
$namex=$olink.document.parentwindow.screenleft + $olink.offsetleft
    MsgBox('','',$namex & "," & $namey)
Next

for the record the information about using classes isn't available?  that i could find anyway.   Im interested in using java type variables and it would be great if there was a list of like accepted terms?  or how to implement them exactly.  like can i define my own classes?  

Edited by markyrocks

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  
Followers 0