Karen's Power Tools just $18.70 USD November 23rd
KarenWare.com Home Page
Home of Karen's Power Tools Newsletter and Programs
Home Newsletter Programs Order CD Contact Us Privacy

Home
Free Newsletter
Free Programs
Power Tools Gear
Compatibility
Karen's Quiz
VB Runtimes
Troubleshooting
Winmag.com
About Karen
Search

Order CD
Site Licenses
Recommend
Donate

Order Karen's CD Online!

Subscribe to Karen's free Newsletter

December 20, 2001

By Karen Kenworthy

IN THIS ISSUE

I get the best email! Among the more than 3,000 messages in last week's bag of email, I found a delightful note from reader Ove Labansen. Living in Greenland, he was able to give me the inside scoop on Santa Claus, complete with Santa's web address, http://www.santa.gl.

In the same bag was a beautiful note from reader David Becker, Sr. describing a Florida paradise known as Homosassa. It's a land of warm, crystal clear springs, manatees, exotic birds, and friendly people. Another reader, Nick Adams, sent me photos of his snow-covered cottage, in a mountainous region of in France. At least I think that's his cottage. All I really see is a mound of snow. :)

It makes me want to pack up the old van, and hit the road, and visit some of the special corners of the world. But then, I wouldn't be here to receive all that email. :)

File Filters

For example, I would have missed this note from reader Jason Taylor:

"I am a long time fan of almost all of your Power Tools. Especially the Directory Printer -- it is a lifesaver. However, I do wish it had some sort of built-in filter ... then it would be perfect. For example, if I could print out a list of all .jpg or .htm files in a directory but exclude all .bak files; then I would be happier than a pig in slop."

Now, my heart's not made of stone. I ask you, how could anyone not be moved by such an appeal? How could anyone deny Jason that much happiness. Especially in this season of gifts and miracles? :)

So late last week I woke up the Power Tools workshop elves, and we set about teaching the Directory Printer a brand new trick. By default, the new Directory Printer v3.3 behaves just like its ancestors, printing every file it finds. But now it can also be selective, only printing certain files -- files whose names pass through a chosen "filter."

The new Directory Printer comes with four pre-defined filters. One, named "Common Image files" allows the Directory Printer to print information about six types of disk files commonly used to store pictures or images. When this filter is selected, the program ignores all other types of files.

Other pre-defined filters restrict the Directory Printer to just "Common Sound files," "Common Executable files," "Common Document files" and "Common Internet files." Each filter acts as a blinder, letting the Directory Printer see some files, and hiding all others.

Hopefully these four filters will prove handy. But I know they are not enough. That's why you aren't limited to the filter's I've defined. The new Directory Printer lets you create a filter, edit a filter that already exists, or delete any filters you don't need.

To customize Directory Printer's filters, first click the program's new "Edit Filters" button. Immediately, the program will display a list of all existing filters, alongside buttons named "New File Filter," "Edit File Filter," and "Delete File Filter."

I'm sure you're way ahead of me now. The first button allows you to create a new filter. The second lets you edit a filter you've selected from the list. And the third deletes an unwanted filter from the list. Pretty simple, eh? :)

Wildcards

Well almost. But before you can bake a new filter, or edit an old one, you need to know how a filter is made. The ingredients are simple. First, a filter needs a name or description -- something like "Spreadsheet files". Then it needs one or more "wildcards."

I'm not much of a card player (though an uncle did teach me to play "52- card pickup"). But as I understand it, when a card is "wild," it's allowed to stand in for any other card in the deck. It's a sort of chameleon, becoming whatever card you need. For example, if have three Aces, and one wildcard, you can pretend the wildcard is another Ace, giving your four- of-a-kind (whatever that is).

Filename wildcards, the kind the Directory Printer understands, are similar. They are special filenames that change depending on circumstances. To see how the wildcards work, let's look at how Windows compares two filenames.

Suppose there's a file on your disk named "MySpreadsheet.xls". Now suppose you ask Windows if there's a file on your disk named "MYSPREADSHEET.XLS". What will Windows' answer will be?

Windows will say, yes, there is a file named "MYSPREADSHEET.XLS". That's because Windows ignores the "case" of the letters when comparing filenames. To Windows, an upper-case letter is the same as the lower-case version of the same letter. When deciding if two filenames have the same name, an "A" matches an "a", a "p" matches a "P", and so forth.

Most of us are familiar with this Windows filename feature, known as "case insensitivity." But less well-know is the role the characters "?" (question mark) and "*" (asterisk) play in the names of our files.

That may be because you can't actually give a file a name that contains a question mark or an asterisk. Try, and Windows will complain about an "invalid character.".

But you can ask Windows to search for filenames containing these special characters! Select Find (or Search) from your Windows Start menu, ask Windows to find files whose names contain these invalid characters, and Windows will go on its merry way.

Now does that make sense? Can't you see Bill Gates, chortling away in a dark corner of the attic of his new home, thinking about all of us, wasting time searching for files that can't possibly exist? Pretty funny, huh?

Well, Bill may be chortling. In fact, I've heard he chortles every day, whether he needs to or not. When he's too busy to chortle himself, he has people who chortle for him. But he's not chortling over our searches for files whose names contain asterisks and question marks.

That's because we're not wasting our time searching for files with these special characters in their names. We're actually saving time. When asked to search for files, Windows treats the question mark character as a "wildcard character." It matches any other character at same location within a filename.

For example, ask Windows to search for files named "C?re.txt", and it will find "Core.txt". It will find "Care.txt" and "Cure.txt" too, if files with those names exist. In effect, the question mark in your search specification takes on whatever single-character value is needed, in order to make a match.

The other wildcard character, the asterisk, is even more powerful. Place it in search specification, and it will match any number of characters. For example, ask Windows to find "C*e.txt", and you'll find Core.txt, Care.txt and Cure.txt, as before. But files named "Constantinople.txt" and "Can't find my file.txt" will also be considered a match.

Any search specification that contains a wildcard character is said to be a "wildcard." And it's easy to see the role wildcards play in defining Directory Printer's filters. The Directory Printer will print those files that match any of the wildcards found in the current filter, and ignore all files that fail to match any of the filter's wildcards.

For example, Directory Printer's pre-defined "Common Sound files" filter contains these three wildcards: *.wav (matches all Wave files, whose names end with ".wav"), *.mid (MIDI files, whose names end with .mid), and .rmi (a compressed form of MIDI file, whose names end in .rmi).

If a file's name matches one of these three wildcards, Directory Printer considers the file to be a sound file, and prints it if the "Common Sound files" filter is selected. If a different filter is in effect at the time -- one that doesn't include these wildcards -- sound files will be omitted from Directory Printer's lists.

If you'd like to download the new Directory Printer v3.3, and check out filters for yourself, visit its home page at:

http://www.karenware.com/powertools/ptdirprn.html

As always, the program, and its Visual Basic source code, is free.

Or if you prefer the convenience of a CD, or just want to support Karen's Power Tools, visit my CD home page at:

http://www.karenware.com/cd.html

There you can order your own copy of Karen's Power Tools CD, complete with the new Directory Printer. Your CD will also contain the latest version of all the other Power Tools, including two bonus Power Tools not available anywhere else, back issues of all my newsletters, and a special license that lets you use all my Power Tools at work!

New Subscription Center

Before we go, I want to take a moment to tell you about a new section I've recently added to my web site. Called the "Subscription Center," it's a place you can go to change, or even (gulp!) cancel, your newsletter subscription.

Once there, you can change your name, email format (HTML or Text), and email address. Changing email address has recently become more important, as several Internet Service Providers (ISPs) have gone of business or changed their names. Thanks to the Subscription Center, you can now make all these changes even if your original email address is no longer valid.

To protect your privacy, you must use a special URL to visit the Subscription Center.

This URL only grants access to your subscription information. And no one else can see your information without this URL. So please don't share this customized link. But don't worry about forgetting your customized link either. From now on, it will appear at the end of every newsletter you receive.

Well, that's almost all for now. But before we part, I want to thank each of you for your wonderful support throughout the passing year. Writing the newsletter is a special privilege, one that I cherish because it enables me to get to know so many of you. And be blessed by you.

Whatever your beliefs, I hope the coming Christmas season finds you with family and friends. And I hope the coming New Year is a prosperous, healthy, and happy one for you and yours.

Until our next get-together, if you see me visiting Santa's home in Greenland, snorkeling in the Gulf of Mexico, skiing the French Alps, surfing on the 'net, be sure to wave and say Hi!