Classic Computer Magazine Archive COMPUTE! ISSUE 157 / OCTOBER 1993 / PAGE 8

Super Recorder macros: supercharge your desktop with this collection of essential Recorder macros. (Microsoft Windows Recorder application)(excerpt from 'Essential Windows Tools')
by Clifton Karnes, Lisa Young, Phillip Morgan

Windows' Recorder has received a lot of criticism for being an underpowered app, and some of this criticism is justified. The biggest drawbacks to Recorder are that you can't edit the macros you create and that there are no provisions for dialog boxes and advanced functions.

Recorder is a simple keystroke recorder (hence the name) that can play back you keystrokes. Once you understand Recorder's power and its limitations and start using it, it quickly becomes an indispensable application.

Recorder Basics

Recorder looks like most other Windows applications. It has a menu bar with options that look familiar. The File menu has selections for New, Open, Save, Save As, Merge, and Exit. With the exception of Merge, these are options we'd see on any File menu.

Probably the best way to get started with Recorder is to record a sample macro. For the first macro, let's choose a global macro that will save the current document. (We'll use the term global to describe the macros that can be played back to any application.) Here's some background.

As you know, much of Windows' interface is standard across applications. Most windows have a title bar, menu bar, and scroll bars (if they're needed), and the windows themselves can be moved and resized. You'll also note that almost every menu bar includes entries for File and Help. Digging deeper, if you examine almost any File menu, you'll see entries for New, Open, Save, Print, and Exit. This structure is all part of Windows' standard interface, and it's one of the reasons that Windows is so easy to use--the parts of different applications that work the same way have the same menu choices.

If you look at the keyboard shortcuts in several different File menus, however, you'll see a variety of key combinations. The Save command, for example, may be Shift-F12 in one application, F2 in another, Ctrl-S in a third, and many programs will have no shortcut key at all. Unlike menu options, shortcut keys are not standard.

You can change all that, however, with Windows' Recorder.

Let's say that you want Ctrl-S to save the current file in all you Windows applications. I use Ctrl-s because it's easy to remember, and Microsoft is recommending that developers use this as the shortcut key to save the active file. 1. Run Recorder. 2. Run any application (like Write) that can save files. 3. Selected Macro, Record and under Macro Name, type Save file. 4. Under Shortcut Key, put Ctrl-S (type s in the text box at the top of the Shortcut Key area in the Record Macro box, and make sure only the check box next to Ctrl is checked). 5. Under Record Mouse, select Ignore Mouse. 6. Under Playback To, choose Any Application. 7. Click on Start, and Recorder will minimize itself and start flashing to remind you that it's recording. 8. In your application, press Alt-F, S to save the current file. (Alt-F activates the File menu, and S selects the Save command). 9. Stop recording by pressing Ctrl-Break, choose Save Macro, and click on OK.

Now your macro has been recorded. Even though this Recorder file has just one macro in it, you'll want to save it, so pull down the File menu, select Save, and in the Save dialog box type mymacros under File Name. (Recorder will supply the REC extension.)

Now Ctrl-S will save the current file in any Windows program that follows the minimum Windows standards. To play back this macro, you simply press the shortcut key you assigned in the Properties dialog box. Alternately, you can double-click on the macro name in the Recorder window, but this is an option you will probably never use.

You may wonder what happens when you press Ctrl-S in an application that already has a Ctrl-S shortcut key defined. Is the macro played back, or does the application's key take precedence? When it comes to shortcut keys, Recorder is king, and its shortcut keys take precedence over an application's.

Since the applications with the built-in Ctrl-S keystroke almost certainly follow the Windows conventions that our Recorder macro is assuming, our Recorder Ctrl-S will work just as well in them as their native Ctrl-S.

In this one simple example we have demonstrated that

* It's best to ignore mouse movements, because using them depends on your recording and playback screen layouts being identical. Any change in the layout of your screen can result in unexpected problems.

* Recorder macros can be played back either to the same application that you recorded them with local macros or application-specific macros) or to any application (global macros).

Local Macros

Let's take a look at some of the alternatives available to you. Pull down the Options menu and select Preferences. Under Playback To, select Same Application (we'll change this for our global macros, like the one we just created, but it's safer to have this as the default).

Under Playback Speed, select Fast. With this selection, no matter how slowly you record your keystrokes, the playback will be as fast as possible.

Under Record Mouse, choose Ignore Mouse, for the reason stated above. The last option, Relative To, is only relevant if we're recording mouse movements, so you can leave it as it is. Also, under the Options menu, make sure Control+Break Checking, Shortcut Keys, and Minimize On Use are all checked.

Control+Break Checking allows you to stop recording by pressing Ctrl-Break. Shortcut Keys lets you nest macros inside macros. Minimize On Use causes the Recorder to be minimized so it's out of the way when you start recording.

Macro Number 2

Let's walk through another macro-recording session, but before we do, let's go back to the first macro. Select it and choose Options, Properties. You'll notice from this dialog box that you have the convenient option of changing the name, shortcut key, and other properties of your macro at any time.

One convention I follow with macros is to put in parentheses at the end of the macro name an abbreviation for the application to which the macro plays back. If it's a global macro, I use (G); if the macro plays back to File Manager only, I use (FM); and so on.

For the Ctrl-S macro, the new name should read Save file (G). This little bit of housekeeping will come in handy later, so I urge you to do it.

Our previous macro was designed to save the active file. But almost as often, you'll be opening files. Many applications (but not all applications) use Ctrl-O to call up the Open dialog box, which is easy to remember. And just as Microsoft is now recommending that developers use Ctrl-S for saving a file, it's recommending they use Ctrl-O for opening a file. Here's a step-by-step guide for creating an Open macro. The name for this macro is Open file (G), and its shortcut key is Ctrl-O. 1. Load any application that can open files. 2. Begin recording (choose Macro, Record and type in the macro's name and its shortcut key). 3. Press Alt-F, O. 4. Stop recording (press Ctrl-Break, choose Save Macro, and click on OK). 5. Save your macro file.

Now Ctrl-O will call up the Open dialog box in any Windows application that opens files. If that application uses Ctrl-O already, this macro will still work, as long as the application has a File menu with an Open entry.

One thing you'll often find yourself doing is saving the current file and exiting the application. If you're using Ctrl-S to save a file, it makes sense to use that keypress but to add another key to intensify it. The key combination I like is Ctrl-Shift-S for save and exit. The macro name is Save file and quit (G). 1. Load any application that can save files. 2. Begin recording (choose Macro, Record and type in the macro's name and its shortcut key). 3. Press Alt-F, S, Alt-F, X. 4. Stop recording (press Ctrl-Break, choose Save Macro, and click on 0 K). 5. Save your macro file.

Now test the macro. Load a file into any application that saves files, and press Ctrl-Shift-S. You'll save the current file and exit the application.

More Global Macros

One of the differences between Windows 3.0 and Windows 3.1 is the change in the edit keys used for copying, cutting, and pasting. Windows 3.0 Windows 3.1 Cut Shift-Del Ctrl-X Copy Ctrl-Ins Ctrl-C Paste Shift-Ins Ctrl-V

The new keys are like the Mac's, and they do have the benefit of not requiring you to move your hands away from the home keys.

The problem is that not all applications use these keys.

What's going to help us with a solution is that Microsoft has recommended that even those products that support the new keys keep the old ones for compatibility (for users who don't want to change). What this means is that all Windows applications should support Shift-Del, Ctrl-Ins, and Shift-Ins, but only some applications will support Ctrl-X, Ctrl-C, and Ctrl-V.

We can even things out so all applications support the new keystrokes by creating three Recorder macros. What these macros will do is map the keystrokes Shift-Del, Ctrl-Ins, and Shift-Ins to the shortcut keys Ctrl-X, Ctrl-C, and Ctrl-V. With these macros in place, our new edit keys will work in all Windows applications. Here are the three macros. Macro Name: Cut (G) Shortcut Key: Ctrl-X Playback To: Any Application 1. Load any application that lets you edit text (such as Write) and select some text. 2. Begin recording. 3. Press Shift-Del. 4. Stop recording. 5. Save your macro file. Macro Name: Copy (G) Shortcut Key: Ctrl-C Playback To: Any Application 1. Load any application that lets you edit text (such as Write) and select some text. 2. Begin recording. 3. Press Ctrl-Ins. 4. Stop recording. 5. Save your macro file. Macro Name: Paste (G) Shortcut Key: Ctrl-V Playback To: Any Application 1. Load any application that lets you edit text (such as Write), select some text, and cut or copy it to the Clipboard. 2. Begin recording. 3. Press Shift-Ins. 4. Stop recording. 5. Save your macro file.

With these three macros ready to go, Ctrl-C, Ctrl-X, and Ctrl-V should copy, cut, and paste in virtually any Windows program that supports cutting and pasting with the Clipboard.

Switching Windows

One of the best things about Windows--and what lets us create these global macros--is that much of the interface is standardized. MDI (Multiple Document Interface) applications are one of Windows' neat standard features. These programs, such as Program Manager, File Manager, SysEdit, and many others, let you work with several document windows at once inside an application that acts as a minidesktop.

Switching between these internal document windows, however, is something of a pain. You can always go to the Window menu and select the window you want, but that's slow and tedious. There are two key combinations that let you cycle through open documents (Ctrl-F6 and the undocumented Ctrl-Tab), but these keystrokes cycle through all open documents rather than moving you to the one you want. We can solve this problem, however, and Windows' MDI standards will help us.

If you look at the Window menu in any MDI application, such as File Manager, you'll see that each window is numbered. So Alt-W (to activate the Window menu) followed by a number will move you to the window associated with that number.

All we need to do is create a group of macros that make switching windows simpler.

Since some applications support these window-navigation shortcuts and use the key combination Alt-1, Alt-2, and so on, we'll use those shortcut keys. Here's the first macro. Macro Name: Switch to window #1 (G) Shortcut Key: Alt-1 Playback To: Any Application 1. Load any application that supports multiple documents. 2. Begin recording. 3. Press Alt-W, 1. 4. Stop recording. 5. Save your macro file.

Now, when you press Alt-1, you'll move to window #1.

You'll want to record eight more macros to switch to windows 2-9. Simply follow the keystrokes above, replacing the number 1 in Macro Name, Shortcut Key, and step number 3 with the new number.

This group of macros makes using a program like Sysedit much easier. In that application, the windows are always in the same order, and they always have the same numbers in the Window menu. Window #1 WIN.INI Window #2 SYSTEM.INI Window #3 CONFIG.SYS Window #4 AUTOEXEC.BAT

Say you want to edit SYSTEM.INI. As soon as the program loads, press Alt-2, and you're up and running. Switching to AUTOEXEC.BAT is simply a matter of pressing Alt-4. These shortcut keys will save you lots of time and help keep your work organized.

Minimize and Maximize

We usually use the mouse to adjust our windows' sizes, but a keyboard macro can come in handy. Here are three global macros to minimize, maximize, and restore windows.

Macro Name: Minimize window (G) Shortcut Key: Ctrl-alt-down arrow 1. Load any application that you can minimize. 2. Begin recording. 3. Press Alt-space bar. 4. Press N. 5. Stop recording. 6. Save your macro file.

Macro Name: Maximize window (G) Shortcut Key: Ctrl-alt-up arrow 1. Load any application that you can maximize. 2. Begin recording. 3. Press Alt-space bar. 4. Press X. 5. Stop recording. 6. Save your macro file.

Macro Name: Restore window (G) Shortcut Key: Ctrl-alt-right arrow 1. Load any application that you can restore. 2. Begin recording. 3. Press Alt-space bar. 4. Press R. 5. Stop recording. 6. Save your macro file.

Two Additional Macros

Here are two final macros. Whether you decide to use them or not, you should at least give them a try.

Macro Name: Exit (G) Shortcut Key: Alt-X 1. Load any application that can exit. 2. Begin recording. 3. Press Alt-F4. 4. Stop recording. 5. Save your macro file.

Macro Name: Save As (G) Shortcut Key: Ctrl-A 1. Load any application that has a Save As menu option under File. 2. Begin recording. 3. Press Alt-F, A. 4. Stop recording. 5. Save your macro file.

I find the Exit macro much easier to execute than pressing Alt-F4, but that's part of the problem with it. Many people may find it too easy to press: You might press the key combination by accident. Alt-F4 isn't easy to remember, but it's hard to hit accidentally.

The Save As macro is useful, but what if you hit it by accident in an application that has no Save As menu option? in that case, Recorder thinks for a very long time and displays a dialog box that essentially says something's wrong. This will occur whenever a Recorder macro can't find the command it's looking for.

Managing Macros

Recorder doesn't have lots of bells and whistles, but it does have a couple of neat features--and one of the most useful of these features is undocumented.

First, there's no way to change the order of your macros in Recorder's macro window. After a few months of recording, you'll have a mess. I've found that dividing macros into three groups and keeping these groups separate can make working with Recorder much easier. These are the groups I use. * Global macros * File Manager macros * Miscellaneous macros

I keep each group in a separate file. You'll wan