2 Alternatives on how to set a delay (VBScript)

Send Us a Sign! (Contact Us!)
Word PDF XPS Text
XML

You could use 2 methods to set a delay in [gs code], using VBScript: the "ping" or "sleep" approach.

[tweet]

The Ping approach

Sub subSleep(strSeconds) ' subSleep(2)

Dim objShell
Dim strCmd
set objShell = CreateObject("wscript.Shell")
'objShell.Run cmdline,1,False
strCmd = "%COMSPEC% /c ping -n " & strSeconds & " 127.0.0.1>nul"
objShell.Run strCmd,0,1
End Sub

The Sleep approach

Function MySleep(milliseconds)

set WScriptShell = CreateObject("WScript.Shell")
WScriptShell.Run "Sleep -m " & milliseconds, 0, true
End Function

SOURCE

LINK

LANGUAGE
ENGLISH

1 thought on “2 Alternatives on how to set a delay (VBScript)”

Comments are closed.