Home / Publications / Macros & Customization / Macro Techniques: Wormholes through Windows

Macro Techniques: Wormholes through Windows

Copyright © Alan Cantor 2003. All rights reserved.

Wormholes in Nature and Windows

A wormhole, according to astrophysicists, is a warp in the fabric of the universe — a shortcut through space and time. Although wormholes in nature have never been detected, "wormholes" in the Windows operating environment are plentiful. These shortcuts enable people with mobility, sensory, learning, and cognitive disabilities to work faster, easier and more efficiently than is possible using "standard" techniques.

This paper describes how to create wormholes through Windows using macro software, "global hotkeys," and macro-like features in standard applications. When first encountered, macros, like space warps, may seem mysterious and counterintuitive. With experience, macros become familiar and indispensable conduits through the Windows universe.


Macro software

What is a macro?

A macro is a sequence of commands for performing a task. The tasks may be simple, such as inserting a word; or complex, such as copying data from one program and pasting it in another. Tasks that lend themselves to macro solutions are repetitive, physically-demanding or mentally-taxing. In addition, accessibility and usability problems can sometimes be fixed with macros.

What can macros do?

Macros save time, frustration, and energy. They can be written to:

  • Insert one's name, address, e-mail address, or signature file.
  • Insert symbols and foreign characters.
  • Insert the date and time.
  • Abbreviate words or expressions.
  • Launch or switch to a program.
  • Open a file.
  • Close, resize, or move a window.
  • Click on a spot on the screen.
  • Adjust the speaker volume.
  • Detect a program, window, or control.
  • Copy data from one application and paste it in another.
  • Display a dialog box and ask the user to confirm an action.
  • Combinations of the above.

Macro applications

Macro Express and Keyboard Express (www.macros.com) and ActiveWords (www.activewords.com) are examples of Windows-based macro software.

Macro creation techniques

There are four main macro creation techniques:

Capture

Record commands by typing and manipulating the mouse. The technique works best for simple tasks; it is less reliable for complex tasks.

Wizards

A wizard guides the user through a series of questions, and automatically generates a script. Macros created in this way work best for simple tasks.

Direct editing

Type or insert commands directly into a macro editor. This technique is very powerful, but may require programming experience.

Semi-automatic scripting

Select, insert, and edit commands via a user interface to build a script. This technique is adequate for crafting all but the most complex macros.

Macro activation techniques

There are four main macro activation techniques:

Hotkey

To activate a hotkey macro, the user presses a key or a key combination or clicks a region on the screen. There are two varieties. A solo-hotkey executes after pressing a single key or key combination. A dead-key hotkey executes after pressing a sequence of two keys. Typically, nothing appears to happen until the second key is pressed. For example, in some applications, pressing Ctrl+/ followed by O inserts Ø.

Code

Code macros are triggered by typing text. The macro runs when a specific sequence of characters has been entered. Suffix macros are triggered by typing a code followed by Spacebar, Enter, and punctuation characters. For example, typing TEL followed by a space inserts one's telephone number. Prefix macros are activated by typing a user-selected prefix followed by a code. For example, if J is the prefix, typing JWP launches a word processor, and JSIG inserts a signature file.

When code macros execute, the code and the prefix/suffix are usually deleted. The macro may have untoward effects if the Backspace key does something other than delete characters. In Internet Explorer, for example, pressing Backspace goes "Back" to the previous Web-page if an edit box does not have focus.

Event

Event macros execute when specified programs, windows, or controls gain or lose focus. Event macros are sometimes needed to regulate complex command sequences.

Timed

Timed macros activate at specific times, at set intervals, or after certain delays. They are used for controlling complex macros, running programs at regular intervals, and displaying timed reminders.


“Global hotkeys”

About global hotkeys

Windows reserves about 356 hotkeys for launching applications and opening files and Web pages. Global hotkeys also open folders, e.g., "Recycle Bin," "My Computer," "Control Panel," and "c:\Windows\Desktop."

When a global hotkey and an application-specific hotkey conflict, the global hotkey takes precedence.

Key assignments

Most global hotkeys consist of two or three modifier keys (Shift, Ctrl and Alt) plus one other key. Examples of keys that can be assigned include:

Without modifiers

  • F2 through F12
  • Num-Minus
  • Num-Star

One modifier

  • Shift+F1
  • Shift+F10
  • Shift+Keypad-Plus

Two modifiers

  • Shift+Ctrl+F12
  • Shift+Alt+A
  • Ctrl+Alt+/
  • Ctrl+Alt+Insert
  • Shift+Alt+Scroll-Lock

Three modifiers

  • Shift+Ctrl+Alt+A
  • Shift+Ctrl+Alt+F12
  • Shift+Ctrl+Alt+End
  • Shift+Ctrl+Alt+Num-Lock

The following keys cannot form part of a global hotkey:

  • Esc
  • Tab
  • Spacebar
  • Enter
  • Backspace
  • Delete
  • Print Screen
  • Pause
  • Windows-key
  • Application-key

Creating global hotkeys

Follow this procedure to make global hotkeys:

  1. Locate the icon of an application, folder or file.
  2. Create a shortcut.
  3. Move the shortcut icon to the desktop.
  4. Select the desktop icon.
  5. Invoke its "Properties" page.
  6. Go to the "Shortcut" tab.
  7. Go to the "Shortcut key" edit box.
  8. Press the desired key or key combination.
  9. Press Enter (or click the "OK" button).

Remembering global hotkeys

Global hotkeys become second-nature with practice. To help users internalize the keystrokes:

  • Use one modifier combination for all global hotkeys.
  • Jot hotkeys on Post-it notes and stick them on the monitor.
  • Rename desktop icons to include the hotkey, e.g., Shift+Alt+Word and Shift+Alt+eXcel.
  • Invent striking mental associations, e.g., "My alternative, nifty-shifty home page that I control is Alt+Shift+Ctrl+Home."

Application-specific techniques

Code replacement

Code replacement is a technique for storing text and images as easy-to-remember codes. The code is replaced after it is typed. The trigger is usually Spacebar, Enter, or a punctuation character. Both Word and WordPerfect have code replacement features, AutoCorrect and QuickCorrect, respectively. Of the two, AutoCorrect is more versatile. The technique is especially helpful to people with certain learning disabilities and those for whom typing is difficult.

Code replacement techniques

Use code replacement to correct spelling and capitalization errors, and to insert phrases, canned text, foreign characters, formatted text and images. The following chart illustrates five techniques: word, phrase, symbol, capitalization, and formatted.

Five code replacement macro techniques
Technique Code Replacement
Word Px Peroxide
Pxs Peroxides
Phrase sss Sandy S. Smith
myemail sssmith@pencilpusher.com
startletter Thank you for your recent letter.
Symbol e/ è
L= £
Capitalization alberta Alberta
csun CSUN
autocorrect AutoCorrect
Formatted h2so4 H2SO4
table3x2 Image of a 3-cell by 2-cell table.
ourlogo White, Black and Clear Attorneys
25 Grace St, Suite 200, York

Built-in macro languages

Some applications have built-in programming interfaces. The programming language for Office, Visual Basic for Applications, can be used to build macros, repair accessibility problems, and develop usability enhancements.

Recording vs. authoring Word macros

There are two ways to create Word macros. Capture them using the macro recorder, or enter them directly in Visual Basic. The recorder cannot capture mouse movements, and recorded macros tend to replay slowly. They are also somewhat unreliable. Macros coded directly in Visual Basic execute quickly and can be extremely robust. A good way to learn Visual Basic is to record macros and then study and edit the Visual Basic code:

  1. Choose a task to perform in Word. Before beginning, ensure that you know exactly how to perform the task using keyboard commands.
  2. Start recording. Select "Tools | Macro | Record New Macro..." Name the macro. Assign a keyboard or toolbar shortcut.
  3. Record the macro. Perform the task without making mistakes.
  4. Stop recording. Click the "Stop" button on the "Stop Recording" toolbar, or select "Tools | Macro | Stop Recording."
  5. Test the macro.
  6. Study and refine the code. Press Alt+F11 to open the Visual Basic editor.

Conclusion: Travels through wormholes

The techniques described in this paper help people with sensory, mobility, learning, and cognitive disabilities perform tasks quickly and efficiently. The author uses macros when accommodating employees and students with disabilities, and has documented many success stories:

  • A magazine editor with glaucoma uses hotkey macros to automate visually-intensive word processing tasks such as reformatting, stripping out editorial comments, and deleting sentences.
  • A graduate student with dyslexia uses AutoCorrect to replace misspelled words as she types.
  • A call centre employee who types with one finger presses hotkeys to move among seven programs, and types code macros to insert boilerplate text. Using macros doubles the number of calls she answers.

These stories illustrate that in Windows and in nature, the shortest path to your destination may be through wormholes.


References

Cantor, Alan. Enhancing the Accessibility of Word 97 Using Built-in Commands, Macros and Visual Basic Procedures. Handout distributed at pre-conference workshop, 26 June 1999, RESNA 1999, Long Beach, CA.

Cantor, Alan. Escaping the Mousetrap: An Evaluation of the Accessibility and Usability of the Windows Keyboard-only Interface. Paper presented at Developers Day, WWW8 Conference, Toronto, 14 May 1999.

No author. Microsoft Office 97 Visual Basic Programmer's Guide. 1997. Redmond, WA.: Microsoft Press.

Shank, David et al. Microsoft Office 2000/Visual Basic Programmer's Guide. Microsoft Press. 1999.