Using a Pick List to expand in a loop

Posted by Emmanuel ® , 04/14/2011, 15:03:34 Reply   Forum

Thank you for your interest in the previous pick list example. I am sure that soon, some of you, will come up with their own examples. Don't hesitate to share with us.

Today, I will present a quite exotic example. It shows how I can use a pick list to handily repeat an expansion in a loop as many times as I want. I am sure you will find situations where this can be useful.

I for myself, often separate blocks of text with lines of stars, when I write documents or programs. Sometimes one, sometimes two or more... Here let me put 4 lines of stars before continuing:

****************************************
****************************************
****************************************
****************************************

For that I use a very special pick list, a pick list with only one item, a special item that contains:

  • the text I want (here 40 stars).

  • followed by a PickList command to display the very same pick list again.
  • In my Commands.glo glossary that I include at the top of all my other glossaries, I have added an entry which contains:

  • a line of stars

  • followed by a PickList command to display my stars Pick List.
  • Now when I want to type one ore more line of stars, I expand my starlines entry:

  • it produces one line of stars.

  • and then the Phrase Advisory displays the stars pick list.
  • At that point, if I want additional star lines, all I have to do is hit my semi colon marker in a loop until I have the desired number of star lines. As this is recursive, the advisories will always propose me an additional line of stars. So you may wonder, how do I stop this loop? Simply by ignoring the displayed pick list item when I am done and continue typing whatever I want to. The fact that the advisories display a pick list does not mean that you mandatorily need to pick something. :-)

    I hope you get the idea.

    Kind regards,
    Emmanuel




    Edit | Reply | | View All | |   | Current page | Author
    Followups