Add delays in VBscript or Python coding

Official translation unavailable. Translate this page with Google:

Problem

You want a short delay between executing actions or scripts in Automation or PowerForms, but there is no direct command to execute the delay in VBscript or Python.

Solution

Use the following code:

  • In VBscript:

    Dim dteWait 
    dteWait = DateAdd("s", 5.0, Now()) ' change the middle value for different number of seconds 
    Do Until (Now() > dteWait) 
    Loop 
  • In Python:

    import time 
    time.sleep(5) # delay = 5 seconds