Hi Support,
here is my problem:
I have a script that goes to a website, extract some tags and copies to a file for later use. But when I read back from the file in order to search a a string I got the the following error:
Microsoft VBScript compilation error : 1033
Unterminated string constant
Any thoughs?
thanks alot
Compilation Error: 1033 Unterminated string constant ????
Moderators: Dorian (MJT support), JRL
Sorry, forgot to attach the code
Here is the code:
VBSTART
Dim IE
Sub CreateIE(ShowIE)
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible=ShowIE
End Sub
Sub Navigate(URL)
IE.Navigate URL
End Sub
Sub WaitBusy
do while IE.Busy
loop
End Sub
Sub KillIE
IE.Quit
Set IE = nothing
End Sub
Function ExtractTag(Tagname)
dim Num
dim t
dim s
dim theline
s = ""
set t = IE.document.body.all.tags(Tagname)
for Num = 0 to t.length-1
if instr(t.item(Num).getAttribute("HREF"),"javascript:DISPLAYRACES") > 0 then
theline = t.item(Num).innerHTML & ";" & t.item(Num).getAttribute("HREF")
s = s & theline & "|"
end if
next
ExtractTag = s
End function
Function FindText(s1,s2)
dim idx
idx = instr(s2,s1)
if idx > 0 then
FindText = idx
end if
End Function
VBEND
VBRun>CreateIE,1
VBRun>Navigate,http://www.racetab.com.au/Racing/Inform ... daysRacing
Wait>2
VBEval>ExtractTag("A"),ans
writeln>c:\test\test.txt,result,ans
VBRun>KillIE
////////////////////////////////////////////////////////////////////////////////
ReadFile>c:\test\test.txt,file
VBEval>FindText("whatever","%file%"),Pos
IF>Pos>0
messagemodal>found it
ELSE>
messagemodal>not found
ENDIF>
Here is the code:
VBSTART
Dim IE
Sub CreateIE(ShowIE)
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible=ShowIE
End Sub
Sub Navigate(URL)
IE.Navigate URL
End Sub
Sub WaitBusy
do while IE.Busy
loop
End Sub
Sub KillIE
IE.Quit
Set IE = nothing
End Sub
Function ExtractTag(Tagname)
dim Num
dim t
dim s
dim theline
s = ""
set t = IE.document.body.all.tags(Tagname)
for Num = 0 to t.length-1
if instr(t.item(Num).getAttribute("HREF"),"javascript:DISPLAYRACES") > 0 then
theline = t.item(Num).innerHTML & ";" & t.item(Num).getAttribute("HREF")
s = s & theline & "|"
end if
next
ExtractTag = s
End function
Function FindText(s1,s2)
dim idx
idx = instr(s2,s1)
if idx > 0 then
FindText = idx
end if
End Function
VBEND
VBRun>CreateIE,1
VBRun>Navigate,http://www.racetab.com.au/Racing/Inform ... daysRacing
Wait>2
VBEval>ExtractTag("A"),ans
writeln>c:\test\test.txt,result,ans
VBRun>KillIE
////////////////////////////////////////////////////////////////////////////////
ReadFile>c:\test\test.txt,file
VBEval>FindText("whatever","%file%"),Pos
IF>Pos>0
messagemodal>found it
ELSE>
messagemodal>not found
ENDIF>