Compilation Error: 1033 Unterminated string constant ????

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Hoa
Newbie
Posts: 12
Joined: Mon May 29, 2006 5:33 am

Compilation Error: 1033 Unterminated string constant ????

Post by Hoa » Fri Jun 23, 2006 11:55 am

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

Hoa
Newbie
Posts: 12
Joined: Mon May 29, 2006 5:33 am

Post by Hoa » Fri Jun 23, 2006 11:56 am

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>

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Fri Jun 23, 2006 2:16 pm

hey Hoa,

I changed the VBEval>FindText to the macrosched Pos> function and your script works perfectly.

Remove this: VBEval>FindText("whatever","%file%"),Pos

Add This: Pos>whatever,%file%,1,FoundIt
If>FoundIt>0
mdl>Found it
else>
mdl>Not found
endif>

Hoa
Newbie
Posts: 12
Joined: Mon May 29, 2006 5:33 am

Post by Hoa » Mon Jun 26, 2006 2:05 am

Thanks SkunkWorks.
That works OK.
Cheers
Hoa

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts