Can Shell Sleep method help?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
OlgaFB
Pro Scripter
Posts: 58
Joined: Mon Nov 01, 2004 3:04 pm
Contact:

Can Shell Sleep method help?

Post by OlgaFB » Mon Aug 14, 2006 8:50 pm

Hi,

I just saw this:

Sleep Method
See Also
Running Your Scripts | WScript Object
Suspends script execution for a specified length of time, then continues execution.

object.Sleep(intTime)
Arguments
object
WScript object.
intTime
Integer value indicating the interval (in milliseconds) you want the script process to be inactive.
Remarks
The thread running the script is suspended, releasing its CPU utilization. Execution resumes as soon as the interval expires. Using the Sleep method can be useful when you are running asynchronous operations, multiple processes, or if your script includes code triggered by an event. To be triggered by an event, a script must be continually active (a script that has finished executing will certainly not detect an event). Events handled by the script will still be executed during a sleep.

Note Passing the Sleep method a 0 or –1 does not cause the script to suspend indefinitely.


...and thought: may be we should better use this instead of MSch Wait? Or will it be the same, regarding to the system resources?

Thank you!
Olga.

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Tue Aug 15, 2006 2:39 pm

Looks useful, but can you please give an example of how to use this in macroscheduler?

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Aug 15, 2006 2:42 pm

Wait also calls the Win32 API sleep function and therefore does exactly the same as WScript's sleep function. In any case you cannot use WScript's sleep function in Macro Scheduler because, well, it belongs to WScript anyway. WScript is the Windows Scripting Host. So it is irrelevant to Macro Scheduler. Macro Scheduler's Wait does the same thing.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?


Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts