July 9, 2003

By Karen Kenworthy

IN THIS ISSUE

Hope you had a great week! Here in the U.S., we've just celebrated the 227th anniversary of our independence from the English despot, King George III!

To mark the event, the woods behind the secluded Power Tools workshop were alive with the sound of fireworks and other celebrations. Flags fluttered from every flagpole, and families cooked supper on their outdoor grills.

The final totals aren't in yet, but I believe new records were set for consumption of hot dogs and lemonade. :)

Days of Our Lives

These days it seems our lives are full of important events and remembrances. Birthdays, anniversaries, appointments, deadlines -- you name it. Some are happy events, and some aren't. But either way, it seems we're being ruled by our clocks and calendars.

I guess that's why my little Countdown Timer II program is so popular. It helps folks remember upcoming events, counting down the days, hours and minutes remaining until the appointed time.

Then, at the selected moment, it can display an alert, send an e-mail message, direct an on-screen animated messenger, or play a sound or video file. It can even open your browser and navigate to a particular web page, or run a selected program.

Just last week we talked about one recent change to this Power Tool. Now, it can automatically shutdown a computer at a scheduled time, with help from another Power Tool (the Show Stopper). But that is just one new trick the Countdown Timer has learned. During a marathon programming session I added several other features that readers have requested.

Command Line Fun

One cool new feature, that might have gone unnoticed, helps you run a program when an event's time has come. The program has long been able to play an audio or video file. It can also open a spreadsheet, word processing document, or other file. The Timer can even mark an event by opening a selected web page.

The Countdown Timer can also run any program to mark the arrival of an event. When adding a new event, just enter the full path of the program file in the box labeled "Play, Open or Run This File". If the program needs any command-line parameters, they can be entered there too, after the program's name.

Normally this worked well. When an event's time ran out, the selected program ran, and processed any command line parameters provided. But there's a potential problem lurking here. To understand it, let's take a quick look at how Windows deciphers a command line.

As you probably know, a command line can consist of two parts. The first is the name of the program to be run. The second, optional, part contains "parameters" or "arguments" -- bits of text that tell the program what we'd like it to do.

Windows must separate our command lines into its two parts. To do that, it normally looks for the first space character in the command line. For example, let's see how Windows decodes this command line:

    C:\Windows\System32\Notepad.exe mytext.txt

First, it scans the command from left to right, looking for a space character. In this case, the first one it finds immediately follows "Notepad.exe", and precedes "mytext.txt". So Windows divides our example into these two parts:

    Program: C:\Windows\System32\Notepad.exe
    Parameters: mytext.txt

Windows is now ready to launch the program, and send the parameters from the command line. Simple, right? No problem here.

So, what's the problem? Well, consider this command line:

   C:\Program Files\Stopper\PTStopper.exe /logoff

Ask Windows to examine this command, and here's what it finds:

    Program: C:\Program
    Parameters: Files\Stopper\PTStopper.exe /logoff

Oops! The space character in the middle of the program's path confuses Windows. It still assumes the space marks where the program's name ends, and the parameters begin. As a result, poor Windows tries to run a program named "C:\Program". :(

To put things right, we need to give Windows a little help: We must place quotation marks around any program path that contains spaces. This rule applies when running programs from the MS-DOS command line, and when creating or editing a Windows shortcut. And it applies when asking the Countdown Timer II to run a program.

Unfortunately, Windows isn't much help. It won't tell you when quotation marks are needed, let alone add them automatically.

But the newest Countdown Timer does! It now inspects each command line you enter for an event, making sure the program path is properly quoted. If it isn't, the program warns you of the possible problem, and even offers to add the needed quotes for you.

More Neat Stuff!

Entering an event's date is also easier, thanks to a new on-screen calendar. Just scroll through the calendar's years and months, then click on the desired day. An on-screen digital time display also helps entering an event's time.

Even launching the new Countdown Timer is easier now. Several readers have asked how to start the program automatically, each time Windows loads. In the past, I've suggested they create a shortcut to the Countdown Timer, placing the shortcut in the Startup folder on their Start menu.

As you probably know, Windows loads every program it finds in the Startup folder, whenever Windows starts. So a shortcut there ensures the timer will always be running, keeping you on-time and out of trouble.

But the Countdown Timer is a Power Tool. So why should we have to create this shortcut ourselves? Why doesn't the timer create the startup shortcut for us?

Well, now it does...

Right-click your mouse on the program's main window, and you'll see a small "context" menu. A new choice, "Add Shortcut to Startup Folder", immediately creates the shortcut for you. If you change your mind, just display the context menu again. Now, you'll see a choice reading "Remove Shortcut from Startup Folder"!

Want more? How about automatically deleting an event, after you've been notified of its arrival? To enable this option, look for the checkbox labeled "Delete Event When Done" when defining an event. Place a checkmark there, and that event won't linger after it's time has come and gone.

The newest Countdown Timer also allows you to take your events with you, moving them from one computer to another or creating a backup of your event schedule. Simply select "Export Events" from the program's context menu, and the timer will store all your event information in a small text file. On the same menu you'll also see the choice "Import Events", allowing you to add previously exported events.

Another change allows you to display the Countdown Timer's main window full-screen, minimized, or anywhere in between. You can also order the program to display dates and times using the standard format you've chosen via Windows' Control Panel. A single checkmark on the Display Preferences window does the trick. And the same window still lets you customize the way event dates and times appear.

Whew! Believe it or not, there's one more thing you ought to know about the new Countdown Timer II. It involves a tale of time and dates, of customs strange and true.

But that will have to wait until our next get-together. In the meantime, if you'd like to put the new Countdown Timer II to work, just visit the program's home page at:

    https://www.karenware.com/powertools/ptcount2

The latest Show Stopper is available too, at:

    https://www.karenware.com/powertools/ptstopper

As always, both programs are free (for personal use). And curious programmer-types can download the program's free Visual Basic source code too!

Or if you prefer, get the latest version of every Power Tool, including the new Countdown Timer II and latest Show Stopper, on CD. The disc also includes three bonus Power Tools, not available anywhere else. You'll find every back issue of my newsletter, and a few articles, in the CD's library. The CD even includes a special license that lets you use your Power Tools at work.

Best of all, buying a CD is the easiest way to support the web site and this newsletter. To find out more about the CD, visit:

    https://www.karenware.com/licenseme

Until we meet again, stay safe and free. And if you see me on the 'net, or riding in an Independence Day parade, be sure to wave and say "Hi!"