Tuesday, April 10, 2007

Lesson 1: The Text Sensitive Menu

In the 1st article here at The Macro Hook, I'm going to show you how to make the T.S. Menu (TSM) your friend.

T.S. stands for "Text Sensitive" and is used for "text replacement" but that's kind of misleading to the new user. Think of the TSM as a way to write tonnes of text with just a few keystrokes. Let's dive in and I'll show you.

Ok, so here's the scenario involving email but this can work for text documents or spreadsheets, or anytime you need to type the same thing over and over. So, you have numerous people writing you; you basically want to say the same thing to each of them but don't want to write it every time. Here's how we do it.

Create a new TSM by going to "File">"New">"New T.S. Menu"

You will notice that it automatically calls the menu "T.S. Menu" by default but the name is selected and ready for you to type in your name or you can just hit enter and accept the default name (subsequent TSM will be called " T.S. Menu2", "T.S. Menu3" etc). The big blank box is called the "Editor"; it's where the magic happens.

Just a quick aside: the first line of your new T.S. Menu put in this code. I'm not going to go into what this does at this time because we have enough to cover but you can look at the help file to find out more about it.


So, lets say you want to always say, "Thanks for your input." in responding to these emails your always getting. Here's how we do that. In the Editor, type the "trigger text". For example, if you want QM to type out the above response when you type "nr" (nice response), your code would look like this.

nr :outp "Thanks for your input."

Now, we need to set your "trigger" for the TSM itself. While in the editor, press Ctl-P to get the properties dialog (you can also get to that by right clicking the macro name in the "List"). You'll see this dialog.

Now, click the "Keyboard" item in the list of triggers. If you hit the tab key after selecting the trigger method, it will take you to the "Hot-Key" field. Now hit just the letter of the keyboard shortcut you want to use. For instance, if you want your TSM trigger to be Control-Shift-t, just hit the "t" key when in the Hot-Key field and then click check boxes for Ctrl and Shift. Now, every time you hit Ctrl-Shift-t, you have engaged the TSM and it will wait for you to hit the trigger 'nr'. It will wait for 5 seconds for you to give it a correct trigger, at that time it will end the process. If you hit keys that are: not a trigger, click the mouse, or type a non-printable key such as....ummm....well, I would print them out here but they are non-printable (kind of like Schrödinger's cat so don't try to print them; you don't want to kill kittens do you?...EGAD MAN, JUST DON'T DO IT!....)....Sorry about that. It's just that I feel very strongly about quantum keystrokes.

So, now we're in business. Open a document in something (I like ConText) and hit your TSM trigger and then your text trigger; I'll wait for you........................Ok, good. Nice huh? Now lets make another that has a little more to it. Try this.

nr :outp "Thanks for your input.[]The ''Hofstadter-Moebius loop'' is actually very common in that type of computer.[][]R. Chandra"

Note: paste this in as one line of QM code.

Now, go try your triggers again.....AAAhhhhh....why did it to a new line character after "input."? Yes, you're right. The "[]" told QM to do a new line there. It's a very handy thing to have; it's kind of like a special escape character. Now, did you notice the odd appearance of the double-quotes? Well, that's a special consideration in QM (and maybe in other 3G or 4G languages too). When you're telling QM to "output all info between the next two quotation marks", you can't have it output the quotation mark because it thinks you're trying to tell it to stop outputting the text, so, instead you use two apostrophes instead. So, two of these ' equal one of these "

So there you have it; a quick and easy way to output a tonne of text with only a few keystrokes. Only you can limit the use of this technique; you can use it in text documents, web page forms, or even to beat down Digg spammers. 80)

So have at it and I'll see you next time cause the hook always brings you back.

Lesson 1: The Extra Mile

No comments: