Need some help please please

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

Need some help please please

Post by Hoa » Wed Jun 21, 2006 8:51 am

Hi support,

Could some one please let know what am I doing wrong here. I have run the following script several times. But sometime It display the message box and sometime it does not. I just can't figure out what is the problem with it.


Thanks soooooooo much for your help.




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

Sub FindText(sSearch,sTagName)
dim Num
dim t
dim sText

set t = IE.document.getElementsbyTagname(sTagName)
for Num = 0 to t.length-1
sText = t.item(Num).innerText
if instr(sSearch,sText) > 0 then
msgbox "search = " & sSearch & ", innertext = " & t.item(Num).innerText
exit for
end if
next
End sub

VBEND

VBRun>CreateIE,1
VBRun>Navigate,http://www.sportingbet.com.au/uipub/?ev ... tType=dogs
VBRun>WaitBusy
waitwindowopen>Sportingbet Australia*
VBRun>FindText,Arvos Maria,TR
VBRun>KillIE

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

Post by pgriffin » Wed Jun 21, 2006 2:44 pm

I put in a few Wait> commands to try to see if anything unexpected was happening and your message box has worked on every attempt.

Here is your code with my changes. Like I said, only added Wait> to slow it down.

Code: Select all

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

Sub FindText(sSearch,sTagName)
dim Num
dim t
dim sText

set t = IE.document.getElementsbyTagname(sTagName)
for Num = 0 to t.length-1
    sText = t.item(Num).innerText
    if instr(sSearch,sText) > 0 then
       msgbox "search = " & sSearch & ", innertext = " & t.item(Num).innerText
       exit for
    end if
next
End sub

VBEND

VBRun>CreateIE,1
wait>3
VBRun>Navigate,http://www.sportingbet.com.au/uipub/?eventId=413560&eventType=dogs
wait>3
VBRun>WaitBusy
waitwindowopen>Sportingbet Australia*
waitready>0
wait>5
VBRun>FindText,Arvos Maria,TR
wait>3

VBRun>KillIE

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

Post by Hoa » Thu Jun 22, 2006 1:11 am

Hi SkunkWorks,
Thanks so much for your quick response!
Put in a few Wait> commands to slow things down is OK. But because time is very critical in my project (even 2 or 3 seconds). I guess if there is no other alternitive then I have to live with it then.

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

Post by pgriffin » Thu Jun 22, 2006 2:37 am

You can try reducing the wait times to speed the program while still allowing it to run....

It's always a difficult thing to choose between performance and reliability....

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

Post by Hoa » Thu Jun 22, 2006 4:20 am

[It's always a difficult thing to choose between performance and reliability.]

Yeah! totally agree with you SkunkWorks.
thank you so much.
best regards

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