November 24, 2009

How to use the Windows Task Scheduler

Introduction , Installation, Use & Problem Solution

The Microsoft Task Scheduler is an amazing little FREE tool that (in most cases) comes already with your Windows installation and "hides" in the "Control Panel" folder which is located in the "My Computer" folder on your desktop. In the following text we share our experiences to help you to make most out of this tool.
Scheduled Tasks
1. Introduction to the Microsoft Windows Task Scheduler

By using Task Scheduler, you can schedule tasks such as to automate web testing and site monitoring or system tools like the Disk Defragmenter to run at a time that is most convenient for you. Task Scheduler starts each time you start Windows, and runs in the background. With Task Scheduler, you can: Schedule a task to run daily, weekly, monthly, or at certain times (such as system startup).

Disclaimer: The Tips & Tricks in the following are based on our knowledge and experience. If you should spot any error and omissions in this text, we would like to hear from you so that we can improve this page.

2. Using Task Scheduler:

If the task scheduler is installed on your system, you will find it in the My Computer folder. (If not, scroll down on how to obtain & install it)

To use the scheduling service on Windows 98, NT, 2000, click on the My Computer icon located on the Desktop. Then double-click on Control Panel to get to the Scheduled Tasks folder.

On Windows XP and Server 2003 you can access this from the Start Menu and clicking on Settings and then Control Panel to Scheduled Tasks.

Double-click Add Scheduled Task. Follow the instructions in the Add Scheduled Task wizard. Select the Open advanced properties for this task for more set up options.

The following screenshots highlight some of the more critical steps:

1. Add task and select program in the list of programs

Add Scheduled Task
Scheduled Task Wizard
If you do not find "your" program in this list, simply select any other program. You can always change the settings later and, for example, point it to a batch file (*.bat) or Windows Script (*.vbs).

2. For more options, mark the "advanced properties" box

Scheduled Task Wizard
Background explanation: A trigger is a set of rules that will cause the task to be executed. There are two types of triggers: time-based and event-based. Time-based triggers cause a task to be executed when the time/date of the trigger has been reached. Event-based triggers cause a task to be executed when certain system events occur such as start up, log on, or idle.

2. In the advanced options, check the executable path

Internet Macros Browser
So what you enter at the "Run" file could look like this:

"c:\Program Files\InternetMacros4\imacros.exe" -macro YourMacro -tray -loop 50

Important: The command line options must be placed OUTSIDE of the "" that surround the path.

"" are needed because otherwise path names with spaces (like in c:\program files\) can not be interpreted correctly by the task scheduler.

Important: If you want your task to run even if no user is logged in, you must enter a user name and password in the "Run As" box.

Tip: Alternatively you can point to a Batch file that contains the specific command line instructions to start the software. Also, with batch files you can conveniently execute several commands in a sequence:

Example batch (*.bat) file:

echo Example iMacros Batch File *TRAY MODE*
REM Tip: You may have to adjust the path names to YOUR installation directory of iMacros

"c:\Program Files\IM\imacros.exe" -macro Demo-FillForm -tray
"c:\Program Files\IM\imacros.exe" -macro Test-Shop -datasource items.txt
"c:\Program Files\IM\imacros.exe" -macro Test-Checkout

echo Batch file completed

How to schedule a VBS Script?

If you want to run iMacros (or any other software) via a VBS Script, simply open the VBS script directly in the task scheduler:

How to start a VBS Script via Task Scheduler
Screenshot: Scheduling a VBS Script with the Vista Task Scheduler

Suggested Readings

How to start or stop ALL scheduled tasks at once?

Scripting with Windows Script Host (WSH) - Save time with Windows Scripts

No comments:

Post a Comment