Programmer's WorkBench (pwb.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
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.
                                    -♦-