X
13Jul

WScript Sleep- Exercise Desktop Remainder

Introduction - WScript.Sleep

 

WScript.Sleep

                  Suspend the execution of the current script for the specified number of milliseconds.

Syntax:

WScript.Sleep Time

Arguments:

         Time is the delay in milliseconds.

Example:                                              

          WScript.Sleep (10000)

          WScript.Echo (“10 Seconds have passed”)

A script can force itself to pause by calling the WScript Sleep method. The Sleep method accepts a single parameter that indicates how long, in milliseconds, to pause the script. (There are 1,000 milliseconds in a second and 60,000 milliseconds in a minute.)

You will need to use the Sleep method in your scripts when:

·         Your script must wait for an event to occur before continuing to run.

·         You want your script to periodically check the status of a system parameter (for example, checking processor usage every 10 seconds).

·         Your script is interacting with a user and you want to slow the interaction to a usable speed. For example, when displaying events retrieved from an event log, you might want to insert a pause, giving the user time to read the first event before displaying the next event.

 

   VBScript for creating countdown time is easy with the WScript.Sleep method. These sleep reads in one variable integer time in milliseconds.Wscript.sleep will suspend your script for the indicated number of milliseconds.

Suspension is useful when you need to add a delay or a pause to your project. For example, a delay is often necessary when sending keystrokes via VBScript .Another neat use for the WScript.Sleep function is to create a timer or reminder.

Why required Desktop Exercise reminder?

Remember the days when “work” meant manual labor with a side of blood, sweat, and tears? Neither do we. These days it seems we’re more likely to log hour after idle hour with our bums glued to our seats. And while you may be an Excel champ by day and gym rat by night, recent research suggests that the recommended 30 minutes of cardio five times per week may not undo the health risks of a sedentary lifestyle.

So what’s a worker chained to his or her desk to do? Luckily short bouts of aerobics, strength exercises, and stretching in between conference calls and Gchats can help improve fitness levels and heart health  . While these deskercises, or desk exercises for the cubicle-bound, won’t promise Olympic mile times or six-pack abs, they might just improve strength and burn a few extra calories to boot. Our day to day office life we may forgot to do some task for that we required remainder which can make us alert to doing a particular task in particular time for these I designed windows based script to execute.

This script act us reminder every 30 minutes to do action like The Twinkle Top, Stretch your legs

Example:  WScript.Sleep

Desktop Exercise reminder script

 

 

 

Dim dtext

Dim dTimer

 

dtext=InputBox("Do you want me to remind you anything later on?","Reminder")

dTimer=InputBox("Enter timer interval in minutes","Set Timer") 'minutes

 

do until IsNumeric(dTimer)=True

  dTimer=InputBox("Invalid Entry" & vbnewline & vbnewline & _

         "Enter timer interval in minutes","Set Timer") 'minutes

loop

 

if dTimer<>"" then

do

  WScript.Sleep dTimer*60*1000 'convert from minutes to milliseconds

  t=MsgBox(dtext & vbnewline & vbnewline & "Restart Timer?", _

    vbYesNo, "It's been " & dTimer &" minute(s)")

  if t=6 then 'if yes

       'continue loop

  else 'exit loop

       exit do

  end if

loop

end if

How to Create the WScript file:

1. Create new file Timer (filename).vbs

2. Open Timer.vbs (if necessary, right click and open with notepad)

3. Paste above code in the file

4. Save the file

Execute VBScript:

There is number of way to execute a VBScript. I show below few options how to run the script

1. Double click the file

2. Open Command Prompt Cmd.exe

         a. Navigate file location Timer (filename).vbs

         b. Type wscript Timer.vbs

         c. Type cscript Timer.vbs

        d. Type run Timer.vbs

 

When executed this script prompts the user to set remainder message to remind and set timer using the Input box function. Each time the timer expires, a message box gives you the option to restart timer. I used this script to remind me to do twinkle top every 30 minutes at the office. If you’re an office worker, this example is sure to help you battle the sedentary lifestyle.

Input1

OUTPUT

Output1
 


          

Application proposal - WScript.Sleep

1.       Timer scheme

1.       Exercise Timer (The slog then log, The Mover and Shaker, The Seated Leg raise etc.)

2.       Tea Timer

3.       Lunch Break Reminder

2.       Other scheme

1.       Pause Code while External Application Loads

2.       Wait for a Connection to become Established

3.       Add a delay before using SendKeys

1.       Delay sending Login information

2.       Pause FTP commands

4.       Add a delay to a print job

5.       Delay to send the email

6.       Shut down/logoff/hibernate the personal computer with in specified time

7.        Monitor the remote server popup alert message to admin if process exceeds utilization.

 

Related

Memory Management in iOS

Memory Management iOS In this blog we will walk through very important thing which all iOS developer...

Read More >

End to End Testing Using Visual Studio 2010. (Power of Visual Studio-Ultimate for Testing. )

Scenario:Usage of Manual Test case(MTM) to perform the Load Test using Visual Studio 2010.We call it...

Read More >

Kubernetes basic Objects

In this article, we will learn about the basic objects of Kubernetes in detail with their respective...

Read More >

Widespread Web Application Testing Checklist

While testing the web applications, one should consider the below mentioned checklist. The below men...

Read More >

Mobile Operating Systems And Cross Platforms

Current Popular mobile operating systems are:Android from Google Inc.(Open source)initial release :2...

Read More >

What is Defect? Defect Life Cycle in Software Testing.

Defect is an unexpected behavior of the software application flow against the requirement specificat...

Read More >

Microsoft Azure : The cloud for modern business

 Why Azure? Microsoft Azure: Cloud Computing Platform and Services Move faster Save Money ...

Read More >

How to upload documents to SharePoint 2013

IntroductionSharePoint is a browser-based collaboration, content management, and extensible platform...

Read More >

Apache Maven – A tool to build Artifacts

Apache Maven is a software project management and comprehension tool. Based on the concept of a proj...

Read More >

Share

Post a Comment

Try DevOpSmartBoard Ultimate complete Azure DevOps End-to end reporting tool

Sign Up

  • Recent
  • Popular
  • Tag
Monthly Archive
Subscribe
Name

Text/HTML
Text/HTML
Contact Us
  • *
  • *