Time Elapsed.

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
oinquer
Newbie
Posts: 7
Joined: Thu Jan 07, 2010 9:15 pm

Time Elapsed.

Post by oinquer » Thu Jan 07, 2010 9:19 pm

Hello everyone, i have a macro where i check for elapsed time, however my if statement wont match the condition it should.

at the beginning i get time only once.

VBSTART
VBEND
VBEval>Timer,inicio

then i iterate with a goto label trough this
VBSTART
VBEND
VBEval>Timer,verifica
let>verifica1=verifica-inicio
msg> verifica1
if>verifica1>600
Goto GameOver
Else
Let>verifica=0
EndIf

however it wont goto gameover when 600 but right after 7 or 8 seconds.....
i even put up a message box showing time to check...and it show normally 5.76755455 then leaves trough GameOver...should go much higher.
Any help? thanks.

User avatar
JRL
Automation Wizard
Posts: 3517
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Jan 07, 2010 9:42 pm

Try this:

Code: Select all

VBSTART
VBEND
VBEval>Timer,inicio
Label>Waiting
VBEval>Timer-%inicio%,verifica
msg>verifica
Wait>0.01
if>verifica>600
Goto>GameOver
Else
Goto>Waiting
EndIf

Label>GameOver
mdl>Fin

oinquer
Newbie
Posts: 7
Joined: Thu Jan 07, 2010 9:15 pm

Post by oinquer » Thu Jan 07, 2010 11:36 pm

VBEval>Timer-%inicio%,verifica

This line gives me a VBscript compilation error, sintax error.
...will try to check on myself.
if anyone knows how to fix it or do it help plz.

anyway....the problem seems to be in the if sentence...im debugging step by step and i check that variable is doing well...

with this code i can see seconds go up to 6 and just before it hit 7 jumps to the GameOver...
i am seeing a bug here? is the If sentence thinking its a 6 there instead of 600????
checked now that by changing the wait value the iterations the script does before failing changes too....
the time before failing is just around the 7-8 seconds for low wait times...
if i choose wait>40 per example it will fail only after 80 seconds iterations and has passed the 7-8 seconds mark, any help? thanks


let>i=0
VBSTART
VBEND
VBEval>Timer,inicio
Label>Waiting
VBEval>Timer,verifica
Let>verifica= %verifica% - %inicio%
msg>verifica
add>i,1
Wait>0.1
if>verifica>600
Goto>GameOver
Else
Goto>Waiting
EndIf

Label>GameOver
mdl>Fin , %i%

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Fri Jan 08, 2010 12:15 am

Hi oinquer,

What version of MS are you running?

JRL's code (uncompiled) works as posted for me in MS ver 11.1.19 on XP.

Are you trying to compile this and that's when you get that error?

I just compiled and it compiled fine as well.

I ran the compiled exe and it appeared to run fine... though I did not wait the 600 seconds necessary before killing it.

???

Take care
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

User avatar
JRL
Automation Wizard
Posts: 3517
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Jan 08, 2010 12:20 am

Sorry I'm not much help. Your latest code works perfectly for me. Maybe its a regional settings issue.

oinquer
Newbie
Posts: 7
Joined: Thu Jan 07, 2010 9:15 pm

Post by oinquer » Fri Jan 08, 2010 12:23 am

hmmm ok...
im running MS11

will try on another computer tomorrow...maybe some problem with this one...
tried it uncompiled, will try to compile it then...maybe it works...
Thanks.


even after compiling i get the error in VBeval about sintax error with jrl script, will try compiling mine and tomorrow try another pc!

Thanks going to sleep now

EDIT:

Tried it on a virtual pc with windows XP portuguese and on my laptop with windows XP English and its the same error, in JRL gives the Sintax error in VBeval and mine will jump after a few seconds.
Just leaving here this so if someone comes across the same knows something already.
Will use another method without time...
Have a good time!
and thanks everyone

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