'; window.popUpWin.document.write(zhtm); window.popUpWin.document.close(); // Johnny Jackson 4/28/98 } //--> Windows 98 Professional Reference -- Ch 34 -- Automating Tasks


Windows 98 Professional Reference

Previous chapterNext chapterContents


- 34 -
Automating Tasks



Windows 98 provides some important automation features that weren't available in off-the-shelf versions of Windows 95. Scheduling with Task Scheduler means you can run jobs routinely--they are never forgotten or ignored. The Maintenance Wizard helps you configure utilities to keep your computer running smoothly. Also new to Windows 98 is Windows Scripting Host, a robust mechanism designed to help you automate basic desktop functions (see Chapter 33, "Windows Scripting with Windows 98 Scripting Host").

Understanding Task Scheduler

Task Scheduler is a background application that loads each time you start Windows 98. You use Task Scheduler to schedule routine disk-maintenance operations or to schedule any other tasks that you need to run on a recurring basis.

You can access Task Scheduler in the following ways:

During installation, Windows 98 creates three scheduled tasks for you, as shown in Figure 34.1.

Figure 34.1

Windows 98 automatically sets up ScanDisk, Defragmenter, and Disk Cleanup scheduled tasks.

Before you set up your own scheduled tasks, it is important to understand the concept behind Task Scheduler. Task Scheduler can launch only program files, data files from registered application programs, or script programs. Think of Task Scheduler as an automatic way of using the Windows Run Command dialog box at a prearranged time. Table 34.1 is a list of the supported files types.

Table 34.1 Task Scheduler File Types

File Type Description General Description
Executable files File extensions .com and .exe. Command line switches are allowed.
DOS batch files File extension .bat.
Windows application files Any Windows program data file with a registered file type extension.
Windows Scripting Host File extensions .js and .vbs.

Scheduled tasks are inserted into the Task Scheduler application where you carry out all scheduling and task-modification functions. From the Task Scheduler, you will be able to:

Automating Tasks with the Task Scheduler

By scheduling tasks to run on a regular basis, your productivity will improve. Think about the routines you perform manually in Windows. Is there an icon you click regularly to generate a report? Do you open a spreadsheet at the same time every day? Maybe you use a zip disk to back up files on your hard disk every day. Here are some examples of the types of tasks you can schedule:


NOTE: Task Scheduler is an updated version of the Microsoft Plus! System Agent. All System Agent scheduled events present on your system were automatically converted to Task Scheduler during the Windows 98 installation routine.


Using the Scheduled Task Wizard

You add all tasks and set all basic properties of a task through the Scheduled Task Wizard. The Scheduled Task Wizard uses a step-by-step approach to walk you through scheduling tasks and setting all the runtime properties necessary for tasks to execute.

To add a new task to Task Scheduler, double-click the Task Scheduler icon in the Notification Area of the taskbar. Click the Add Scheduled Task icon to launch the Scheduled Task Wizard program, as shown in Figure 34.2.

Figure 34.2

Add a scheduled task with the Scheduled Task Wizard.

Click Next to continue. The Wizard presents a list of registered Windows application programs found on your PC, as shown in Figure 34.3. By default, all registered applications appear in the program selection box. Select the program you want to schedule. Click the Browse button to search your hard disk for other applications not found in the program selection box, such as DOS programs or batch files.

Figure 34.3

Select the program you want to schedule.

Click Next. Accept the default task name or replace the name of the task with a more friendly name that describes the program to be used or the task to be scheduled, if you want to. From the Perform this task list, choose an interval (frequency) or event from which to trigger the execution of the task, as shown in Figure 34.4.

Figure 34.4

Name the scheduled task and specify an interval or event.

Depending on the interval or event you have chosen for your task, you will be presented with a different dialog box for each setting. The available choices are shown in Table 34.2.

Table 34.2 Scheduled Task Intervals and Events

Task Interval Interval Options Values Start Options
Daily Every day Date  
  Weekdays Only    
    Number of days between runs 1-365
Weekly Every number of weeks   1-52
  Days of the week Mon.-Sun.  
Monthly Day of the month   1-31
  1st, 2nd, 3rd, Mon.-Sun.  
  4th, or last day    
One Time     None
System Startup     None
Logon     None

Choose an interval or event. Click Next. The Scheduled Task Wizard tells you that your task has been successfully scheduled, as shown in Figure 34.5.

Figure 34.5

The scheduled task is ready to be entered in your Windows schedule.

Enable the Advanced properties check box if you want to further customize settings at the conclusion of the Wizard. These advanced properties are optional. To view the advanced properties later, right-click a Scheduled Task, and then choose Properties.

Click Finish to end the Scheduled Task Wizard. Your new scheduled task now appears in the Scheduled Tasks window, as shown in Figure 34.6.

Figure 34.6

The Scheduled Task Wizard has added the new task to your Windows schedule.

Deleting and Modifying Tasks

Each task in Task Scheduler can be modified or deleted. Right-click a task and choose Properties to modify its settings, or choose Delete to remove the task from the Scheduled Tasks window.

You can easily modify the settings or properties of a scheduled task.


TIP: To run a task immediately, right-click the task and choose Run.


Task Scheduler Advanced Options

The Task Wizard enables you to set job intervals to run as frequently as every day. As shown in Table 34.3, you can use the Task Scheduler Advanced properties to schedule down to the minute. The Optional settings enable you to configure Task Scheduler to perform a post-task deletion, run a task only when the computer is idle, or enable power-management options.

Table 34.3 Task Scheduler Advanced and Optional Settings

Advanced Schedule Options Optional Settings
Start and End Date Task Completed Options
Repeat Task Options Idle Time Settings
Stop Time Power Management Options

Advanced schedule properties are not set through the Task Wizard. Rather, you right-click a scheduled task, choose Properties, and then select the Schedule tab. Then click the Advanced button. Using the Advanced Schedule Options dialog box, tailor the options to meet your task's requirements, as shown in Figure 34.7.

Figure 34.7

Set advanced schedule options to meet your requirements.


TIP: Tasks are stored on your hard disk in the C:\Windows\Tasks folder. This is a special Windows system folder. To view the contents of this folder, use Windows Explorer or navigate to the folder from the MS-DOS command prompt. A task is assigned a .job file extension. To edit a task from Windows Explorer, right-click the task and then choose Properties.


From the Advanced Properties tab, you can specify the following optional settings:

You can set the Scheduler to repeat a task by the minute or by the hour for any duration. Or you can repeat a task until a specified time. After the end time is reached, you can elect to terminate the task.

Advanced Options are used to set the scheduler to stop a job before a particularly resource-intensive task starts. For example, you can make sure that ScanDisk or Defragmenter stops before you start Disk Cleanup.

Click on a scheduled task's Properties Settings tab to control task completion and idle time, and to enable power-management features as follows:

Task Scheduler Limitations

You will undoubtedly find ways to schedule multiple jobs to suit your needs. In that regard, Task Scheduler helps you become more efficient and more productive. Task Scheduler only runs programs, however; it does not interact with them. After Task Scheduler launches your application, its job is finished.

If, for example, your application must display a dialog box because user intervention is required (a choice or selection must be made), the program will halt. Task Scheduler is not a macro-like program designed to supply keystrokes or enter other information.

It might be possible to use a third-party batch or macro language program to create the necessary steps to activate a program, and then step through the required commands, or you might be able to use the new Windows Scripting Host feature to execute a custom script (see Chapter 33). This macro or batch program could then be entered as a scheduled task.


NOTE: An application waiting for a response will sit indefinitely unless you set the scheduler option to terminate the job after a specified period of time.


Scheduling Tune-Ups with the
Maintenance Wizard

Think of the Maintenance Wizard as an office manager. Someone who must schedule and coordinate clerks to organize the files, make sure the custodial service empties the trash, and periodically send someone to inspect the building's foundation for any sign of weakness. The Maintenance Wizard consists of the three components shown in Table 34.4.

Table 34.4 Maintenance Wizard Utilities Programs

Name Description
Disk Defragmenter Logically organizes files and folders on your hard disk for faster access
Scandisk Checks your hard disk for file system problems
Disk Cleanup Deletes unnecessary files on your hard disk

These maintenance utilities have already been set up in your Scheduler Tasks folder as part of the Windows 98 installation routine. You can start the Maintenance Wizard at any time, however, to collectively run the maintenance programs or to modify program settings. To start the Maintenance Wizard, use either of the following methods:

The Maintenance Wizard dialog box opens, as shown in Figure 34.8.

Figure 34.8

Perform maintenance now or change the settings or schedule.



TIP: You can edit each maintenance task manually from the Task Scheduler folder.


You are presented with two options--either perform maintenance now or change your settings or schedule. To tune your system now, enable the Perform Maintenance Now radio button and then click OK. To customize the way the Maintenance Wizard functions, or to change settings and schedules, enable the Change My Maintenance Settings or Schedule radio button and then click OK.

The most complete way to schedule maintenance is to select the Custom option. If you choose this route, you will have to make a number of choices about the way your computer will be optimized. The following choices are available:

Now that the jobs are scheduled on a regular basis, a certain amount of planning might be necessary. Depending on the size and number of hard disks and the other jobs you have running, if you were to run a thorough ScanDisk every night, you should probably make sure that it doesn't conflict with other tasks. You also wouldn't want it to interrupt you when you are working at your computer.

Maintenance Wizard and Improved System
Performance

Any solid disk-management program for your computer should include backing up files regularly, running ScanDisk to check the integrity of your disk(s), and using Defrag to keep the files on disk in order. The key is to run these tasks on a regular basis. Chances are, on most computers without scheduling, these tasks are not done as regularly as they should be. Another facet of good disk management is to be sure to delete temporary files and any leftover files from setup applications. With the exception of a backup, the Maintenance Wizard schedules all these system activities as regularly as you need.

See Chapter 35, "Tools and Strategies for Optimizing Windows 98," for more information about ScanDisk and Defrag. See Chapter 20, "Backup and Restore," for a discussion of Windows 98 Backup.

The Windows Scripting Host

Windows Scripting Host (WSH) is a language-independent scripting host for Microsoft 32-bit Windows platforms. Thanks to this powerful Windows scripting feature, Windows 98 can execute custom scripts that perform complex tasks within the Windows environment. Windows scripting greatly expands the range and complexity of automatable tasks. You create a script that executes a complex operation within Windows, and then configure the Task Scheduler to execute that script at some regular interval. See Chapter 33, "Windows Scripting with Windows 98 Scripting Host," for more information about the types of scripts you can automate by using Windows Scripting Host.


NOTE: Windows 98 ships with 11 sample scripts. During installation these scripts are installed in the C:\Windows\Samples\Wsh folder.


Conclusion

Windows 98's Task Scheduler automatically launches applications and performs routine maintenance tasks. The Task Scheduler is somewhat limited in that it won't let you preconfigure responses to input requests. You can, however, perform complex operations through the Task Scheduler by using Windows scripts and batch files.


Previous chapterNext chapterContents

Copyright, Macmillan Computer Publishing. All rights reserved.