Forum Discussion

dbaechtel's avatar
dbaechtel
Contributor
12 years ago

How do you do a time delay in TC vbScript?


The following gets a syntax error:

WScript
.Sleep 100

5 Replies

  • murugans1011's avatar
    murugans1011
    Regular Contributor
    Not sure this will work in TC. but u can write separate vbscript function for sleep and store it in vbs file(*.vbs) and u can execute it from TC. Instead u can use testcomplete builtin function for delaying script execution

     

     'aqutils.delay(5000)  '5 seconds



    Delay method
  • Or even easier, you can drop the aqutil or builtin. 



         delay 5000



    ...will delay 5 seconds. And if you want to change the indicator text (the text that displays in the upper-right when tests run):



         delay (5000, "waiting for XYZ to happen")
  • I often take keywords that I don't know the equivalent script command for and put them by themselves in a keyword test.

    Then right click on the name of the test in the keyword tests folder and click 'convert to script' on the popup menu that appears...



    Follow the steps and you get a script example of how to do that keyword command in a script.



    For testComplete's built in delay it's:



    Call Delay(<number of milliseconds>, ["message to display while waiting"])



    (don't add in the < > or [ ]...)
  • MikeSchmid's avatar
    MikeSchmid
    Occasional Contributor
    I use TC with vbscript.

    for a delay I use:

    BuiltIn.Delay(x) where x is the number of milliseconds to be delayed. So if you wanted a 5 second delay for example you would do.

    BuiltIn.Delay(5000)