![]() |
||
|
CSRF Newsletters
|
|
|
By David Stutzman, RA, CSI Have you ever used a macro? Recorded a macro? Written a macro? WHY NOT? Macros help us perform repetitious tasks quickly. Once created, macros will produce the same correct results every time. If you never worked with macros, try them. Soon you will wonder why you waited so long. Macros are files that contain commands that the computer replays, exactly as recorded or written. When writing specifications, you may need to change every occurrence of the term "Architect" to "Architect's Representative." Or your client may demand that specification section numbers and titles be set in bold type style. Changes like these are completed easily and accurately with macros. Macros are effective, especially when used on highly formatted, consistent documents such as SPECTEXT® specifications. Each specification section complies with SectionFormat and PageFormat, published by the Construction Specifications Institute and follows the SPECTEXT® template. Therefore, the formatting, structure, and organization are identical for every specification section. |
||
|
Because SPECTEXT® specifications use a consistent format, you will always find information in the same location. The Section Number is always the first text line in the document. The Section Title is always the second text line. END OF SECTION is always the last line. Part Titles (GENERAL, PRODUCTS, AND EXECUTION) are always in capital letters. These, and other formatting rules, help you find text using simple commands. Control-Home keys will place the cursor at the beginning of the document, on the line with the Section Number. Using the Find command to search for "PRODUCTS" with case sensitive and whole word find options will find the Part 2 Title. When you find the right location in the document, you can select and modify the text as needed. Use keyboard commands such as Home and End to move the cursor to the beginning or end of the line. Use Shift-Home or Shift-End to select the text of the current line. In WordPerfect, you can also use the menu command Edit/Select to select the current line, paragraph or page. The easiest way to start learning to use macros is to record a simple macro. (You can follow the macro recording steps shown below.) Copy one of your SPECTEXT® specification files. Open the copied file. Start your macro recorder using Tools/Macro found on your word processor's menu bar. You must name the macro. If you are using Microsoft Word, macro names do not allow spaces and certain reserved words. Otherwise use any name you wish. Then start experimenting. Try recording a macro to set the section number and document title to bold text. Before you begin, review these suggestions, tips, and tricks:
Macros will not record mouse clicks.
Move through the document using keyboard commands such as the arrow
keys or menu commands such as Find. If you make a mistake, ignore it. You
can delete any mistakes from the macro later. Recover by recording the
correct action. You can stop the recorder and start over using the
same macro name to replace the one with mistakes. Record and play WordPerfect macros with
reveal codes always ON or always OFF to get consistent results. Some
advanced commands will require reveal codes to achieve the right
results. In Microsoft Word, save the recorded
macro to "All Documents (normal.dot)" so it can be used with
every document. When you finish, stop the macro recorder with the command found on the menu bar under Tools/Macro. Then close the open file without saving the changes. Reopen the file and test your macro. Run the macro by selecting the run command on the menu bar. For WordPerfect, select Tools/Macro/Run. For Microsoft Word, select Tools/Macro/Macros. Select the name of the macro you recorded and select Run. You will see the same results, in a fraction of the time you needed to record the macro. Once recorded, your macro can be used again and again, producing the same results every time. To learn how to edit macros, try it. Open the macro you just recorded and look at the commands.
In WordPerfect, open the macro from the
menu bar using Tools/Macro/Edit. The file will open the same as any
other WordPerfect file. In Microsoft Word, open the macro from
the menu bar using Tools/Macro/Macros /Edit. Microsoft. Word will open
the macro in a new application window labeled Microsoft Visual Basic.
The macro file will be in the large window on the right. Every macro
saved with the same document will be in the same window. You can
scroll up and down to view the other recorded macros. New macros will
be added to the end of the document as you record them.
The format and language will be unfamiliar. However, you should recognize the text for the actions you recorded. See the sample recorded macros for Word and WordPerfect that show the results of recording a macro. Both were recorded with the same keyboard commands shown below. The recorded macro was named "Bold."
Macro Recording Steps Control-Home keys - Moves the cursor to
beginning of the document Shift-Down Arrow keys - Moves the
cursor down one line and selects the text Shift-End keys - Selects text to the
end of the current line Control-Bold - Sets the font to bold. Control-End - Moves the cursor to the
end of the document Microsoft Word and WordPerfect use different macro languages, but the underlying ideas are the same. Both languages describe the result of the keyboard commands rather than the actual keystrokes. Now that you recorded the macro, you can easily modify the macro to set the last line of the section, END OF SECTION, to bold text. Copy, paste and modify text in the recorded macro to select the last line of the document and change the text to bold. Use the macro lines that select a line of text and set the text to bold. The recorded macro selected text to the end of the line. The modification you need to make is to select text to the beginning of the line. WordPerfect uses "Begin" and "End" to identify lines, paragraphs, and documents. Microsoft Word uses "HomeKey" and "EndKey." You finished the macro by placing the cursor at the end of the document. So you need to insert the commands to set the END OF SECTION to bold at the end of the macro. The results should look like the edited macro samples with the changes shown in bold text. When you finish editing, save the macro. Open your copied specification file without any saved changes and try running the macro again. The section number, title and last line should all be bold text. Now that you have a start, you can easily set the Part Titles to bold text, too, by recording another macro. Follow the instruction above to record a new macro. Move the cursor to the beginning of the document. Use the find command three times to search for whole words, with the correct case matching GENERAL, PRODUCTS, and EXECUTION. After finding each, select the paragraph and set the font to bold. Once recorded, you can copy the contents of one macro and paste it into another macro. This lets you build complicated macro by assembling smaller pieces. When pasting commands from one macro into another observe the following:
In Microsoft Word, do not copy the
first and last lines of the macro (Sub ____ () and End Sub). These
lines define the start and end of each macro. In WordPerfect, do not copy the first
line of the macro (Application (WordPerfect; "WordPerfect";
Default!; "EN")). This line defines the program and language
version for the macro. Macros are not mysterious, only unfamiliar. You can overcome your fear of macros by becoming familiar with the macro language and logic. When you use or record a macro, open the macro to see how the macro performs the task. When you know the expected results, you can decipher the unfamiliar language. If you have specification editing tasks that you would like to automate, please send an e-mail message to DStutzman@focuscollab.com describing the kinds of tools you want. We will use your suggestions for future additions to the tools provided with SPECTEXT®. In January, CSRF introduced a new macro as part of EDITSPEC® to help subscribers automate routine editing tasks. The macro named "massmac" appears as a button with a running person icon on the SPECTEXT® toolbar. The macro name implies its ability to apply macros to mass files. The icon symbolizes the ability to "run" other macros. The purpose of the macro is to allow subscribers to apply any macro to all files in a directory by using a single command. This macro will save time by automatically opening each file, running the macro and saving the changes. Of course, the macro will perform the tasks much faster than anyone can do manually. Depending on the task you automate, this button will give you time for having coffee, reading mail, or any other enjoyable activity while your computer keeps you productive. So seize the opportunity to enjoy your time at work. When you find yourself thinking "there must be an easier way", there probably is. Experiment with macros. Start simply. Try editing for more automation. Check out the sample macros issued with your word processor to learn from the experts. Strive to let the computer do all those tedious, repetitive tasks while you care for your plants.
About the author: David Stutzman, RA, CSI is President of Focus Collaborative, Inc., a specifications consulting firm with headquarters in New Jersey, and coordinates the input from the members of the CSRF SPECTEXT® Review Committee. The CSRF newsletter is published for SPECTEXT® subscribers and others involved in design and construction. To obtain your copy of Creating a Common Language®, please contact the CSRF Support Center by telephone at 1-877- SPECTXT or 410-838-7561 or you may e-mail us at supportcenter@csrf.org |
||
|
© Copyright 2007, The Construction Sciences Research Foundation, Inc. Updated January 12, 2007. |