How to use Wscript.sleep() in Active Script test

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
TalT
Posts: 6
Joined: Sun Aug 10, 2008 10:08 am

How to use Wscript.sleep() in Active Script test

Post by TalT »

Hi,
I was trying to create a delay in my Active Script test:

FUNCTION PerformTest()
While not <condition>
Wscript.sleep()
wend
END FUNCTION

I get the following error:
Error number :424
Source :Microsoft VBScript runtime error
Description :Object required: 'Wscript'

I'm not familiar with any other way to create a delay in VBscript
Any advice?
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Unfortunately its impossible to create Wscript object within Active Script.
There are 2 possible workarounds:

1) create separate VBS script with single command.
E.g. create Sleep5000.vbs file with single line "WScript.Sleep 5000"
Then you may add simple code into your main script
Sub Sleep5000
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "wscript.exe C:\path_to_another_script\Sleep5000.vbs", , true
End Sub

This allows you to call Sleep5000 procedure instead of Wscript.sleep

2) Use Shell Script instead of Active Script
You just need to modify your script a little
http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShell

Regards
Alex
TalT
Posts: 6
Joined: Sun Aug 10, 2008 10:08 am

Thank's for the help

Post by TalT »

Thank's for the help
Post Reply