Jump to content

Possible to list all actions available to an object?


Recommended Posts

I was curious if there was a way to list all actions available to an object I guess like listing all elements in an array - specificly workign with things like _IETagNameGetCollection i know you can do things like $oTag.className or $oTag.innerText $oTag.inerHtml but i can't find where they are listed in documentation and I assume its unique to the type of object created >.< prob a simple answer that i am making overly complicated but atm trying to pull data out of something like:

<DIV class=banner style="BACKGROUND-IMAGE: url(http://image.com.com/gamespot/images/titles/product/0/924890.jpg)"></DIV>

i can dig down to that source... i can verify it by looping through the objects .className but i'd assume there is some way to see its style? .innerText and .innerHtml isn't it :)

Don't let that status fool you, I am no advanced memeber!

Link to comment
Share on other sites

hmm :P yes i can see the attributes via DebugBar but I don't know how to extract them from my Object :) using the example above in contast to a working one:

WORKS (though is easier because the nfo i'm getting isn't in a class tag

func _GetMainPageGameSummary()
    ; Logic here is we have verified its a legit link... but before we 
    ConsoleWrite("REACHED _GetMainPageGameSummary" & @CRLF)
    ;get results div (closest ID to the data i want)
    $oResultsDiv = _IEGetObjById($oIE, "summary_module")
    ;the first result is stored in an P tag with class containing the words "review deck"
    $oLIs = _IETagNameGetCollection($oResultsDiv, "P")
    for $oLI in $oLIs
        ConsoleWrite("Classname = " & $oLI.className & @CR)
        if StringInStr($oLI.className, "review deck") Then
            ; ConsoleWrite("$oLI.innerText DETAILS = " & $oLI.innerText & @CR)
            ; MsgBox(0,"$oLI.innerText DETAILS ", $oLI.innerText)
            ; Output Example $oLI.innerText DETAILS = Review Score: 6.9 | Release Date: Apr 26, 2005 
            return $oLI.innerText
        EndIf
    Next
    return false
EndFunc

In that example i had no idea you could even reference .className except from seeing other peoples code - i found references to .innerText and .innerHTML in the manual but there has to be a way to know or print out what elements exist in an object? because when i use that same logic to find the tag that includes the img link (inside a class tag) i have no clue how to extract it :) trying things like .classStyle just errors out and at this point my only work around was to backup to the whole id tag and then regex eh well stringSplit out the data

func _GetMainPageBackGroundImage()
    #cs
    ; COMMENTED OUT AS CAN'T GET IT TO WORK - CRUDE WORKAROUND BELOW
    ; Logic here is we have verified its a legit link... but before we 
    ConsoleWrite("REACHED _GetMainPageGameSummary" & @CRLF)
    ;get results div (closest ID to the data i want)
    $oResultsDiv = _IEGetObjById($oIE, "summary_module")
    ;the first result is stored in an DIV with class containing the words "banner"
    $oLIs = _IETagNameGetCollection($oResultsDiv, "DIV")
    for $oLI in $oLIs
        ConsoleWrite("MainPageBackGroundImage Classname = " & $oLI.className & @CR)
        if StringInStr($oLI.className, "banner") Then
            ; ConsoleWrite("$oLI.innerText MainPageBackGroundImage = " & $oLI.styleName & @CR)
            ; MsgBox(0,"$oLI.innerText MainPageBackGroundImage ", $oLI.classStyle)
            
            $GameReviewScoreRawRaw = _IEPropertyGet($oLI, "innerhtml")
            $GameReviewScoreRaw = _IEPropertyGet($oLIs, "innerhtml")
            
            
            
            
            MsgBox(0,"$oLI.innerText $GameReviewScoreRawRaw ", $oLI.styleName)
            MsgBox(0,"$oLI.innerText $GameReviewScoreRawRaw ", $GameReviewScoreRaw)
            return $oLI.innerText
        EndIf
    Next
    return false    
    #ce
    
    ; now try to grab the background img banner and save url for game shots
    $oDiv = _IEGetObjByID ($oIE, "summary_module")
    $GameReviewScoreRawRaw = _IEPropertyGet($oDiv, "innerhtml")
    $GameReviewScoreRaw = StringSplit($GameReviewScoreRawRaw, '<DIV class=banner style="BACKGROUND-IMAGE: url(', 1)
    if $GameReviewScoreRaw[0] >= 2 Then
            $GameReviewScore = StringSplit($GameReviewScoreRaw[2], ')', 1)
            ConsoleWrite("SummaryRawRaw COUNT " & $GameReviewScore[1] & @CR)
            ; MsgBox(0,"asdf",$GameReviewScore[1])
            return $GameReviewScore[1]
            ; InetGet($GameReviewScore[1], $FullGameName & "\" & $FullGameName & " Background.jpg", 1)
    EndIf
        
    return False
EndFunc

Don't let that status fool you, I am no advanced memeber!

Link to comment
Share on other sites

uugh not to be a shameless bump... but can you at least test for the availabilty / existance avaiable to an object?

Example:

<DL class=game_info>
<DL class=game_info>
    <DT>Publisher: 
    <DD><A class=nintendo href="/pages/company/index.php?company=619">Electronic Arts</A> </DD>

    <DT>Developer: 
    <DD><A class=nintendo href="/pages/company/index.php?company=77853">Fall Line Studio</A> </DD>

    <DT>Genre: 
    <DD><A class=nintendo href="/games.html?type=games&amp;category=Action&amp;platform=1026">Action</A> </DD>

    <DT>Release Date: 
    <DD>Aug 4, 2009 <A class=nintendo href="/ds/action/gijoe/similar.html?mode=versions">(more)</A> </DD>

    <DT>ESRB: 
    <DD><A class=nintendo href="http://www.esrb.org/" target=_blank rel=nofollow>EVERYONE 10+</A> </DD>

    <DT>ESRB&nbsp;Descriptors: 
    <DD>Mild Cartoon Violence </DD>
</DL>

If i am looping through all the <DD> elements and want to grab href links when avail i can't because as soon as i link $oElement.href it will error out on that last line with that action isn't available error...

example:

;page is loaded
    ;Data is under DL class=game_info in DT (header) and DD (data) tags...
    $oLIs = _IETagNameGetCollection($oDetailsDiv, "DL")
    for $oLI in $oLIs
        if StringInStr($oLI.className, "game_info") Then
            ; going to loop through ALL sub tags of $oLI
            $oElements = _IETagNameAllGetCollection ($oLI)
            For $oElement In $oElements
                MsgBox(0, "Element Info", "Tagname: " & $oElement.tagname & @CR & "innerText: " & $oElement.innerText)
                $header = ""
                $data = ""
                if $oElement.tagname = "DT" Then
                    $header = $oElement.innerText
                EndIf
                
                if $oElement.tagname = "DD" Then
                    $data = $oElement.innerText
                    $href = $oElement.href 
                    ; FAILS WHEN LINK ISN'T PRESENT HOW TO TEST FOR AVAIL???
                EndIf

Edit:

well >.< i assume i could do a

if $oElement.href then $href = $oElement.href

but that still doesn't help with the origional question of if there is a way to see all available actions $href = $oElement.whateverness!! lol

Edited by zhenyalix

Don't let that status fool you, I am no advanced memeber!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...