Copyright © Alan Cantor 2004 - 2008 All rights reserved.
Welcome to the Windows Macros FAQ. This resource is for people who want to operate Windows® more efficiently by taking advantage of macro software and macro techniques. I am now preparing a detailed guide on Macro Express, which is an excellent macro scripting tool. The guide will be for sale on this web site when it is complete.
Running Windows® without macros is like cycling through the mountains on a fixed-gear bicycle. It can be done, but it is unnecessarily difficult. Think of macros as gears for your computer. Macros reduce physical and mental effort while multiplying speed and increasing efficiency.
This FAQ has four main sections. Fundamentals answers basic questions about macros. Smart Macros introduces the topic of macros with built-in intelligence. A smart macro acts on the basis of information received both from the user and from the user interface. Well-constructed smart macros provide elegant, reliable, and seamless fixes to otherwise intractable accessibility and usability problems. The global hotkey section describes a standard Windows® technique for opening files, web pages, and folders, and for launching applications. The fourth section discusses application-specific macro techniques.
This is a work-in-progress. Bookmark this page and check back often. Your feedback and questions are welcome.
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.
Examples of tasks that can be performed using macros:
Macros save time, energy, and frustration. Macros can be written to automate repetitive, awkward, physically-demanding and mentally-taxing tasks. In addition, accessibility and usability problems can sometimes be fixed with macros.
Macro Express and Keyboard Express (www.macros.com), ActiveWords (www.activewords.com), AutoHotkey (www.autohotkey.com), and Macro Scheduler (www.mjtnet.com) are examples of Windows®-based macro software.
Macro Express is powerful and easy to use. Keyboard Express, which is made by the same company, lacks many features included in Macro Express. ActiveWords is fairly easy to use, but lacks features found in Macro Express. AutoHotkey is very powerful but lacks a user interface to simplify macro creation; the learning curve is steep. Macro Scheduler is less versatile than either AutoHotkey and Macro Express. It is easier to learn than AutoHotkey, but harder to use than Macro Express.
Because screen readers and macro applications intercept input from the keyboard, the two applications can conflict. The following compatibility information is based on reports from screen reader users:
Macro Express 3.x menus are difficult to access with JAWS, but it is possible. Set "Menu style" to "Flat" to improve screen reader access. (Options menu, Preferences.) Menus are easily accessed with Window-Eyes.
Overall, the Macro Express user interface is not particularly speech-friendly. Dialog boxes are fairly accessible, but some controls have non-standard behaviour, such as the list of hotkeys when choosing an activation method. It is possible to Tab to the list of hotkeys, but navigating backwards from the list causes Shift + Tab to be selected as the hotkey. Some wizards work better than others with speech, but most cannot be accessed without using the roving cursor. Macro Express macros can be activated when JAWS is running, but not when Window-Eyes is running. I have seen people using Window-Eyes to script macros, and JAWS to test and run them.
Not yet tested with JAWS. ActiveWords does not appear to conflict with Window-Eyes.
Very easy to access because macros can be written in any text editor. The downside is that there is no user interface to simplify macro creation. No screen reader compatibility problems for activition have been reported.
No screen reader compatibility problems have been reported for JAWS or Window-Eyes.
There are four main macro creation techniques:
Record commands by typing and manipulating the mouse. The technique works best for simple tasks; it is less reliable for complex tasks.
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.
Type or insert commands directly into a macro editor. This technique is very powerful, but may require programming experience.
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.
There are five main macro activation techniques:
To activate a hotkey macro, the user presses a key or a key combination. There are two kinds of hotkey macros:
Code macros are triggered by typing text. The macro runs when a specific sequence of characters has been entered. There are two kinds of code macros:
When code macros execute, the code and the prefix/suffix are usually deleted. The macro may have untoward effects if pressing Backspace does something other than delete characters. In Internet Explorer, for example, pressing Backspace goes "Back" to the previous web page (unless an edit box has keyboard input focus.)
Timed macros activate at specific times, at set intervals, or after certain delays. They are used to run programs at set intervals, display timed reminders, and regulate the timing in multi-step macros. For example, when writing a macro to copy the URL of a web page and paste it in NotePad, it may be necessary to wait for NotePad to appear before issuing the "Paste" command. The macro might consist of five steps:
Macros execute very quickly. Without a "Wait" command, this macro may issue the paste command before Notepad gains focus.
Event macros execute when specified programs, windows, or controls gain or lose focus. Event macros are needed to regulate complex command sequences. The previous example will be more reliable if the "Paste" command is triggered by the appearance of NotePad (an event) rather than the passage of a fixed number of seconds:
Mouse macros are activated by clicking on specific areas of the screen; on user-defined menus or icons; or simply by clicking anywhere on the screen. For the latter type, it is usually necessary to hold down one or more modifier keys.
Some macros are easy to create. For example, global hotkeys (as described in the next section) and code replacement macros can be tackled by beginners.
Scripting tools such as Macro Express and ActiveWords have steep learning curves, although adventurous novices who persevere will likely have success. AutoHotkey is closer to a programming language than a scripting tool, and may be harder for beginners to learn. Macros for automating a complex series of steps often require intermediate- or advanced-level understanding of Windows® as well as experience with the macro creation tool. A superior understanding of the keyboard interface is extremely helpful; macros that move the mouse pointer and click tend to be unreliable. When writing smart macros, a little programming experience is helpful, but not essential.
I coined the term "smart" (or "intelligent") macro in 2005 to describe a computer shortcut that is activated either by the user or the user interface (UI), and performs tasks based on feedback that the macro receives from the user, the UI, or both. A smart macro mediates between the user and the computer, makes decisions, and acts on the basis of information it receives from two sources. In contrast, a "dumb" macro is always activated by the user, cannot be controlled once it has been activated (except, perhaps, to halt its execution), and neither detects nor acts upon information from the UI.
Smart macros have a modicum of built-in intelligence. This intelligence increases their flexibility, reliability, and accuracy. Well-designed smart macros dramatically improve software accessibility and usability in ways that cannot be achieved by other means — other than repairing the source code. A smart macro may be so seamless that users may not realize they are interacting with a macro rather than a built-in feature. For smart macros that are triggered automatically or that workaround programming errors, there may be nothing new for users to learn or memorize. Smart macros simplify access to information because the macros themselves assume some of the physical and cognitive effort required to drive software.
Macros with built-in intelligence have four main uses:
A repair macro fixes an accessibility problem, usually within a specific window or program. For example, the "Options" dialog box contains a text field labelled "Address" (with underlined accelerator "A"), but pressing Alt + A does not move focus to the field. The repair macro, triggered by Alt + A, moves the focus to the text field by sending keystrokes, moving and clicking the mouse, or a combination of the two. This hotkey is available only when the titlebar says "Options," so Alt + A works normally in other windows.
A macro that fixes a usability problem forces a non-standard application to work the ways that users expect. If, for example, "Save" is F2 instead of Ctrl + S, a program-specific macro can be written to send F2 to the application when the user presses Ctrl + S. Because the macro is program-specific, the hotkey has no effect on other applications.
When automating a task to perform a series of actions, a dumb macro may play back faster than the computer can keep up. The only technique for a dumb macro to control information flow is to pause at critical moments. Macros with time delays tend to be unreliable because pause lengths vary and are unpredictable. This is especially true when a macro interacts with the Internet; network bottlenecks can easily throw off the timing of scripts that are regulated with time delays.
The smart macro's ability to process information from the UI allows for more reliable control. Rather than wait for preset time periods, a smart macro waits for specific events to occur, and tests that the events have occurred before continuing. Events that can be monitored include:
Testing for UI changes makes it possible to detect errors. For example, if a particular window does not appear within 10 seconds, the macro can stop, prompt the user for further instructions, or wait longer.
An automatic macro activates when a specific change occurs in the user interface. Many of the events listed above can serve as triggers. Automatic macros can also activate at set times or at regular intervals.
Choose any macro software product that supports these four features:
At least three third-party products for Windows® can be used to develop smart macros: AutoHotKey, Macro Express, and Macro Scheduler.
Windows® allows users to assign about 400 hotkeys for launching applications, opening files and web pages, and opening folders (such as "Recycle Bin," "My Computer," "Control Panel," and "c:\Windows\Desktop"). These hotkeys can be activated at any time, in any program, in any context. They are usually referred to as "desktop shortcuts," but because these shortcuts are always available, I refer to them as "global hotkeys."
When a global hotkey and an application-specific hotkey conflict, the global hotkey takes precedence.
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:
The following keys cannot form part of a global hotkey:
Follow this procedure to make global hotkeys:
The shortcuts do not have be on the desktop. They will work if they are placed in certain folders, but not in others. Shortcuts can be stored in "Start menu | Program Files | Shortcuts."
Global hotkeys become second-nature with practice. To help internalize the keystrokes:
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.
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.
| 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 | ![]() |
|
| ourlogo | White, Black and Clear Attorneys 25 Grace St · Suite 200 · York |
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.
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 certain mouse movements (e.g., text selection via mouse), and recorded macros tend to replay slowly. They are also somewhat unreliable.
Macros coded directly in Visual Basic, however, execute quickly and can be made extremely robust. A good way to learn Visual Basic is to record macros and then study and edit the Visual Basic code. The Visual Basic help system is excellent, and contains code fragments that can be copied and incorporated into new commands.
Feel free to submit your questions. Any comments about this FAQ are welcome.
A special thank you to Dean Martineau, Neville from Australia, and Frank Ibarra for their important contributions to this FAQ. I also thank the hundreds of people who have attended my lectures, hands-on workshops, and web-casts on macros and macro techniques. Your questions and comments have helped to refine my understanding of the usefulness and power of macros.
The information contained in this FAQ is intended as a guide only. It is current to the best of the author's knowledge, having been compiled from sources believed to be reliable. No warranty, guarantee, or representations are made by the author as to the absolute correctness or sufficiency of any representation contained in this FAQ.
Microsoft, Windows, Word, Excel, Outlook, Notepad, Visual Basic for Applications, and Internet Explorer are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.
"Windows Macros FAQ" is an independent publication and is not affiliated with, nor has it been authorized, sponsored, or otherwise approved by Microsoft Corporation.
ServicesAll servicesSeminars and workshops Accessibility research Job accommodation Top of page |
ResourcesWindows with no mouseMacros FAQ Publications Public presentations Home |
Company informationNewsAbout Cantor Access Inc. Our clients Contact us Site map |
| Copyright © Alan Cantor 1993 - 2008. All rights reserved. |
Updated: 1 January 2008 Legal | Privacy |