How to Schedule Programs to Run Automatically

It's often very handy to be able to schedule tasks to run unattended. The classic example is backup. I backup my key data each night at 2.00 a.m. and thankfully I don't have to be there to make it happen. Instead it takes place automatically using the task scheduler built into the backup program.

However, not all programs have an inbuilt task scheduler. In these cases it's still possible to run the program using a scheduling program. In this article we will look at two: Task Scheduler  that comes free with all Windows versions from Windows 98 onwards and a rather more sophisticated freeware product called System Scheduler.

Windows Task Scheduler

Windows inbuilt scheduler is perfect for scheduling programs that don't require any keyboard inputs to run.

Let's explore the use of Windows Task Scheduler by setting up an automated daily task to clean all the junk files off your hard drive. I'll use Windows XP in this example but the technique I'll describe works for Vista and Windows 7 as well though the interface for Windows Task Scheduler is a little different in each case.

The program we will use to do the cleaning is the excellent free utility CCleaner. If you don't have a copy, go grab it now from here: http://www.filehippo.com/download_ccleaner/

After downloading, install the program on your PC. During the installation make sure you un-check the option to install the Yahoo Toolbar, unless, that is, you really want it. After installing CCleaner start the program and check the default cleaning options to make sure these are what you want. For example, if you want to retain your browser history and auto-complete make sure those boxes are unchecked. Once you are happy with the options, shut down CCleaner.

Now start up the Windows Scheduler by clicking Start / Control Panel / Scheduled Tasks / Add Scheduled Task.  Click on Add a Task and this will start the Scheduled Task Wizard. Click <Next> and this will bring up a list of programs. Select CCleaner then <Next>.

Then select Daily and <Next>. Then whatever time you want the program to automatically run and <Next>. After that, enter your username and passwords followed by <Next>. Don't click <Finish> just yet.

Now we need to use a little trick. If you stop at this point CCleaner will run automatically at the prescribed time but won't actually do any cleaning. It will be just sitting there waiting for you to press some buttons.

To get around this you need to tell CCleaner to run without any user intervention. Thankfully the folks at CCleaner have provided a special command line option to do this.

To add the command line option, check the "Open advanced properties" box in the Task Scheduler Wizard and then <Finish>. In the "Run" box you should have something that looks like this:

"C:\Program Files\CCleaner\ccleaner.exe"

Now click at the end of this line just after the .exe, leave a space and then type in /AUTO so the complete line now looks like this:

"C:\Program Files\CCleaner\ccleaner.exe" /AUTO

The /AUTO tells CCleaner to run automatically once started and exit automatically when finished which is exactly what you want.

Well that's it! You've now created a scheduled job that will clean your hard drive of unwanted files every night.

If you want to create other scheduled jobs such as backup or defragging your hard drive you can do so in the same way.

Unfortunately, not all programs have command line options like CCleaner that allow automatic running without user input. For these programs to run automatically you need a program that can automate the entry of keystrokes.

System Scheduler

For more complex task scheduling my top choice is System Scheduler. It does a similar job to Windows Scheduler but additionally it allows you to enter any key-presses required  by a program in order to run.  You can do this by entering into System Scheduler a line containing the keystrokes you want to execute when the program runs.

Lets look at a practical example using DiskKeeper Lite. When you run this program you need to click a few buttons in order to start a defrag job. Usually you would use your mouse to do this clicking but you can also use keystrokes to achieve the same thing ike this:

  • Close the nag screen. This can be done from the keyboard in DiskKeeper by pressing Alt F4
     
  • Select the menu item "Actions."  This can be done from the keyboard by pressing Alt A
     
  • Select from the Actions menu the item "Defragment." This can be done from the keyboard by pressing the "D" key

In System Scheduler you would do this by entering the string "%{F4}%{A}D" into the "Sendkeys" field within the System Scheduler job setup panel.  Note that in System Scheduler plain keystrokes such  as "D" are entered as you would normally type them but special keystrokes such as Alt  F4 have to be entered using a code like %{F4}. Full details of these special key codes can be found in the System Scheduler help file.

The developer offers a free and a Pro version of System Scheduler. The latter has some useful additional features such as the ability to reboot and run as a service but the free will do for most folks. Furthermore, the free version covers both home and business use.

Gizmo

Share this
4.236365
Average: 4.2 (55 votes)
Your rating: None

Comments

by beau on 23. February 2013 - 15:24  (105698)

How can Task Scheduler be forced to display a message on top of all other open windows?
I can't find anything like "On top" under Properties.
I'm running Win7

Gizmo's Freeware is Recruiting!

Gizmos Needs YouShare your knowledge of free software with millions of Gizmo's readers by joining our editing team.  Details here.