Sign in to follow this  
Followers 0
sam2332

_IEGetObjbyclass?

5 posts in this topic

sooo im making a facebook automator and i need to find get data from a div that only has a class and it is a unique class

the div has no id or name so i cant use _IEGetObjById() or _IEGetObjByName()

any help you could throw at me would be greatly appreciated

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try this:

;===============================================================================
;
; Function Name:    _IEGetObjByClass()
; Description:      Returns an object variable by Class
; Parameter(s):     $o_object   - Object variable of an InternetExplorer.Application, Window or Frame object
;                   $s_Class    - Specifies class of the object you wish to match
;                   $i_index    - Optional: If the class occurs more than once, specify which instance by 0-based index
; Requirement(s):   AutoIt3 V3.2 or higher
; Return Value(s):  On Success  - Returns an object variable pointing to the specified Object
;                   On Failure  - Returns 0 and sets @ERROR
;                   @ERROR      - 0 ($_IEStatus_Success) = No Error
;                               - 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
;                               - 7 ($_IEStatus_NoMatch) = No Match
;                   @Extended   - Contains invalid parameter number
; Author(s):        Bob Anthony (big_daddy)
;
;===============================================================================
;
Func _IEGetObjByClass(ByRef $o_object, $s_Class, $i_index = 0)
    If Not IsObj($o_object) Then
        __IEErrorNotify("Error", "_IEGetObjByClass", "$_IEStatus_InvalidDataType")
        SetError($_IEStatus_InvalidDataType, 1)
        Return 0
    EndIf
    ;
    If Not __IEIsObjType($o_object, "browserdom") Then
        __IEErrorNotify("Error", "_IEGetObjByClass", "$_IEStatus_InvalidObjectType")
        SetError($_IEStatus_InvalidObjectType, 1)
        Return 0
    EndIf
    ;
    Local $i_found = 0
    ;
    $o_tags = _IETagNameAllGetCollection($o_object)
    For $o_tag In $o_tags
        If String($o_tag.className) = $s_Class Then
            If ($i_found = $i_index) Then
                SetError($_IEStatus_Success)
                Return $o_tag
            Else
                $i_found += 1
            EndIf
        EndIf
    Next
    ;
    __IEErrorNotify("Warning", "_IEGetObjByClass", "$_IEStatus_NoMatch", $s_Class)
    SetError($_IEStatus_NoMatch, 2)
    Return 0
EndFunc   ;==>_IEGetObjByClass
Edited by big_daddy

Share this post


Link to post
Share on other sites

:) that was fast

ill go try it now :)

Share this post


Link to post
Share on other sites

hummm i didnt forsee this there was more then one...>.>

Share this post


Link to post
Share on other sites

If the order stays the same just add an index parameter.

See updated code above.

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