Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

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.

  1. Launch the MarkupSource.macro file in GoLive.

  2. Advance your cursor to the next line after the IMG macro code by pressing Return after it. Type EMAIL &%tomrobertson%@bizdev.com& into the next empty line in the macro file. Use a Tab after the word EMAIL.

  3. 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:

    MacroName [Delimiter]MacroContent[Delimiter]

    Example: barb &barbarajones@siliconvalleytraffic.com&

    Output: barbarajones@siliconvalleytraffic.com

    Example: barb #barbarajones@siliconvalleytraffic.com#

    Output: barbarajones@siliconvalleytraffic.com

  4. Save the macro file.

  5. Open a new or existing document and switch to the HTML Source editor.

  6. Selection Delimiters:

    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.

  7. Type email and then press the macro command keys.

  8. 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.

  9. Figure 1.8 Email macro to automate entry of company email addresses.

  • + Share This
  • 🔖 Save To Your Account