Help Screen

Issue: June 1996
Section: Windows
Pages: 184-187


Contents

Printing any text to a file
Customising right-mouse menus for all your Windows 95 files
Adding a new command to your right mouse menu
Zip it up in Windows 95
Make notepads for all occasions
Windows toolbox: icon do it myself
The one-minute taskbar workout


Printing any text to a file

Q I have a financial application that can generate reports only to the printer, not to the screen or to a file. Is there a way I can tell Windows to print this information to a file?

- Michel Martineau

A Yes indeed. In fact, printing to a file is a great way to add text-only exporting to any Windows application, and it works in Windows 3.1 and 95.

Here's what to do in Windows 3.1. In the Windows Control Panel, double-click the Printers icon. Click Add and select Generic/Text Only from the list of printers. Click Install and follow the prompts to install this driver; you may need your Windows installation disks. Next, select the Generic/Text Only driver from the list of installed printers and click Connect. From the ports list, select FILE: and click OK. Exit the Control Panel. In your application's Print menu, turn off any header, footer, and page number options, and select Generic/Text Only from the list of printers. Windows will prompt you to type a path and name for your text file. Once you have your text file, you may need to do some editing and formatting in a word processor, but you'll get most of the information the way you want it.

To do the same in Windows 95, choose Start-Settings-Printers and double-click the Add Printer icon. Click Next in the Add Printer Wizard window. Select Local printer, and click Next. From the Manufacturers list, select Generic. 'Generic/Text Only' will be highlighted in the Printers list. Click Next, select FILE: from the Available ports list, and click Next. Type a name for the printer or use the default. If you plan to use this feature often, select Yes to make it your default printer. Then click Next. Select Yes or No in response to the test page prompt, and click Finish. If necessary, Windows will prompt you for a disk or CD-ROM to finish the installation. If you asked for a test page, specify a name and location for the text file that will be created when you click OK. As in Windows 3.1, remove any extraneous print formatting like page numbers. Then tell your application to use this printer for files you want exported to text.

Customising right-mouse menus for all your Windows 95 files

Q I prefer to have Windows 95 hide three-letter file extensions, but occasionally I need to change a file's extension - from file.doc to file.txt, for example. Windows won't let me do this with the normal rename functions. I have to either use a DOS window or change my View Options in Explorer. Is there an easier way to change extensions when I want, but keep them hidden most of the time?

- Eric McAdams

A You can add this function to the menu you see when you right-click a file name. In fact, by editing Win95's Registry, you can add programs and batch file commands to the right-mouse menu for any file type. This method lets you easily access programs that act on most file types, such as file viewers or compression utilities like PKZip. You can also add to the right-mouse menu any batch files you use often, such as one that formats floppy disks (see "Adding a new command to your right-mouse menu" for an illustration of this technique).

In your case, let's start by creating a batch file that can rename file extensions. In Notepad or another text editor, create a batch file with the following two lines (the paths can differ but it's easier if you use the same location for all files described here):

@echo ren %1 %%1 > c:\windows\r.bat

start c:\windows\r.pif

Save this batch file with a name like RENAMER.BAT in a convenient location like the Windows folder. Open Explorer or My Computer, find RENAMER.BAT, and customise it by right-clicking its icon and choosing Properties. Click the Program tab, and from the Run drop-down list, choose Minimized. Check Close on exit, then click OK. Windows creates a special Shortcut file known as a PIF, or program information file, in the same folder. Find that file at the bottom of the list of files - it's called Renamer - and create a copy of it by right-clicking it, dragging it with the right mouse button to a new spot in the same folder, and choosing Copy Here. Name the copy r. Right-click this new Shortcut file and choose Properties. Click the Program tab. In the box at the top, type a prompt like Type a file name & extension, and in the command line box, type c:\windows\r.bat ?. Then click OK.

How does it work? The first line in RENAMER.BAT creates a batch file called R.BAT that includes the name of any currently selected file (represented by %1) and adds a variable placeholder for the new name (%%1). The second line runs the Windows Shortcut you create a couple of steps later. The ? in that Shortcut's command line prompts you for a new file name, then passes that new name to the placeholder in the R.BAT file, which then renames the file. Both RENAMER.BAT and R.BAT should run relatively invisibly as buttons on the Taskbar and then disappear when they're done (thanks to the Run: Minimized and Close on exit options).

Adding a new command to your right mouse menu

To put the above newly created feature on your right-mouse menu, you'll have to edit the Windows Registry. As always, before you do, make a backup copy of these files in the Windows folder: user.dat, user.da0, system.dat, and system.da0. (If you don't see the files, choose View-Options in My Computer or Explorer, click the View tab, select Show all files, and click OK.)

Start the Registry Editor by choosing Start-Run, typing regedit, and pressing <Enter>. Click the plus sign next to HKEY_CLASSES_ROOT to expand that branch, and select the * folder at the top of the list. As you might guess, this entry represents all file types.

Choose Edit-New-Binary Value. Name this value EditFlags, and press <Enter>. Double-click the new value; if it's still selected, press <Enter> again.

Type 02 00 00 00 (without the spaces; the Registry Editor adds them automatically). This change will let you specify functions for all file types in Explorer's Options dialogue box. Now exit the Registry Editor.

In Explorer or My Computer, choose View-Options and click the File Types tab. Select the * file type, which should be at the top of the list, and click Edit. Click New to add new actions. In the Action box, type the wording you want to appear on your right-mouse menu. Don't use "Rename" alone, since that function already exists. Instead, type something like Rename with e&xtension. The & underlines the following letter, x, and makes it a keyboard shortcut; put the & elsewhere if you want a different shortcut. In the 'Application used to perform action' box, type c:\windows\renamer.bat (your path may differ). Click OK, then click Close twice.

Now when you right-click a file you'll see your "Rename with extension" entry. Choose it, and a window will prompt you for the new file name. Type the name in the Parameters box (but no path information - the DOS rename command doesn't like that), adding quotation marks around your new file name if it includes any spaces. Then click OK. Renaming a file like this often makes it appear in a new place in the folder, but you shouldn't have any trouble finding it.

You follow the same basic steps in the Registry and the File Types tab for any program or batch file you want to add to the right-mouse menu. To apply this technique to a DOS command-line utility, see the following item.248p_a. tif: 1 Select an application you want to apply to all files or create a batch file with an associated Shortcut file. 2 In the Registry Editor, add a new binary value named EditFlags to the * file type and type in the value data shown. 3 In Explorer's View-Options dialogue box, edit the * file type, adding a new action that runs your application or batch file.

Zip it up in Windows 95

Q I know there are a lot of Windows shells for zipping files, but I'm short on cash. Can I get Windows 95 to help me use PKZip on a selected file without running to a DOS prompt?

- Stanley Stromberg

A No problem. You can use the technique described in the preceding item to add a zipping batch file to your right-mouse menu. First, in Notepad or another text editor, create the following two-line batch file (substituting your own path to pkzip.exe): the first line is

@echo c:\zip\pkzip.exe -a %%1 %1 > c:\windows\zipme.bat

and the second is

start c:\windows\zipme.pif

Save this file in the Windows folder with a name like ZIPPER.BAT. Then create PIFs for both ZIPPER.BAT and ZIPME.BAT: right-click ZIPPER.BAT and choose Properties; click the Program tab, select Minimized from the Run drop-down list, and click Close on exit. Click OK. Copy the Shortcut, zipper, and name the resulting new Shortcut zipme. Right-click this Shortcut, choose Properties, and click the Program tab. In the top box, type the prompt Type name of .zip file to use, and in the command line box, type c:\windows\zipme.bat ?. Click OK.

Now follow the instructions in the previous tip for modifying the Windows Registry. Then in Explorer choose View-Options, click the File Types tab, and create a new action for the * file type. Name the action &Add to zip file and type C:\WINDOWS\ZIPPER.BAT at the 'Application used to perform action' prompt. Close all dialogue boxes.

Now right-click any file and choose Add to zip file (or whatever you named your command). When prompted, type the full path and name of the .zip file you want the selected file added to. The downside to this method is that you can add only one file at a time to a .zip file. To use wild cards to add multiple files, you'll need to do more typing: choose Start-Run, type zipper followed by a file specification - for example, zipper c:\doc\*.doc. Then press <Enter>. You're all set to make some quick zips.

Make notepads for all occasions

Q Is it possible to put more options (*.bat, *.ini, *.sys) in the "Files of type" section of Notepad's File Open dialogue box? I use Notepad in Windows 3.1 to edit system files, and it would be nice if that could be made easier.

- Samuel Bible

A Unfortunately, you can't add to the list of file types in the File Open dialogue box in Windows 3.x. However, if you prefer clicking icons to typing file specs, you can create multiple versions of Notepad to edit various file types.

You do this by editing notepad.exe. When editing text in any executable file, you must add exactly the same number of characters you remove: if the file is one character larger or smaller than the original, it won't work.

First, start Windows Write. Open notepad.exe in the Windows directory. When prompted, click No Conversion. Choose Find-Replace. Type *.txt in the Find What box, and type *.ini in the Replace With box. Click Replace All, then Close. You can also search for Text Files and replace it with something like Sys. Files (include the period or an extra space so the number of characters is the same). Then choose File-Save As and name the file ini_edit.exe.

Repeat these steps to create a Notepad version for .sys files, .bat files, and so on. You can create icons for each version in Program Manager and launch whichever one you need.

By Scott Dunn

Windows toolbox: icon do it myself

Windows 95 adds a lot of pretty new icons and even animated cursors. But check out Microangelo - the ultimate tool for managing, editing, and creating icons and cursors. This shareware package includes three program modules: Browser, for viewing individual icon files or those stored as libraries (multiple icons in a single .exe or .dll file, for example) and launching the other modules; Studio, for creating and editing individual icon files; and Librarian, for extracting, editing, and organising icons in new or existing libraries. The package also includes a utility that lets Windows 95 display icons in all possible colours. You can get the Browser and one other module for $US25, the Browser and two other modules for $US45, or all modules for $US60. The package is available from our PC World web site at http://www.idg.com.au/pc.world.

The one-minute taskbar workout

The Windows 95 Taskbar can speed through your little chores if you know how to use it. This workout will have you clicking in all the right places.

Manage windows: Right-click a blank area of the Taskbar for a menu that makes quick work of window management - tiling, cascading, minimising, auto-hiding, or even undoing your last menu choice.

Customise the Start menu: To get a window showing the Start Menu folder, right-click the Start button and choose Open (for a My Computer-style window) or Explore (for an Explorer-style window); or choose Find instead of the slower Start-Find-Files or Folders.

Bring up hidden windows: Left-click an application button to bring that application to the front and make it active.

Manage hidden windows: Right-click an application button to perform basic window management on the application - the Close command is especially handy.

Set the time: Left-double-click the clock (or right-click the clock and select Adjust Date/Time) to reset the computer's clock and calendar.

Get the date: Hold the mouse pointer over the clock for a couple of seconds to see the day of the week and the date.

Set the volume: If you have a sound system installed, left-click the speaker icon next to the clock to see a pop-up volume control with a mute option.

Customize audio: Right-click the speaker icon to see a pop-up menu for displaying the Volume Control dialogue or the Audio properties sheet.

Manage printing: While printing, left-double-click the printer icon to check printing status and reorder, pause, or cancel jobs waiting to be printed.

Check print status: While printing, hold the pointer over the printer icon for a couple of seconds to get a quick status report.


These Web pages are produced by Australian PC World © 1996 IDG Communications