setTimeout not working in windows script (jscript)
javascript, wsh
Solution
It sounds like you're using `setTimeout` in a non-browser-based script (Windows Script Host or similar). You can't do that. You can, however, use `WScript.Sleep` to suspend your script briefly, with which you can achieve a similar effect. Also, `alert` is not a WSH function; you may want `WScript.Echo`. More on the WSH reference on MSDN.
Problem
When I try to run the following code in my program ``` setTimeout("alert('moo')", 1000); ``` I get the following error ``` Error: Object expected Code: 800A138F Source: Microsoft JScript runtime error ``` Why? Am I calling the wrong function? What I want to do is delay the execution of the subsequent function.