catchup
02-04-2005, 03:04 PM
i really need to have things run more effecient. currently
i have a function that numbers cells on a page retreived by aspTear, and the cell numbers never change, this part of the code is fine, since i found it on the net:
Function GetCell(cellnumber, extracturl)
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
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
Then since i need the info from may cells and i not a smart programmer i'm doing things an ugly way:
variable44 = GetCell(44, "http://www.company.com/page.asp")
variable45 = GetCell(45, "http://www.company.com/page.asp")
variable47 = GetCell(47, "http://www.company.com/page.asp")
variable49 = GetCell(49, "http://www.company.com/page.asp")
variable57 = GetCell(57, "http://www.company.com/page.asp")
variable58 = GetCell(58, "http://www.company.com/page.asp")
variable60 = GetCell(60, "http://www.company.com/page.asp")
variable62 = GetCell(62, "http://www.company.com/page.asp")
.....all the way up to cell 1071......
variable1071 = GetCell(1071, "http://www.company.com/page.asp")
so how can things be so that variables are created with the cells info without making a request to the aspTear each time?
thanks!
i have a function that numbers cells on a page retreived by aspTear, and the cell numbers never change, this part of the code is fine, since i found it on the net:
Function GetCell(cellnumber, extracturl)
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
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
Then since i need the info from may cells and i not a smart programmer i'm doing things an ugly way:
variable44 = GetCell(44, "http://www.company.com/page.asp")
variable45 = GetCell(45, "http://www.company.com/page.asp")
variable47 = GetCell(47, "http://www.company.com/page.asp")
variable49 = GetCell(49, "http://www.company.com/page.asp")
variable57 = GetCell(57, "http://www.company.com/page.asp")
variable58 = GetCell(58, "http://www.company.com/page.asp")
variable60 = GetCell(60, "http://www.company.com/page.asp")
variable62 = GetCell(62, "http://www.company.com/page.asp")
.....all the way up to cell 1071......
variable1071 = GetCell(1071, "http://www.company.com/page.asp")
so how can things be so that variables are created with the cells info without making a request to the aspTear each time?
thanks!