Jump to content
Sign in to follow this  
Kurto2021

_Stringbetween v2.28 to v3.3.6

Recommended Posts

I just had to move this application that I built a year or so ago over to a new machine due to winXP no longer being supported but I can't seem to get it to work.

I have this code  which should be pretty simple.

$FindTable = _StringBetween($HTMLFile,"Today's Date","</Table>","-1")

  I have looked at my $HTMLFile variable and it looks good.  All the data is there but the $FindTable value is always an error.  Did something change between these versions?  I saw changes with 3.3.7 but those shouldn't apply to this.

Share this post


Link to post
Share on other sites

how do I see the error?  I am just returning a value of 0 for $FindTable

for better reference here is the code

$FindTable = _StringBetween($HTMLFile,"Today's Date","</Table>","-1")

     
   if $FindTable = 0 Then
      $ParseError = 1
      exit
   Else
      $FindRows = _StringBetween($FindTable[0],"<tr","</tr>","-1")
      $FindColumns = _StringBetween($FindRows[0],"<td","</td>","-1")
      Global $HeaderBuild[ubound($FindColumns)][ubound($FindRows)]

   For $i = 0 to Ubound($FindRows)-1
      $SplitColumns = _StringBetween($FindRows[$i],"<td","</td>","-1")
      For $s = 0 to Ubound($SplitColumns)-1
         $varArray = "<" & $SplitColumns[$s]
         $ArraySplit = _StringBetween($varArray,"<",">")
         For $d = 0 to Ubound($ArraySplit)-1
            $varArray = stringreplace($varArray,"<" & $ArraySplit[$d] & ">","")
         Next
         $HeaderBuild[$s][$i] = StringStripWS($varArray,3)
      Next
   Next
EndIf
Edited by Kurto2021

Share this post


Link to post
Share on other sites

Example of xmldom to parse a table:

#include <File.au3>
$oXML = ObjCreate("Microsoft.XMLDOM")
_FileCreate(@DesktopDir & "\some.html")
FileWrite(@DesktopDir & "\some.html","<HTML><BODY><Table>   <tr>        <td>row1:cell1</td>     <td>row1:cell2</td>     <td>row1:cell3</td> </tr>   <tr>        <td>row2:cell1</td>     <td>row2:cell2</td>     <td>row2:cell3</td> </tr></Table></BODY></HTML>")

$sXML_File = @DesktopDir & "\some.html"
$oXML.load($sXML_File)

$oTable = $oXML.selectSingleNode("//Table")
$oRows = $oTable.SelectNodes(".//tr")

For $oRow In $oRows
    $oCells = $oRow.SelectNodes(".//td")
    For $oCell In $oCells
        ConsoleWrite($oCell.Text & @CRLF)
    Next
Next

output:

row1:cell1
row1:cell2
row1:cell3
row2:cell1
row2:cell2
row2:cell3

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

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  

×
×
  • Create New...