Jump to content

Recommended Posts

Posted

Hey there,

below function returns an "object collection" (not sure if that's the correct term) of 'a' elements grabbed from within //*[@id="J_DetailMeta"].

However, I need the returned collection not to include objects with 'aria-disabled = true'. Is there a way of removing specific objects from such a collection?

Func GetObjectList($sPicker)
    $oDetailMeta = _IEGetObjById($oIE, "J_DetailMeta")
    If Not @error Then
        $tags = $oDetailMeta.GetElementsByTagName("ul")
        For $tag in $tags
            $data_ID_value = $tag.GetAttribute("data-property")
            If $sPicker = "color" Then
                If $data_ID_value = '????' Or $data_ID_value = "????" Then
                    $oReturnList = $tag.GetElementsByTagName("a")
                EndIf
            ElseIf $sPicker = "network" Then
                If $data_ID_value = '????' Then
                    $oReturnList = $tag.GetElementsByTagName("a")
                EndIf
            ElseIf $sPicker = "storage" Then
                If $data_ID_value = '????' Then
                    $oReturnList = $tag.GetElementsByTagName("a")
                EndIf
            EndIf
        Next
    EndIf

    Return $oReturnList
EndFunc


$oColorList = GetObjectList("color")
For $oColor In $oColorList
    If StringInStr($oColor.GetAttribute("aria-disabled"), "true") <= 0 Then
        ;  remove object from the collection ???
    EndIf
Next

 

Posted

You can put the revised collection one by one in a Array. It will become an array of single objects.

$oColorList = GetObjectList("color")
For $oColor In $oColorList
    If StringInStr($oColor.GetAttribute("aria-disabled"), "true") <= 0 Then
        _ArrayAdd($oColorListNew, $oColor)
    EndIf
Next

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
×
×
  • Create New...