WScript Sleep- Exercise Desktop Remainder - Blogs
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

Don’t Postpone Digital Transformation, but Firm up on the Strategy during COVID-19 pandemic

Trust you and your teams are safe!The recent outbreak of COVID-19 has affected lives around the worl...

Read More >

Swift Closures

In this blog post we will learn what is a closure, it's syntax and types of closures in Swift with e...

Read More >

New and Important things to know for better RDLC report design in NAV 2013 R2.

We are all learning new things about RDLC report design and we know that still there are lot of thin...

Read More >

Azure DevOps Overview

Now a days Azure DevOps is very famous with IT and Operations team along with developers, so what is...

Read More >

Bugzilla to TFS Migrator (Part 4 of 4) - Migration

This is the final part of the Bugzilla to TFS Migrator blog series covering the actual steps of migr...

Read More >

Bugzilla - TFS Migrator

Bugzilla to TFS 2013 MigratorSeamless, Stress-free and Simplified Migrations using CDMT “Canar...

Read More >

Legacy Migration

vinay.ramamurthy

Read More >

Wireless Ad-Hoc distribution for iOS apps

Creating Ad-Hoc is an important part of iOS app development because it helps us in testing the app d...

Read More >

How to Build an Online Help Page in Microsoft Dynamics NAV 2013 R2

Online help page is a web page which displays information in a web browser when user presses the key...

Read More >

Mobile Apps

There are mobile applications and then there are Applications done by Canarys. Smart phones and tabl...

Read More >

Share

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

Sign Up

  • Recent
  • Popular
  • Tag
Tags
Monthly Archive
Subscribe
Name

Text/HTML
Contact Us
  • *
  • *