WinBatch® Technical Support Forum

Archived Boards => COM Automation and dotNet => Topic started by: mathia on February 04, 2015, 02:46:19 PM

Title: DOM...interpreter doesn't like line
Post by: mathia on February 04, 2015, 02:46:19 PM
I'm sure I've got to be doing something wrong, but here goes.
Parsing and searching an html document using the document object model.  Everything works until I try to access the first element in a table structure.  Everything I've seen uses brackets [] for the index.  I've also tried using parentheses, but am getting the same error.  Expression continues past expected end.  Here's the code:

Browser = ObjectCreate("InternetExplorer.Application")
;browser=CreateObject("InternetExplorer.ApplicationMedium")
;browser.visible = @true
;url = "http://bvsperformance.bvsinc.com/registrationbank.asp"
url="file:///C:/results/Customer_Report_by_Channel.html"
browser.navigate(url)
gosub loading
doc = browser.document
table=Doc.Body.GetElementsByTagName("TABLE").Item(5)
colRows=table.rows
cells=table.cells
rcount=colRows.length
ccount=cells.length
first=colRows[1].cells

Any help would be greatly appreciated.
Title: Re: DOM...interpreter doesn't like line
Post by: mathia on February 05, 2015, 05:44:40 AM
After working on this most of yesterday, it took about 10 minutes after posting this for me to get it working.  LOL.
Thanks to everyone who took the time to look at it even if you didn't post a solution.  For anyone interested, here is the working version.

fh=fileopen("c:\results\q2logins.csv","write")
Browser = ObjectCreate("InternetExplorer.Application")
url="file:///C:/results/Customer_Report_by_Channel.html"
browser.navigate(url)
gosub loading
doc = browser.document
table=Doc.Body.GetElementsByTagName("TABLE").Item(5)
colRows=table.rows
cells=table.cells
rcount=colRows.length
ccount=cells.length
boxopen('Status','')
for i = 1 to (rcount-1)
   first=table.rows(i)
   fc=first.cells.item(3).innerhtml
   fd=first.cells.item(4).innerhtml
   output=strcat(fc,',',fd)
   boxtext(output)
   filewrite(fh,output)
next
exit