How to Create Useful Macros with Embedded HTML

This article is in response to the suggestion/query by @KishorMali in this message.


What are Macros?

Macros can be defined as a shortcut or a short word for inserting a long line or even a formatted paragraph.

An example of a macro can be found in Notepad.
In the Edit menu of Notepad, select Time/Date or simply press F5.
The current time and date will be inserted at the cursor location in Notepad.

A similar facility is available in the Connect forum.
You can create predefined macros to insert larger text in your messages when composing posts or when replying.

Follow these steps to create a macro:

Go to the Macro Section of your profile.

Step 1: Give the macro a title. This will appear in the pull-down menu in the message later.

Step 2: Type in the text that should get inserted in your message in the text box as below:

On line #1, note the use of
which is a HTML tag.
This tag does not print but it inserts a line break in the text.
The green underline

means press Enter key two times.

At the end of line #1, note which is also a HTML tag.

means insert an image.

Specify the image path inside the two double-quotes.

Step 3: To get this image path, search for an image online using Google Search.

Right-click on the image and select “Copy Image Address” which will be either JPG or PNG or GIF.

The GIF image could be an animated GIF also.

Step 4: Then paste the “image path” inside the two double-quotes in front of

Note: The online image will be too large to include in every message on this forum.

To overcome this specify a smaller width and height as shown in the blue underlined text in the image above.

Pay attention to the proportion of the original image when specifying a new width and height.

Border=0 means do not draw a border around the image.

Step 5: Scroll down to the end of the macro page and click Save.

Step 6: In a new message, place the cursor where you want to insert the predefined text along with the image. Then from the menu bar select Macros - Select the macro as below:

This will insert 2 blank lines followed by the message and then the image below it:

Note that in the image above, I have specified the width as 160 and height as 80 for the image which is actually 500x250 online.

Similarly, it is possible to insert several other useful HTML tags, a few of which are discussed below.

1. Bulleted List

To insert bulleted lists of predefined text, include this in the macro definition:

  • Nice = 1
  • Good = 500
  • Great = 1000
  • True = 5000
  • Note that each bulleted item is included in a pair of

  • and
  • 2. Numbered List
    To insert a numbered list, include the above list in another pair of

      and

    1. Nice = 1
    2. Good = 500
    3. Great = 1000
    4. True = 5000

    3. Formatted Text

    To insert text as bold, enclose the word or words in a pair of <b and as below.
    Local Guides Connect.

    This will be displayed as:
    Local Guides Connect.

    For italics, enclose the words in a pair of and
    Local Guides Connect.

    This will be displayed as:
    Local Guides Connect.

    And for underlined, enclose in a pair of and
    Local Guides Connect.

    This will be displayed as:
    Local Guides Connect.

    4. Hyperlinked Text

    To use hyperlinked text, use the tag as shown below.

    Go to my Profile Page to view my contributions.

    This will be displayed as:

    Go to my Profile Page to view my contributions.

    To allow opening the link in a new tab/window of the browser add target=“_blank” as shown below:

    Go to my Profile Page to view my contributions.

    5. Colored Text

    To change the color of some or all the text, enclose the desired text between the tags as below.

    Local Guides Connect.
    This will change the color of the word Guides to green as shown below.
    Local Guides Connect.

    Note that the closing tag is <**/**font> and not simply meaning don’t forget the slash character /

    Other color codes that you can use is “red”, “blue”, “yellow”, “cyan”, “pink”, and so on.
    You can also use hexadecimal codes for colors like “#CB6F5F” which you can generate using an online tool like https://smallseotools.com/rgb-to-hex/

    Besides this, it is possible to display fancy effects like marquee or scrolling text, email links, embedding multimedia, and also use data like tables in the macros.
    You can learn the techniques on this page
    https://www.tutorialspoint.com/html/index.htm
    Check the index on the left on this page.

    HTML Pro Tip

    To generate any HTML code instantly, format the text in the editor and click the HTML button in the menu bar of the editor to view the HTML tags. Then copy the HTML tags from there.

    The downside is that the HTML editor displays more tags than necessary and hence a good understanding of the raw HTML codes is necessary to use it effectively in macros.

    Also, remember that the macro fields have a character limit so it is not advisable to copy the HTML code generated by the built-in editor blindly.

    Depending on the response to this article, I will show more HTML formatting for use in macros in the next part of this article.

    Till then, I hope you find many uses for the macros feature which is quick and easy to use and also saves a lot of time for repeatedly used text.

    17 Likes

    Amazing… @TusharSuradkar

    Thanks.

    I will make my signatures soon.

    4 Likes

    This is about Macros @KishorMali

    Signatures are different. Looks like something confused you, my friend :blush:

    A fine example of the effective usage of macros is by @BudiFXW in his message here.

    I want to use different ending salutation for different posts and people, hence use macros that appear like signatures - Like the one below :blush:

    ~Greetings from New Delhi

    4 Likes

    @TusharSuradkar Thanks for posting this helpful post. Our fellows will learn more about macros and how to make it more smart using HTML.

    Keep sharing!

    Happy Guiding!

    5 Likes

    Thanks, @ShafiulB

    I am glad you find the post useful.

    Let me know if you’d like to learn the advanced topics in macros, I will cover them in the next part.

    ~Greetings from New Delhi

    4 Likes

    Hi, I hope you and your beloved family are in good healthy condition. @TusharSuradkar .

    Thank you for your fully insighted description about embeded HTML in macro.

    Keep calm, stay healthy and always be happy.

    3 Likes

    Thanks for the wishes @BudiFXW and for the appreciation.

    ~Greetings from New Delhi

    4 Likes

    hi @TusharSuradkar

    I just browse your articles. wowww… this one, give me new lesson how to put image in macros. OK then I shall try it,

    thank you for writing cool articles :slightly_smiling_face:

    3 Likes

    That’s an interesting query @Ddimitra

    Macros are nothing but place holders for texts. Thus, we can’t add any image there, directly.

    Nevertheless, you can use a macro which contains text . Here, instead of the words IMAGEURL, you can add the actual URL. To change the image next time, you have to edit the macro. Thus, that doesn’t save much of the efforts.

    3 Likes

    Hi @Ddimitra

    Thank you for the appreciation and I am glad you liked the technique of adding images to macros.

    The same technique can be used to add images to signatures.

    I agree with all points by @C_T except the effort-saving part.

    I use macros extensively and it has saved me enormous time and effort inserting the same message and picture in multiple messages.

    Editing macro is quick one-time process and you can change the picture instantly inside the macro or signature.

    Else, I have failed to understand what C_T is trying to say and anxious to know it more clearly :blush:

    BR,

    Tushar

    1 Like

    @TusharSuradkar

    If we want to post the same picture in multiple articles, then the effort to create that “Picture Macro” is worthwhile.

    However, if the pic is going to be different every time, then a macro wouldn’t serve any purpose.

    Whether we edit that within the macro or after adding to the post amounts to the same effort.

    2 Likes

    Hello dear friend, @C_T

    Firstly, allow me to appreciation our @TusharSuradkar for the efforts he has put in the post - I feel that most of the aspects, he handled are correct.

    Honestly, I too use the method what our @C_T Ji has suggested when it comes to image macro.

    Thanks for the discussions as, this will help a large number of LGs.

    2 Likes

    I agree with that @TravellerG and appreciate the efforts of @TusharSuradkar also.

    Nevertheless, I expressed my opinion regarding the usefulness of a Macro to insert a distinct picture every time.

    I also use macros to create a placeholder for inserting pictures through HTML.

    Further, I use some macros to insert links to bookmarked pages.

    But mostly, while responding to how-tos, I restrain putting in a macro-based stereotype text.

    Sometimes, if a person uses that mechanically without reviewing the assembled text the resulting answer may become absurd and out of context too.

    2 Likes

    Fully agree…
    Usually, I use the Macro essay template and appropriate the words according to the circumstances.

    However, I use macros in many styles and I find it very useful - Shurly note in the stereotyped to style.

    Thanks for your prompt response, dear @C_T

    1 Like