Tuesday, April 10, 2007

Lesson 1: The Extra Mile

Now that you've seen how to get the T.S. Menu (TSM) up and going, let's get into it a bit more.

Your T.S. Menu looks like this (note there are only two lines; your browser may wrap long lines):

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

But you might also want to run your macros from the TSM as well; not a problem. Let's say, you want to trigger your macro "Date-Time" with the trigger dt; here's how you would do that.

dt :mac "Date-Time"

Now, when you invoke the TSM and hit 'dt', your macro runs instead of outputting text. But here's a nice little trick that you can do in QM. If you don't want to create a new macro, just code it in the TSM.

In QM you can run all the lines together by separating them with a semi-colon ';' instead of carriage-returns. Take your Date-Time macro for example. Here's your code:

str a
a.time("%c")
outp a

Nice and compact; easy to maintain; and efficient. Good job; you're really getting the hang of this. Anyway, so you want to have this code in the TSM rather than making a whole new macro; no problem. Here's how you're going to do that. Replace the 'carriage-returns' with a 'semi-colon' like this:

str a;a.time("%c");outp a

Now put that into your trigger line in your TSM like this:

dt :str a;a.time("%c");outp a

And there you have it. It makes complicated macros and functions a real bear-cat to debug or even to know what it's for, but it can be done and it can be better sometimes than making all kinds of new macros clogging up your List in the main window.

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

Lesson 1: The Text Sensitive Menu

No comments: