Creating New Macros
Now you will create a new macro to learn about GoLive's macro definition syntax and some of the other parameters you can modify.
Launch the MarkupSource.macro file in GoLive.
Advance your cursor to the next line after the IMG macro code by pressing Return after it. Type EMAIL &%firstname.lastname@example.org& into the next empty line in the macro file. Use a Tab after the word EMAIL.
Save the macro file.
Open a new or existing document and switch to the HTML Source editor.
Type email and then press the macro command keys.
The macro outputs the email address for Tom Robertson while highlighting his name. This macro could be used as a generic email macro where you can easily type in different people's email addresses within the company.
Figure 1.7 Adding a new macro named "EMAIL."
Text definitions must be enclosed within 2 unique delimiter characters. In this example the delimiter character is "&". You can use any character for your delimiter as long as the character is not contained in the macro itself and the beginning and end characters are identical. The two other macros in this macro file use "'" as a delimeter character. It's OK to use different delimiter characters in a single macro file as long as individual macro definitions use the same characters.
Because the macro file has defined "%" as a selection delimiter, any text between two "%" characters is automatically selected when the macro runs. This makes it much easier to change frequently edited portions of text because the text is already highlighted when the macro is applied, making it easy to type and replace the highlighted text.
Syntax for Defining a Macro:
Example: barb &email@example.com&
Example: barb #firstname.lastname@example.org#
The selection delimiter is useful for highlighting portions of text the macro has entered. While the text is highlighted, you can type in new text to replace the highlighted text. The HTML Source.macro file has an entry that defines the selection delimiter for all macros in this macro file:
selection = %
Sometimes you'll want to include the "%" character as part of the text in your macro. In that case you would want to instruct GoLive to use a different selection delimiter. To change the selection delimiter, change the "%" character in the statement "selection = %" at the top of the macro file to a different character. You can also delete the statement "selection = %" if you don't want to use selection delimiters in your macros.
Figure 1.8 Email macro to automate entry of company email addresses.