
202
|
Chapter 6, Speed Hacks
#51 Create a Macro
HACK
If you select Macro Explorer from the Tools ➝ Macros menu and open the
Recording Module, you will see a new macro called TemporaryMacro. This
is where the code for your actions during recording is created. Because the
Macro Recorder will always create the same macro routine, you must now
either copy the code to another macro module or at least rename the macro
created by the recording process, or your macro will be lost the next time
you record a macro. To change the name of the macro, right-click on the
macro in the Macro Explorer and select Rename.
Macro recording is a powerful way to quickly create fairly simple macros,
but it also has some major limitations. First, any selections in the Solution
Explorer or Class View will be specific to the file or class selected, so it will
be linked to the filename or class name. This can be overcome by editing the
recorded macro and using variables in place of the filenames.
Second, some actions, such as attaching to a process to debug, will not be
recorded. Most of these actions can be coded into macros, but you will have
to code these by hand.
Creating Macros from Scratch
If the limitations of the macro recorder make it impractical for your situa-
tion or if you are creating a complex macro, then you can create a macro
from scratch. To create macros from scratch or to edit existing macros, you
will use the ...