Programmer's WorkBench (pwb.hlp) (Table of Contents; Topic list)
Lasttext Macro Example
 Description                               Up Contents Index Back
─────Programmer's WorkBench─────────────────────────────────────────────────
 
     The OpenInclude macro that follows opens an include file named in
     the next #include directive. The macro demonstrates a technique
     using the Lasttext function to pick up text from the file and
     modify it without modifying the file or the clipboard.
 
     OpenInclude :=  \
          Up Meta Begline Arg Arg "^[ \t]*#[ \t]*include" Psearch ->  \
          Arg Arg "[<>\"]" Psearch -> Right Savecur Psearch ->        \
          Selcur Lasttext Begline "$INCLUDE:" Openfile <n +>          \
          Lastselect Openfile <
 
     In the fourth line, Lasttext pulls the selected filename into the
     Text Argument dialog box. The text argument is modified to prepend
     "$INCLUDE:" before passing it to the Openfile function.
 
     In some macro-programming situations, you don't want to use the
     text immediately. Instead, you need to pick up some text, do some
     other processing, then use the text. In this situation, use the
     phrase:
 
     (make selection) Lasttext Cancel ...
 
     This picks up the text, then cancels the Text Argument dialog box.
     The selected text remains in the Lasttext buffer for later use. To
     reuse the text, call Lasttext again.
                                    -♦-