Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


October 22, 2001

VBScripting Solutions: Emulating Windows Synchronization Objects


RSS
View this exclusive article with VIP access -- click here to join |
See More Active Server Pages (ASP) Articles Here | Reprints | Or sign up for our VIP Monthly Pass!

Structure of the Caller
The caller script is the main actor, and the script must have a particular structure. The caller script must be able to spawn the various scripts, then stop to wait for events. Unfortunately, the WSH environment doesn't support these processes.

One way to stop a script's execution is to use a While loop based on a Boolean condition. However, such a loop, especially if it's indefinitely long, is expensive in terms of machine resources. Your script isn't in standby, but it must continuously verify that it has nothing to do.

WSH 2.0 (the version that shipped with Windows 2000) introduced another option. You can use WScript's Sleep method to efficiently put a thread to sleep. To call the Sleep method, use the syntax

Sleep 100

where 100 is the number of milliseconds the script will pause. The Sleep method times out the script from the system scheduler, marks the script as a not-runnable thread, and leaves it out of the CPU, abandoning it in some remote fold of the memory. After the specified number of milliseconds expires, the script's thread is marked as ready to run and waits its turn to possess the CPU again and continue its work. . . .

Top Viewed ArticlesView all articles
CES 2009: Ballmer Announces Windows 7, Windows Live, Live Search Milestones

During his first-ever Consumer Electronics Show (CES) 2009 keynote address last night in Las Vegas, Microsoft CEO Steve Ballmer announced the pending public availability of a feature-complete Windows 7, the final version of Windows Live Essentials, and ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

Where is Microsoft NetMeeting in Windows XP?

...


Related Articles How to Multi-Thread VBScript Scripts

Related Events Check out our list of Free Email Newsletters!

Scripting eBooks Keeping Your Business Safe from Attack: Encryption and Certificate Services

Best Practices for Managing Linux and UNIX Servers

Building an Effective Reporting System

Related Scripting Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2009 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing