Problem med ASPTear
Någon som vet hur man man får detta exempelscript att fungera som i demon på http://www.4guysfromrolla.com/webtech/031000-1.shtml<%
'extract.asp (c) 2000 Thomas Winningham - use freely!
Function GetCell(cellnumber, extracturl)
'Variables: Cellnumber: Number of the cell to get data from
'ExtractURL: complete url that contains the cells and data
'Returns a string of the cells data (including html)
'Use the SOFTWING.AspTear component to get the HTML (but any
'will do... just rewrite this part) connection is including in
'Function for purpose of being self-contained
Const Request_POST = 1
Const Request_GET = 2
Set xObj = Server.CreateObject("SOFTWING.AspTear")
strRetVal = xObj.Retrieve(extracturl,Request_GET,"","","")
set xobj = nothing
i = 1 ' HTML Text Location Start
q = 1 ' Cell Number Start
' Loop until we have processed the cell we're looking for
Do until q > cellnumber
' Look for <TD the start of a cell
i = InStr(i, UCase(strRetVal), "<TD")
' Find the location of the end of the <TD tag
r = InStr(i, strRetVal, ">")
' Let the next loop start looking after this <TD tag we found
i = r + 1
' increase the count of which cell we're at
q = q + 1
Loop
' The start of our cell text is right after the last found tag
StartCellText = i
' Now... to find the end of this cell's text, we look for either <TABLE
' or <TD - whichever comes first (but we have to check if they exist or not)
' We don't include nested tables in the cell data because those tables have
' cells of their own.
If (InStr(r, UCase(strRetVal), "<TABLE") > 0) AND _
(InStr(r, UCase(strRetVal), "<TABLE") < _
InStr(r, UCase(strRetVal), "</TD>")) then
ThisCellText = mid(strRetVal, StartCellText, _
InStr(r, UCase(strRetVal),"<TABLE")- StartCellText )
Else
ThisCellText = mid(strRetVal, StartCellText, _
InStr(r, UCase(strRetVal), "</TD>")- StartCellText )
End If
GetCell = ThisCellText
End Function
Function NumberCells(extracturl)
'Variables: ExtractUrl: The URL (eg http://www.cnn.com) to number
'returns a string of the entire HTML document with numbers at the beginning
'of each cell
'Use the SOFTWING.AspTear component to get the HTML (but any will do...
'just rewrite this part)
'connection is including in Function for purpose of being self-contained
Const Request_POST = 1
Const Request_GET = 2
Set xObj = Server.CreateObject("SOFTWING.AspTear")
strRetVal = xObj.Retrieve(extracturl,Request_GET,"","","")
set xobj = nothing
i = 1 ' HTML Text Location Start
q = 1 ' Cell Number Start
' So long as <TD cells exist- number them
Do while InStr(i, UCase(strRetVal), "<TD") > 0
' find next <TD
i = InStr(i, UCase(strRetVal), "<TD")
' fomd the end of the <TD
r = InStr(i, strRetVal, ">")
strRetVal = left(strRetVal, r) & q & _
right(strRetVal, len(strRetVal) - r)
'Number the cells: the string equals all the html we've check,
'our cell number, and then the html we've yet to check
' Let the next loop start looking after this <TD tag we found
i = r + 1
' increase the count of which cell we're at
q = q + 1
Loop
NumberCells = strRetVal
End Function
%>
tacksam för hjälp... och jag har installerat ASPTear på min server...
