sam2332 Posted July 10, 2009 Share Posted July 10, 2009 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 Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted July 10, 2009 Moderators Share Posted July 10, 2009 (edited) Try this: expandcollapse popup;=============================================================================== ; ; 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 July 10, 2009 by big_daddy Link to comment Share on other sites More sharing options...
sam2332 Posted July 10, 2009 Author Share Posted July 10, 2009 that was fast ill go try it now Link to comment Share on other sites More sharing options...
sam2332 Posted July 10, 2009 Author Share Posted July 10, 2009 hummm i didnt forsee this there was more then one...>.> Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted July 10, 2009 Moderators Share Posted July 10, 2009 If the order stays the same just add an index parameter. See updated code above. 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