============================================================================

Robert J. Sawyer on Wednesday, December 6, 1995

Two years ago, in December 1993, Karl Fuss posted a really 
excellent tip that enables you to have a huge number of macros 
accessible with two-key commands in WordStar for DOS 7.0.  Before 
I get into my own variation, here's Karl's original tip:

=================================================================

You can use any of the function keys or Alt keys you have free as 
the lead-in for a two-keystroke macro.  Each one of them will 
give you access to up to 36 macros, counting the letters and 
numbers.  Here's how.

Suppose you have Alt+N free to assign a macro to.  Make this 
macro, named anything you wish, and assign it to Alt+N --

 Sub Main
    AutoRestore(ON)
    WSQuiet(ON)
    Key("^MPN")
    PauseForKey()
    Key("^K")
 End Sub

This macro will play any macro with two characters in its name 
beginning with the letter N.  (That's determined by the "N" in 
the first "Key" line.)

Now, to make a macro that can be called by pressing Alt+N plus 
the letter A (or any other letter or number), simply name that 
macro NA.  Invoke it by pressing {Alt+N}a.

Of course, instead of using Alt+N, you could use F11, etc., etc.  
Just be sure that the calling macro includes its identifying 
letters in the first "Key" line.

===========================================================================

Well, I've found that tip of Karl's incredibly useful.  I have 
all my different "scriptWriting" macros keyed to Alt-W, for 
instance.  WI for "Interior Shot," WE for "Exterior Shot," WD for 
"Dialog," WS for "Stage Direction," etc.

Anyway, I use WordStar's help level 4, but hardly ever pull down 
the menus (I only use them for the occasional functions that 
can't be accessed by classic WordStar control commands).  But 
that means I've got eight Alt keys (Alt-F, Alt-E, Alt-V, Alt-I, 
Alt-S, Alt-L, Alt-U, and Alt-H for File, Edit, View, Insert,
Style, Layout, Utilities, and Help) tied up selecting pulldowns, 
instead of having them free for use as macro hot keys.

Well, it occurred to me that a variation on Karl's excellent 
technique could free up all those hot keys.  I've defined Alt-P 
as a lead-in key for pulling down WordStar menus (Alt-P for 
"pulldown" -- you could use Alt-M for "menu" or whatever else you 
like if you prefer).

Here's the macro:

 Sub Main
    AutoRestore(ON)
    Key("^]")
    PauseForKey()
 End Sub

(This macro works because ^] is the undocumented WordStar command 
to bounce the cursor up to the pulldown menu bar.)

So, if you've assigned the above macro to Alt-P, then "Alt-P, F" 
brings down the File menu, "Alt-P, E" brings down the Edit menu, 
and so on.  Meanwhile, you can define Alt-F or Alt-E (and the 
other pulldown menu commands) to more frequently used functions.

Once you press <Alt-P>, the message "Paused for key." will appear 
in the title bar, reminding you that WordStar is waiting for 
another keystroke from you.  If you press Alt-P by accident, you 
can cancel by pressing <Esc>.

All best wishes.

================================================================

RJS on Thursday, December 7, 1995:

By the way, here's a little refinement to Karl's method.

If your lead-in key is {Alt+W}, meaning that all your macros to
be called by it have two-letter names beginning with W, then name
the lead-in macro "W-LEAD", and define it thus:

 Sub Main
    AutoRestore(ON)
    WSQuiet(OFF)
    Key("^MPW-LEAD{Tab}^L^D^Qy")
    PauseForKey()
    Key("^K")
 End Sub

The little {Tab}^L dance (which is Tab/Backtab) will insure that
the "Play Macro" screen is displaying the Description line for
the W-LEAD macro; the ^D^Qy deletes everything except the first
character from the "Macro Name" field, so that all that's left
there is the lead-in "W".

Now, you can use ^ME (macro rename) to make the macro description
line for W-LEAD into your own little menu for what the other
macros do.  For scriptwriting, my W-LEAD description says:

  Description: D=Dialog | I=Int | E=Ext | N=Numb | S=Stage

Meaning press "D" for the Dialog Macro (WD.WSM), "I" for Interior
Shot macro (With.WSM), etc.

All best wishes.

=========================================================================

Friday, December 8, 1995:

Hi, Karl.  Thanks!

Actually, I've modified your system in another way, too.  The basic logic
of your system will work to call any macro with a two-character name from
a lead-in macro.  But all those secondary macros clutter up the ^MP
point-and-shoot menu for playing named macros that don't have hotkeys.

Well, the solution is to have two-key macro names that sort to the end of 
the list.  So I use:

^MP<lead-in macro name>{Tab}^L^Y<first character of secondary macro name>

{Tab}^L forces the "Description" line to display for the lead-in macro, and 
^Y deletes the entire lead-in macro name, so that you can put any first
character you want in instead (actually, this isn't limited to two-key 
macro names; you could use any number of characters up to seven as the 
standard part of all the secondary macro names, with an additional unique
character being the one you supply at runtime during the pause-for-key 
statement).

Here's an example of how I use this.  As you know, I edit my novels as
single large files.  Well, I often want to jump forward to the next 
page, the next scene change (shown in manuscript by a "#" centered in an 
otherwise blank line), or the next chapter -- or else jump backward to the
previous page, scene, or chapter.

To simplify this, I've got two lead-in macros:  NEXT.WSM, with the hotkey 
{Alt+N} and PREVIOUS.WSM, with the hotkey {Alt+P}.  The secondary macros 
breakdown like this:

  Previous Page:     {Alt+P}, P        Next Page:     {Alt+N}, P
  Previous Section:  {Alt+P}, S        Next Section:  {Alt+N}, S
  Previous Chapter:  {Alt+P}, C        Next Chapter:  {Alt+N}, C

Nice and mnemonic <grin>.  But instead of PS, PP, PC and  NS, NP, and NC
for the secondary macro names, I use {S, {P, {PC and }S, }P, }C.  That
is, I begin the "Previous" macro names with the "{" character and the
"Next" macro names with the "}" character -- which is also mnemonic, in a 
way:  the "{" points backwards and the "}" points ahead.  The advantage is 
all six of those secondary macros are sorted down to the end of my "Play 
Macro" directory, instead of cluttering up the middle of it.

Here are the macros.  Because of the syntax of WordStar's macro 
language, { is shown doubled as {{ and } is shown as }}:

======================================================================

PREVIOUS.WSM

 Sub Main
    AutoRestore(ON)
    WSQuiet(OFF)
    Key("^MPPREVIOUS{Tab}^L^Y{{")
    PauseForKey()
    Key("^K")
 End Sub

======================================================================

{S.WSM (which jumps to the previous scene break):

Sub Main
    WSQuiet(ON)
    AutoRestore(ON)
    Key("^E^Qf")
    Key("^PI#{Alt+T}")
    Key("^YB^K")
       IfException
       ACK: Key("{Enter}")
       End IfException
End Sub

======================================================================

{P.WSM (which jumps to the previous page):

Sub Main
    WSQuiet(ON)
    AutoRestore(ON)
    Key("^QI")
    Key("-1^K")
End Sub

======================================================================

{C.WSM (which jumps to the previous chapter):

Sub Main
    WSQuiet(ON)
    HideDots(ON)
    AutoRestore(ON)
    Key("^E^Qf")
    Key("^PIChapter {Alt+T}")
    Key("^YB^K")
       IfException
       ACK: Key("{Enter}")
       End IfException
End Sub

======================================================================

NEXT.WSM:

 Sub Main
    AutoRestore(ON)
    WSQuiet(OFF)
    Key("^MPNEXT{Tab}^L^Y}}")
    PauseForKey()
    Key("^K")
 End Sub

======================================================================

}S.WSM (which jumps to the next scene break):

Sub Main
    WSQuiet(ON)
    AutoRestore(ON)
    Key("^X^Qf")
    Key("^PI#{Alt+T}")
    Key("UA?^K")
       IfException
       ACK: Key("{Enter}")
       End IfException
End Sub

======================================================================

}P.WSM (which jumps to the next page):

Sub Main
    WSQuiet(ON)
    AutoRestore(ON)
    Key("^QI")
    Key("+1^K")
End Sub

======================================================================

}C.WSM (which jumps to the next chapter):

Sub Main
    WSQuiet(ON)
    HideDots(ON)
    AutoRestore(ON)
    Key("^X^Qf")
    Key("^PIChapter {Alt+T}")
    Key("^YUMA?^K")
       IfException
       ACK: Key("{Enter}")
       End IfException
End Sub

======================================================================

