home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR21 / TSE_TIP1.ZIP / TSE_TIP1.TXT < prev   
Text File  |  1993-11-09  |  175KB  |  4,637 lines

  1. /**************************************************************************
  2. /**************************************************************************
  3.            File:  'tse_tip1.txt  Tuesday -  November 9, 1993
  4.  
  5.        Started 5-13-93 for small bits of info and/or source code.
  6.                 TSE (The SemWare Editor, a.k.a. TESSIE)
  7.  
  8. /**************************************************************************
  9. /**************************************************************************
  10. ===========================================================================
  11.                   Date: 05-11-93  From: EBERHART ADAM
  12.  
  13.                  Unmarking text with the mouse button:
  14. ---------------------------------------------------------------------------
  15.  
  16. I just tried this (changed mLeftBtn from tse.s):
  17.  
  18. /**************************************************************************
  19.  
  20. proc mLeftBtn()
  21.     if not MouseMarking(_INCLUSIVE_) and not ProcessHotSpot()
  22.         MainMenu()
  23.     elseif not iscursorinblock()
  24.         UnMarkBlock()
  25.     endif
  26. end
  27.  
  28. /**************************************************************************
  29.                         Thursday - May 13, 1993
  30. /**************************************************************************
  31.  
  32. TSE change to *.key to have CTRL-Y move cursor position to BegLine.
  33.  
  34.   Change  <Ctrl y>   DelLine()
  35.  
  36.   to      <Ctrl y>   DelLine() BegLine()
  37.  
  38.   then recompile.
  39.  
  40.   While having two commands on the same will currently work, it is not
  41.   guaranteed to always be implemented. So instead of the double command
  42.   define a procedure in 'tse.s'
  43.  
  44.     proc  YankLine()
  45.         DelLine()        and then define the key:  <Ctrl y>  YankLine()
  46.         BegLine()
  47.     end
  48.  
  49. /**************************************************************************
  50.  
  51. ===========================================================================
  52.                     Date: 05-13-93  From: RAY ASBURY
  53.                      Subj: WordRight/Left TSE Macro
  54. ---------------------------------------------------------------------------
  55. If you've noticed that WordLeft() and WordRight() stop on the beginning
  56. and the end of lines, and don't like this behavior, here's a simple
  57. replacement for these commands which skips over the beginning and the
  58. ending of lines:
  59.  
  60.     CONSTANT kPREVIOUS_WORD = FALSE,        kNEXT_WORD = TRUE
  61.  
  62.     INTEGER PROC mGotoWord1(INTEGER whichOne)
  63.         IF (whichOne ==kNEXT_WORD)
  64.             Return(WordRight())
  65.         ENDIF
  66.         Return(WordLeft())
  67.     END mGoToWord1
  68.  
  69.     INTEGER PROC mGotoWord2(INTEGER whichOne)
  70.         WHILE ( (mGotoWord1(whichOne)) AND (NOT IsWord()) )
  71.             whichOne = whichOne
  72.         ENDWHILE
  73.         IF (IsWord())
  74.             Return(TRUE)
  75.         ENDIF
  76.         Return(FALSE)
  77.     END mGotoWord2
  78.  
  79.     PROC mGotoWord(INTEGER whichOne)
  80.         PushPosition()
  81.         IF (mGotoWord1(whichOne))
  82.             IF (NOT IsWord())
  83.                 IF (NOT mGotoWord2(whichOne))
  84.                     PopPosition()
  85.                     Return()
  86.                 ENDIF
  87.             ENDIF
  88.         ELSE
  89.             PopPosition()
  90.             Return()
  91.         ENDIF
  92.         KillPosition()
  93.     END mGotoWord
  94.  
  95. To use this, simply add this to your TSE.S file and replace direct calls
  96. of WordLeft() with mGotoWord(kPREVIOUS_WORD) and of WordRight() with
  97. mGotoWord(kNEXT_WORD).
  98.  
  99. Currently, if a word is not found, the cursor won't move.  If, however,
  100. you would prefer that it go to either the beginning of the file, or the
  101. end (depending on the direction you are searching), use this version of
  102. mGotoWord():
  103.  
  104.     PROC mGotoWord(INTEGER whichOne)
  105.         IF (mGotoWord1(whichOne))
  106.             IF (NOT IsWord())
  107.                 mGotoWord2(whichOne)
  108.             ENDIF
  109.         ENDIF
  110.     END mGotoWord
  111.  
  112. I hope you find this useful,
  113.  
  114. "Buddy" E. Ray Asbury, Jr.
  115. Team TSE
  116. /**************************************************************************
  117.  
  118. ===========================================================================
  119.                    Date: 05-13-93  From: KYLE WATKINS
  120.  
  121.       Subj: TSRGEP problem that hit line# is shifted down one line
  122.     Reference:  Next item also has a solution for a TSRGREP problem
  123. ---------------------------------------------------------------------------
  124.  
  125. -> markline()                <----  CHANGE TO CHARACTER OR COLUMN
  126. -> GotoBufferId(oid)
  127. -> BegLine()
  128. -> if linenumbers
  129. ->      InsertText(Format(linenumber:lndigits) +  ' │
  130. ->
  131. -> endif
  132. -> copyblock()               <---- Then the copy block will be on same
  133.                                    line instead of below (or above)
  134.  
  135.  
  136. ->But what is happening is the text associated with the hit line# is
  137. ->shifted down one line.
  138.  
  139. Hi David,
  140.    If you change to a block other than LineBlock, then CopyBlock will
  141.    use the same line.                                      ----  Kyle
  142.  
  143. /**************************************************************************
  144.  
  145. ===========================================================================
  146.                    Date: 05-13-93  From: DAVID MARCUS
  147.                          Subj: TSGREP Solution
  148. ---------------------------------------------------------------------------
  149.  
  150. I have determined the problem and solution causing your TSGREP hit list
  151. to be so erratic; it is the setting for your InsertLineBlocksAbove
  152. configuration option. You can either set it to ON or TRUE, or make
  153. these three small changes to TSGREP:
  154.  
  155. 1. Add this line as the first line under the
  156.    global INTEGER declarations [line ~82]:
  157.  
  158.      ILBA,                              // holds InsertLineAbove value
  159.  
  160. 2. Add this line as the first line in
  161.    proc MAIN() [line ~260]:
  162.  
  163.      ILBA = Set(InsertLineBlocksAbove, ON)
  164.  
  165. 3. In proc end_processing(), add this line as the first line under
  166.           /*
  167.                Reset editor
  168.           */
  169.  
  170.    [line ~723]:
  171.  
  172.           Set(InsertLineBlocksAbove, ILBA)
  173.  
  174.  
  175. *** Please let me know if this does not work. ***
  176. /**************************************************************************
  177.  
  178. ===========================================================================
  179.                    Date: 05-13-93  From: KYLE WATKINS
  180.                 Subj: Remove blank lines in a text file
  181. ---------------------------------------------------------------------------
  182.  
  183.    The following will delete all blank lines in a file, even if the line
  184. contains just tab and space characters.
  185.  
  186. proc DelBlankLine()
  187.     pushposition()    //save your position
  188.     begfile()         //remove this if you want to start at the
  189.                       //current pos. and replace it with begline()
  190.  
  191.     while LFind("\d009\d032]*$","X")  //Find "Beginning of line followed
  192.                                         //by 0 or more tabs or spaces
  193.                                         //followed by EOL". Use of LFind
  194.                                         //instead of Find so that the display
  195.                                         //does not update with each find.
  196.  
  197.         message(currline()," of ",numlines()) //just for information in case
  198.                                               //it's a large file
  199.         delline()
  200.     endwhile
  201.     message("DONE!")                          //So you know it's done when
  202.                                               //no blank lines are in file
  203.  
  204.     popposition()     //return to your original position
  205. end
  206.  
  207. /**************************************************************************
  208.  
  209. ===========================================================================
  210.                   Date: 05-14-93  From: SAMMY MITCHELL
  211. ---------------------------------------------------------------------------
  212. >   I am trying to use a command macro I had for QEdit that would allow
  213. >  me to abandon a file and restart the edit with the last saved copy.  I
  214. >  seem to want a variable into which I can place the CURRENT FILE NAME,
  215. >  but I don't see this.
  216.  
  217. How about this:
  218.  
  219. // quit the current file (even if changed) and reload it from disk
  220. proc ReloadCurrentFile()                // version 1
  221.     string fn[65] = CurrFilename()      // save the name
  222.  
  223.     AbandonFile()                       // quit the file
  224.     EditFile(fn)                        // and reload it
  225. end
  226.  
  227. Or, if you prefer:
  228.  
  229. // quit the current file (allow saving first) and reload it from disk
  230. proc ReloadCurrentFile()                // version 2, safer
  231.     string fn[65] = CurrFilename()      // save the name
  232.  
  233.     if isChanged()                      // if changed allow saving
  234.         case YesNo("Save Changes?")
  235.             when 0, 3   return()
  236.             when 1      if not SaveFile()
  237.                             return ()
  238.                         endif
  239.         endcase
  240.     endif
  241.     AbandonFile()
  242.     EditFile(fn)
  243. end
  244.  
  245. And finally, a version that is more like QEdits "NewFile", which will
  246. allow you to optionally reload the current file, or just load another
  247. file after quitting the current file:
  248.  
  249. // quit the current file (allow saving first) and load another
  250. proc NewFile()
  251.     string fn[65] = CurrFilename()      // save the name
  252.  
  253.     if isChanged()                      // if changed allow saving
  254.         case YesNo("Save Changes?")
  255.             when 0, 3   return()
  256.             when 1      if not SaveFile()
  257.                             return ()
  258.                         endif
  259.         endcase
  260.     endif
  261.     AbandonFile()
  262.     AddHistoryStr(fn, _EDIT_HISTORY_)
  263.     EditFile()
  264. end
  265.  
  266. /**************************************************************************
  267.  
  268. ===========================================================================
  269.                    Date: 05-09-93  From: KYLE WATKINS
  270.                        Subj: MOUSE SELECTED TEXT
  271. ---------------------------------------------------------------------------
  272. -> editors, when you click again on the screen the highlighted text
  273. -> doesn't go away. This is very annoying. With TSE you must click and
  274. -> then drag some to get the previous selected text to disapear. With
  275.  
  276.   You can issue unmarkblock() to get rid of the marked block (our
  277. default <ALT U>) instead of trying to remark a block to get rid of the
  278. first block. When you "click and drag" the mouse, you are actually using
  279. the markchar() command to mark a character block.  If you would rather
  280. the marked block be unmarked each time you press the left mouse button
  281. whenever you are in an "editing portion" of the screen, you can make the
  282. following adjustments to the mLeftBtn() procedure that is near the
  283. bottom of the tse.s file (or within the ".s" file you used to configure
  284. the editor):
  285.  
  286. proc mLeftBtn()
  287.     if mousehotspot() == _mouse_marking_    // add this line
  288.         unmarkblock()                       // add this line
  289.     endif                                   // add this line
  290.     if not ProcessHotSpot()
  291.        MainMenu()
  292.     endif
  293. end
  294.  
  295. This will unmark any block if you press the left mouse button and you
  296. are within the editing window.  If you are outside the editing
  297. window, the block will remain marked.  If you want to unmark the block
  298. no matter where the mouse cursor is, modify the mLeftBtn() procedure to
  299. begin with unmarkblock() instead of the three lines I show.
  300.  
  301.   When you use the mouse with QEdit by first loading qm.com, mouse
  302. movements are translated to the appropriate cursor commands depending on
  303. the direction of mouse movement and are placed in the keyboard buffer.
  304. That is why the movement of the mouse caused the cursor to move.  One
  305. drawback to this is that the cursor will move whenever the mouse is
  306. moved, which means if you bump the mouse, your cursor moves.
  307.  
  308.    If you want to do this in TSE, it should be possible with a macro
  309. if you take all of the window borders into account.
  310.  
  311. Kyle Watkins (SemWare Technical Support)
  312.  
  313. /**************************************************************************
  314.  
  315. ===========================================================================
  316.                    Date: 05-15-93  From: BOB CAMPBELL
  317.                     Subj: Re: TSE not finding macro
  318. ---------------------------------------------------------------------------
  319.  
  320.  > Here's how I got around this problem.  In your
  321.  > TSE.S file's WhenLoaded(), add the following
  322.  
  323.  >     AddHistoryStr(Query(MacPath), _ExecMacro_History_)
  324.  >     AddHistoryStr("", _ExecMacro_History_)
  325.  
  326. Thanks Ray. It took me a while to figure out how to use your routine but
  327. I've got it installed now and it's even better than what I was asking for!
  328.  
  329. /**************************************************************************
  330.  
  331. ===========================================================================
  332.                    Date: 05-17-93  From: KYLE WATKINS
  333.                           Subj: BLOCK TABBING
  334. ---------------------------------------------------------------------------
  335. Question:  In Qedit, I can highlight a block of text, move it, and then
  336.            if the indent happens to be further in that it was
  337.            originally, I can place the cursor at the beginning of a line
  338.            of text and hit tab, and the whole block is tabbed over.
  339.  
  340. Hi John,
  341.  
  342.    If you are using the tse.s file, there is a macro called
  343. mShiftBlock().  This macro is used with the default <shift f7>,
  344. <shift f8>, and <ctrl f7> key assignments. Modify your tab keys to be:
  345.  
  346. for <Shift Tab> use:
  347.  
  348. iif(isCursorInBlock(),mShiftBlock(-Query(TabWidth)),TabLeft())
  349.  
  350. for <Tab> use:
  351.  
  352. iif(isCursorInBlock(),mShiftBlock(Query(TabWidth)),TabRight())
  353.  
  354.   If your cursor is not in a marked block, you will get the normal
  355. tableft() and tabright(), otherwise the block will be shifted by the
  356. current tab width.
  357.  
  358. Kyle Watkins (STS)
  359. /**************************************************************************
  360.  
  361. ===========================================================================
  362.                     Date: 05-17-93  From: RAY ASBURY
  363.                           Subj: TSE macro help
  364. ---------------------------------------------------------------------------
  365.  
  366. <User blushing>
  367.  
  368. Spend some time just playing around with regular expressions - the power
  369. of them is incredible.  Although they've been around a long time, I'd
  370. never used them until I started alpha testing TSE.  I could hardly get
  371. along without them now.
  372.  
  373. BTW - here's three searches that I use a lot and are extremely handy:
  374.  
  375.         Find("^$", "X") - finds blank lines
  376.         Find("^.@", "X") - finds all lines
  377.         Find("^.#", "X") - finds all non-blank lines
  378.  
  379. I've put these into the find & replace histories so that I can simply
  380. Up() to them.  If you want to do the same thing, just add something like
  381. the following to your TSE.S's WhenLoaded() macro:
  382.  
  383.     AddHistoryStr("^{.@}", _Find_History_)
  384.     AddHistoryStr("^{.#}", _Find_History_)
  385.     AddHistoryStr("", _Find_History_)
  386.  
  387. ┌───<<< BOB CAMPBELL >>>─────────────────────────────────────────────────────┐
  388. │I also discovered (quite by accident) while working with the search function│
  389. │that the search strings are saved to a buffer for recall by using the       │
  390. │CursorUp and CursorDown keys.                                               │
  391. └───>>> RAY ASBURY <<<───────────────────────────────────────────────────────┘
  392.  
  393. These are called "histories".  A lot of the dialog prompt boxes within
  394. TSE have them.  Check out pages 24-5 in the User's Guide.  Did you know
  395. that you can mark text, and then use the Copy() command <Alt C> to paste
  396. the marked text into most dialog boxes?
  397.  
  398. ┌───<<< BOB CAMPBELL >>>─────────────────────────────────────────────────┐
  399. │I'm sure you know about this feature but I wanted to mention it and your│
  400. │search string above because it offered a valuable example for learning. │
  401. └───>>> RAY ASBURY <<<───────────────────────────────────────────────────┘
  402.  
  403. <User REALLY BLUSHING>
  404.  
  405. My humility demands that I let you know it took a couple of hours to
  406. come up with that macro.  Although putting the search string together
  407. wasn't bad, how to handle some of the other stuff wasn't easily
  408. apparent.
  409.  
  410. Thanks for the compliments,  but I suspect you'll be teaching me things
  411. before too long.
  412.  
  413. "Buddy" E. Ray Asbury, Jr.
  414. Team TSE
  415. /**************************************************************************
  416.  
  417. ===========================================================================
  418.                   Date: 05-18-93  fFrom: KYLE WATKINS
  419.                        Subj:  Regular Expressions
  420. ---------------------------------------------------------------------------
  421. -> What does the stuff inside the quotes ("^[\d009\d032]*$") mean and is
  422. -> there a place I can find this information in the manual?
  423.  
  424. Hi Paul,
  425.    Pages 75-82 in the "User's Guide" explains the use of Regular
  426. expressions (the "X" for the Find options means to use regular
  427. eXpressions).
  428.  
  429.    The ^ means to anchor the search to the beginning of the line.
  430.  
  431.    The [\d009\d032] denotes the set of the tab character (ASCII decimal
  432.    9) and the space character (ASCII decimal 32).
  433.  
  434.    The * means zero or more occurences of the preceding character. In
  435.    this case the preceding character is a "set" of characters (the tab
  436.    and the space) that are valid candidates for satisfying the
  437.    condition.
  438.  
  439.    The $ means the end of the line.
  440.  
  441. Kyle Watkins (SemWare Technical Support)
  442. /**************************************************************************
  443.  
  444. ===========================================================================
  445.                    Date: 05-18-93  From: KYLE WATKINS
  446.                              Subj: KILLFILE
  447. ---------------------------------------------------------------------------
  448.  
  449. Try the following and see if it is what you want:
  450.  
  451.  
  452. proc mKillFile()
  453.  
  454. //get currentfilename less ext and add .bak as ext.
  455.  
  456.  
  457. string filename[65]=SplitPath(CurrFilename(),_DRIVE_|_PATH_|_NAME_)+".bak"
  458.  
  459. EraseDiskFile(filename)  //erase the currentfile with .bak ext from disk
  460.  
  461.     killfile()               //erase currentfile from disk
  462.     abandonfile()            //abandon the current file
  463.  
  464.     updatedisplay(_statusline_refresh_) //clears "erase disk file" message
  465.  
  466.     editfile("-a- *.*")          // give a pickdir of *.* in the current dir
  467. end
  468.  
  469. <alt greydel> mKillFile()
  470.  
  471. Kyle Watkins (STS)
  472.  
  473. /**************************************************************************
  474.  
  475. ===========================================================================
  476.                 Date: 05-18-93  From: RICHARD BLACKBURN
  477.                     Subj: TSE Macro To Run KBD Macr
  478. ---------------------------------------------------------------------------
  479. ┌─
  480. │Richard, have you had a chance to develop a TSE macro to load and run
  481. │keyboard macros from the command line yet?
  482. └─
  483.  
  484. Yes, I wanted to test it for a while, before posting it :)  You will need
  485. to add the following to your WhenLoaded() in your TSE.S file:
  486.  
  487.     string  cmdline[128]    = Query(DosCmdLine),
  488.             temp[128]       = cmdline,
  489.             macrofile[62]   = ''
  490.     integer s1 = 0,
  491.             s2 = 0
  492.  
  493.     Upper(temp)
  494.     s1 = Pos('-U', temp)
  495.     if s1 == 1 or temp[s1 - 1] == ' '
  496.         macrofile = SubStr(cmdline, s1 + 2, sizeof(macrofile))
  497.         s2 = Pos(' ', macrofile)
  498.         if s2
  499.             macrofile = SubStr(macrofile, 1, s2)
  500.         endif
  501.         LoadKeyMacro(macrofile)
  502.         cmdline = iif(s1 == 1, '', SubStr(cmdline, 1, s1)) + iif(s2 == 0, '', SubStr(cmdline, s1 + 2 + s2, sizeof(cmdline)))
  503.         Set(DosCmdLine, cmdline)
  504.     endif
  505.  
  506. Once you have added this, be sure to burn it in using SC.EXE.  I picked
  507. -U[KbdMacroName] as the command line switch.  You can change it to whatever
  508. you prefer by chnaging the Pos('-U', temp) to look for the character you
  509. want to use.
  510.  
  511. Richard Blackburn (SemWare Technical Support)
  512.  
  513. /**************************************************************************
  514.  
  515. ===========================================================================
  516.                    Date: 05-18-93  From: ALAN DAWSON
  517.                           Subj: DRAGGING TEXT
  518. ---------------------------------------------------------------------------
  519. In the spirit of macros sharing:
  520.  
  521. I'm not a mouse kinda guy, but dragging text is sure one of the neat
  522. things about rodents and GUIs. Here are a couple of keyboard-tied
  523. macros for TSE to let you drag text up and down a file until you
  524. reach the point you want to "drop" it. I don't have any doubt the
  525. macros can be improved, either. They're quick and dirty and work
  526. great for me.
  527.  
  528. I have these tied to my Ctrl-ArrrowUp and Ctrl-ArrowDown keys. What
  529. they do is this:
  530.  
  531. If a block is marked, drag it in the direction of the pressed key.
  532. If a block is NOT marked, mark the current line and drag that.
  533.  
  534. Put the following keys in your TSE.KEY file, compile the macros and put
  535. them in the \tse\mac file, and burn a new copy of E.EXE
  536.  
  537. <Ctrl CursorDown>     ExecMacro ("linedown")
  538. <Ctrl CursorUp>       ExecMacro ("lineup")
  539.  
  540.     ----------- lineup.s starts ---------
  541. proc Main ()
  542.    If IsBlockMarked () <1
  543.           MarkLine ()
  544.    Else
  545.           MoveBlock ()
  546.           GotoBlockBegin ()
  547.           BegLine ()
  548.           UP ()
  549.    EndIf
  550. End
  551.     ----------- linedown.s starts ---------
  552. proc Main ()
  553.    If IsBlockMarked () <1
  554.         BegLine ()
  555.         MarkChar ()
  556.         Down ()
  557.         MarkChar ()
  558.         Down ()
  559.   Else
  560.        MoveBlock ()
  561.        GotoBlockEnd ()
  562.        BegLine ()
  563.        Down ()
  564.    EndIf
  565. End
  566.  
  567. /**************************************************************************
  568.  
  569. ===========================================================================
  570.                    Date: 05-21-93  From: ALAN KELLEY
  571.                         Subj: CUT with _NO_FILL_
  572. ---------------------------------------------------------------------------
  573.  
  574. I have a suggestion for an additional function you might consider if you
  575. ever update it.  I use a Cut with _NO_FILL_ a lot when working on menus
  576. or columnar data (or whenever I don't want anything else to move from
  577. where it's at after a block cut).  It's what I would call the compliment
  578. to the Paste(_OVERWRITE_) command.  In fact I've changed my key def's
  579. around a bit (see below) so my cut_with_no_fill_macro could be assigned
  580. to <Ctrl Grey-> to compliment <Ctrl Grey*>.
  581.  
  582. <Grey*>                 Paste()
  583. <Grey->                 Cut()
  584. <Grey+>                 Copy()
  585. <Alt Grey->             Cut(_APPEND_)
  586. <Alt Grey+>             Copy(_APPEND_)
  587. <Ctrl Grey*>            Paste(_OVERWRITE_)
  588. <Ctrl Grey->            myCutNoFill()
  589.  
  590. I'm not much of a programmer, but to give you an idea of what I'm
  591. talking about, here is the macro I came up with.  It seems to work with
  592. any kind of block you throw at it.
  593.  
  594. proc myCutNoFill()
  595.  
  596.   PushBlock()
  597.   Copy()
  598.   PopBlock()
  599.   FillBlock(" ")
  600.   GotoBlockBegin()
  601.   UnMarkBlock()
  602.  
  603. end
  604.  
  605. /**************************************************************************
  606.  
  607. ===========================================================================
  608.                    Date: 05-19-93  From: DAVID WALKER
  609.                       Subj: Intercepting key input
  610. ---------------------------------------------------------------------------
  611.  ╒═══════════════════════════════╕
  612.  │It would help to see the macro as it stands, but what I think you
  613.  │are looking for is this looping construct (it's fresh in my mind
  614.  │'cause SemWare just told me how <g>):
  615.  │
  616.  │KeyDef Name()
  617.  │    <Escape>
  618.  │    <Enter>
  619.  │End
  620.  │
  621.  │PROC you_are_working_on()
  622.  │
  623.  │    Stuff you are working on....
  624.  │
  625.  │    Enable(Name)
  626.  │    Process()
  627.  │    Disable(Name)
  628.  │
  629.  │    More stuff
  630.  │
  631.  │END
  632.  ╘═══════════════════════════════╛
  633.  
  634. You're right, Mel.  That's exactly what I was looking for.  Here's my
  635. own version, from the current incarnation of my "copy block from this
  636. window to the other window" macro:
  637.  
  638. /*
  639.     CpyBlk.S
  640.     Macro to mark a block, then copy it to the next window (at the end).
  641.     Assumes two windows open on the screen [next version should check
  642.      for that].
  643. */
  644.  
  645. keydef wMarkSet
  646.     <Escape>    EndProcess()
  647.     <Enter>     EndProcess()
  648. end
  649.  
  650. integer proc wMark()    // get keys until <Enter> or <Esc> pressed
  651.                         // return TRUE if <Enter> was pressed,
  652.                         // FALSE if <Esc> was pressed
  653.     Message("Mark block to copy, then <Enter>")
  654.     Enable(wMarkSet)
  655.     Process()           // accept everything until EndProcess() executed
  656.     Disable(wMarkSet)
  657.     return(Query(key) == <Enter>)   // 'key' returns the last key pressed
  658. end
  659.  
  660. proc wCopyBlock()
  661.     MarkStream()        // start marking, then switch to Process()
  662.     if wMark()          // if <Enter> was pressed,
  663.         Copy()          // copy the marked block to the clipboard
  664.         NextWindow()    // Switch to the 'other' window
  665.         Paste()         // Paste the block from the clipboard
  666.         UpdateDisplay() // Make sure the pasted block is visible
  667.         Endfile()       // Move to the end of the file
  668.         NextWindow()    // Back to where we started
  669.     else
  670.         UnMarkBlock()   // if <Escape> was pressed, never mind
  671.     endif
  672. end
  673.  
  674. <Alt z> wCopyBlock()
  675.  
  676. /**************************************************************************
  677.  
  678. ===========================================================================
  679.                    Date: 05-22-93  From: DAVID MARCUS
  680.                      Subj: mGetClipboardBlockType()
  681. ---------------------------------------------------------------------------
  682. /**************************************************************************
  683.      GET_CLIPBOARD_BLOCK_TYPE
  684.  
  685.      Determines the type of block that was copied to the current
  686.      clipboard. Returns same integer values as isBLockMarked()
  687.      -- see TSE doc for details.
  688.  
  689.      D. Marcus -- 5-21-93
  690. /**************************************************************************
  691. integer proc                  get_clipboard_block_type()
  692.      integer tid,                            // temp buffer
  693.           blocktype
  694.      PushPosition()
  695.      PushBlock()
  696.      tid=CreateTempBuffer()
  697.      Paste()
  698.      blocktype = IsBlockMarked()
  699.      AbandonFile(tid)
  700.      PopBlock()
  701.      PopPosition()
  702.      return(blocktype)
  703. end
  704.  
  705. /**************************************************************************
  706.  
  707. ==========================================================================
  708.                   Date: 05-24-93  From: SAMMY MITCHELL
  709.     Subj: TSE CONFIGURATIONS - switching between two configurations
  710. ---------------------------------------------------------------------------
  711.  
  712. >  I  would  really like to know how to use two different configurations in
  713. >  TSE.  I currently have TSE set with no wordwrap or autoindent, just what
  714. >  I  want  when  I'm  writing  batch files.  But when I write mail, I like
  715. >  those things on.  Is there anyway I can have my standard setting on most
  716. >  of  the time, but when I'm editing mail use my other settings?
  717.  
  718. If you have specific file extensions that can identify each of these
  719. conditions, then it is fairly easy to do what you ask.  In the
  720. 'OnChangingFiles' macro in TSE.S, it contains a case statement based on
  721. the current extension.  Say your mail stuff has an filename-extension of
  722. 'ml'. Changing the code to the following should give you what you want:
  723.  
  724. from:
  725.  
  726.     language = FALSE
  727.     cmode = FALSE
  728.     case CurrExt()
  729.         when ".s",".asm",".pas",".inc",".prg"
  730.             language = TRUE
  731.         when ".c",".h",".cpp",".hpp"
  732.             language = TRUE
  733.             cmode = TRUE
  734.     endcase
  735.  
  736. to:
  737.     // assumes mail filename-extension is ".ml"
  738.     Set(WordWrap, off)
  739.     Set(AutoIndent, off)
  740.     language = FALSE
  741.     cmode = FALSE
  742.     case CurrExt()
  743.         when ".s",".asm",".pas",".inc",".prg"
  744.             language = TRUE
  745.         when ".c",".h",".cpp",".hpp"
  746.             language = TRUE
  747.             cmode = TRUE
  748.         when ".ml"
  749.             Set(WordWrap, on)
  750.             Set(AutoIndent, on)
  751.     endcase
  752.  
  753. This will force WordWrap and AutoIndent off, everytime you change files,
  754. except if the file has an extension of '.ml', in which case these
  755. settings will be turned on.
  756.  
  757.  
  758. ===========================================================================
  759.                     Date: 05-25-93  From: MEL HULSE
  760.                  Subj: RepeatCommand deleting too much
  761. ---------------------------------------------------------------------------
  762.  
  763. 1. If a string search fails, how do I get a repeated macro to abort. I
  764.    use the repeat for 1000 times, but there are only 500 occurances in
  765.    the file.  It will keep deleting at the line where it fails, so I
  766.    lose 500 too many lines.
  767.  
  768. #INCLUDE this with a keybinding in TSE.S, compile
  769.  
  770.     ("sc -b \ui\tse")
  771.  
  772. ...and use as the last command in your keyboard macro, run the
  773. macro then use RepeatCmd as in QEdit.
  774.  
  775. PROC  FindOut()
  776.     If RepeatFind()
  777.         Right()
  778.     Else
  779.         PurgeKeyMacro()
  780.     EndIf
  781. END
  782.  
  783.  
  784. <key>                   FindOut()
  785.  
  786. If you want to use your keyboard macro again, be sure and save it
  787. as the above deletes the loaded copy in order to stop it.
  788.  
  789. /**************************************************************************
  790.  
  791. ===========================================================================
  792.                     Date: 05-25-93  From: MEL HULSE
  793.                          Subj: WhenLoaded Usage
  794. ---------------------------------------------------------------------------
  795.  
  796.  ┌─o
  797.  │(Incidentally, why do you refer to them as WhenLoaded
  798.  │macros?  They're not by chance tied into the WhenLoaded statement
  799.  │in TSE.S (and ALWAYS LOADED AND ACTIVE when the editor starts) are
  800.  │they?)
  801.  └─o
  802.  
  803. That's it.  Here's the relevant code:
  804.  
  805. Proc WhenLoaded()
  806.     integer cid = GetBufferId()             /* ppp */
  807.  
  808.     LoadMacro("c:\SE\macros\utility1")
  809.     LoadMacro("c:\SE\macros\utility2")
  810.     LoadMacro("c:\SE\macros\utility3")
  811.  
  812.     Set(MacPath, "c:\se\macros\")           // Default Path
  813.     SetGlobalStr("Ruler", "4")
  814.  
  815.     Set(MouseRepeatDelay, Val(GetEnvStr("MOUSERAT")))  // See below *
  816.     pick_buffer = CreateTempBuffer()
  817.     GotoBufferId(cid)
  818.  
  819.     Set(CurrVideoMode,_28_LINES_)
  820.     Hook(_ON_CHANGING_FILES_, OnChangingFiles)
  821.  
  822.     Hook(_ON_FIRST_EDIT_, OnFirstEdit)
  823.  
  824. End WhenLoaded
  825.  
  826. /**************************************************************************
  827.  
  828. ===========================================================================
  829.                  Date: 05-23-93  From: JACK HAZLEHURST
  830.                       Subj: DelToBOL with undelete
  831. ---------------------------------------------------------------------------
  832. By the way, the delete to BOL routines do it in such a way that you can't
  833. recover with Undelete.  I am now using:
  834.  
  835. // Delete characters to beginning of line
  836.  
  837. proc mDelToBOL()
  838.     PushBlock()                 // This does it in a way that can be
  839.     UnMarkBlock()               // recovered by "UnDelete".
  840.     MarkChar()
  841.     BegLine()
  842.     MarkChar()
  843.     DelBlock()
  844.     PopBlock()
  845. end
  846.  
  847. // proc DelToBOL with undelete
  848.  
  849. /**************************************************************************
  850.  
  851. ===========================================================================
  852.                  Date: 05-23-93  From: GEORGE DE BRUIN
  853.                   Subj: History Buffer suggested uses
  854. ---------------------------------------------------------------------------
  855.  
  856. The "File(s) to edit:" prompt in TSE has a history that keeps track of
  857. the last 500 entries.  If you have already loaded a file from the
  858. directory you want to go to, all you have to do is scroll through the
  859. history (using the up arrow or down arrow key) until you find that
  860. entry.  Then, delete the file name, leaving the drive/path in tact
  861. (including the final backslash -- ie, 'c:\tse\ui\') and press enter.
  862. That will bring up the directory listing for you.
  863.  
  864. ───────────────────────────────────────────────────────────────────────────────
  865.  
  866. A variation on this trick would be to have a macro that is executed when
  867. you load the editor push a bunch of entries on the stack for you.  This
  868. way, all you'd have to do is pick the right entry out of the history
  869. list.
  870.  
  871. Here's a short example macro I would place in TSE.S:
  872.  
  873. proc EditHist()
  874.  
  875.     AddHistoryStr("c:\hold\", _EDIT_HISTORY_)
  876.     AddHistoryStr("c:\tse\src\", _EDIT_HISTORY_)
  877.     AddHistoryStr("c:\tse\ui\", _EDIT_HISTORY_)
  878.     AddHistoryStr("c:\c\src\", _EDIT_HISTORY_)
  879.     AddHistoryStr("c:\c\doc\", _EDIT_HISTORY_)
  880.  
  881. end DirHist
  882.  
  883. Now, in your WhenLoaded() in TSE.S you would add a call to EditHist()
  884. like this:
  885.  
  886. proc WhenLoaded()
  887.  
  888.     /*
  889.      * Whatever else you have in your when loaded.
  890.      *
  891.      */
  892.  
  893.      EditHist()
  894.  
  895. end
  896.  
  897. Of course, after editing TSE.S you'd need to exit TSE and re-burn in
  898. your configuration. (With 'sc -be.exe ui\tse.s')
  899.  
  900. If you wanted to get real fancy, you could have EditHist() load a file
  901. of the paths you want in the history and insert them into the edit
  902. history.  That way, you could just edit the file instead of having to
  903. change and re-burn in the macro all the time.  (I won't take the time to
  904. develop this right now, but if you are interested, I will put it
  905. together for you.)
  906.  
  907. /**************************************************************************
  908.  
  909. ===========================================================================
  910.                     Date: 05-25-93  From: MEL HULSE
  911.                     Subj:  Examples of WhenLoaded()
  912. ---------------------------------------------------------------------------
  913.  
  914. That's it.  Here's the relevant code:
  915.  
  916. Proc WhenLoaded()
  917.     integer cid = GetBufferId()             /* ppp */
  918.  
  919.     LoadMacro("c:\SE\macros\utility1")
  920.     LoadMacro("c:\SE\macros\utility2")
  921.     LoadMacro("c:\SE\macros\utility3")
  922.  
  923.     Set(MacPath, "c:\se\macros\")           // Default Path
  924.     SetGlobalStr("Ruler", "4")
  925.  
  926.     Set(MouseRepeatDelay, Val(GetEnvStr("MOUSERAT")))  // See below *
  927.     pick_buffer = CreateTempBuffer()
  928.     GotoBufferId(cid)
  929.  
  930.     Set(CurrVideoMode,_28_LINES_)
  931.     Hook(_ON_CHANGING_FILES_, OnChangingFiles)
  932.  
  933.     Hook(_ON_FIRST_EDIT_, OnFirstEdit)
  934.  
  935. End WhenLoaded
  936.  
  937. /**************************************************************************
  938.  
  939. ===========================================================================
  940.                     Date: 05-27-93  From: JAN NOLAN
  941.                  Subj:  Combining SS.mac & SS_Block.mac
  942. ---------------------------------------------------------------------------
  943.  
  944. SS.mac & SS_Block.mac can be easily combined into a single macro. Just
  945. add a new main routine that decides which to do
  946.  
  947.       if isCursorInBlock() == _LINE_  // Chks for block & block type
  948.            ss_block()                 // ie. the old main() in ss_block
  949.            else
  950.            ss_doc()                   // ie. the old main() in ss.s
  951.  
  952. /**************************************************************************
  953.  
  954. ===========================================================================
  955.                    Date: 05-31-93  From: ALAN KELLEY
  956.                           Subj: myLoadFiles()
  957. ---------------------------------------------------------------------------
  958.   Could you write a macro that calls EditFile, extracts
  959. the directory from the loaded file and issues a dos
  960. call to change to this directory:
  961.  
  962. Hi Klaus,
  963.  
  964. Thanks for the myLoadFile() macro. I did have to extend it to work
  965. across drives. This is what I came up with (though I think there must be
  966. an easier way):
  967.  
  968. proc myEditFile()                //<Alt E>
  969.  
  970.   string directory[40],
  971.          drive[1]
  972.  
  973.   if EditFile()
  974.     drive = SplitPath(CurrFileName(), _DRIVE_)
  975.     directory = SplitPath(CurrFileName(), _PATH_)
  976.     if drive == GetDrive()
  977.       Dos ('CD '+directory+'.', _DONT_CLEAR_)
  978.     else
  979.       LogDrive(drive)
  980.       Dos ('CD '+directory+'.', _DONT_CLEAR_)
  981.     endif
  982.   endif
  983.  
  984. end
  985.  
  986. Another trick I came up with to use along with this one is to pop up the
  987. directory listing for the directory of the current file with this:
  988.  
  989. proc myPickFile()                //<F6>
  990.  
  991.   string filename[40]
  992.  
  993.   filename = SplitPath(CurrFileName(), _DRIVE_ | _PATH_) + "*.*"
  994.  
  995.   if EditFile(filename)
  996.     AddHistoryStr(filename, _EDIT_HISTORY_)
  997.   endif
  998.  
  999. end
  1000.  
  1001.  
  1002. ≈≈  END of LoadFile() TSE macro Monday; May 31 at 0641 hrs  ≈≈
  1003. /**************************************************************************
  1004.  
  1005. ===========================================================================
  1006.                    Date: 06-01-93  From: KYLE WATKINS
  1007.                       Subj: TSE START-UP SWITCHES
  1008. ---------------------------------------------------------------------------
  1009. -> The same command with TSE gives a dupe of the first window, rather
  1010. -> than a blank, which confuses me. Try changing to something like
  1011. -> below:
  1012.  
  1013. /**************************************************************************
  1014.  
  1015. proc   mhwindow()
  1016.          if hwindow()
  1017.            editfile()
  1018.          endif
  1019. end
  1020.  
  1021. <key>   mhwindow()
  1022.  
  1023. /**************************************************************************
  1024.           ≈≈  END  TSE startup switches Wednesday; June 2   ≈≈
  1025. /**************************************************************************
  1026.  
  1027. ===========================================================================
  1028.                   Date: 06-02-93  From: SAMMY MITCHELL
  1029.                         Subj: TSE this and that
  1030. ---------------------------------------------------------------------------
  1031.  
  1032. AC> *   Date and time are stamped together -- should be two separate
  1033. AC>     commands.
  1034.  
  1035. This is actually just a macro:
  1036.  
  1037. proc mDateTimeStamp()
  1038.     InsertText(GetDateStr(), _INSERT_)
  1039.     InsertText(" ", _INSERT_)
  1040.     InsertText(GetTimeStr(), _INSERT_)
  1041. end
  1042.  
  1043. So, for instance, if you wanted <f1> to insert just the date:
  1044.  
  1045. <f1> InsertText(GetDateStr(), _INSERT_)
  1046.  
  1047. // END of some date inserts
  1048.  
  1049. /**************************************************************************
  1050. /**************************************************************************
  1051.  
  1052. ===========================================================================
  1053.                   Date: 05-29-93  From: BARRY HARRIDGE
  1054.           Subj: mCompile() not within TSE not indicating error
  1055. ---------------------------------------------------------------------------
  1056. I foolishly tried Ctrl-f9 Compile when SC.EXE was neither in my
  1057. directory nor on my path. The status line gave the message "unknown
  1058. command SC" but then a little menu popped up saying "Compile successful"
  1059. and inviting me to Load or Execute! I looked at your proc mCompile(),
  1060. then unerased my $errors$.tmp and found it was zero bytes as expected. I
  1061. believe that the trouble lies in proc mCompile() where it has
  1062.  
  1063.   AbandonFile()
  1064.   if NumLines() == 0
  1065.     ..
  1066.   else
  1067.     ..
  1068.   endif
  1069.  
  1070. because the NumLines() now refers to the current *.S file, not the error
  1071. file. I fixed it by moving AbandonFile() to after the "if" , and after
  1072. the "else".
  1073.  
  1074. /**************************************************************************
  1075. /**************************************************************************
  1076.  
  1077. ===========================================================================
  1078.                     Date: 06-04-93  From: MEL HULSE
  1079.                         Subj: WhenLoaded() hints
  1080. ---------------------------------------------------------------------------
  1081. ?)  Make up files of macros (each with all there PROCs) and their
  1082.     bound keystrokes.  I call these files UTILITY1.S,
  1083.     UTILITY2.S...  Put the keybindings at the bottom so you can
  1084.     copy them easily (see below.) Each file needs to compile to
  1085.     less than 16k.
  1086.  
  1087.     In the TSE.S WhenLoaded() PROC load these macro files as
  1088.     follows:
  1089.  
  1090. Proc WhenLoaded()
  1091.     integer cid = GetBufferId()
  1092.  
  1093.     LoadMacro("c:\TSE\mac\utility1")
  1094.     LoadMacro("c:\TSE\mac\utility2")
  1095.     LoadMacro("c:\TSE\mac\utility3")
  1096.     .   .   .   .   .   .   .   .   .   .
  1097.  
  1098. 1)  Go into TSE.KEY and copy the keybindings from the other files
  1099.     in a commented area.  That way, when you need a new
  1100.     keybinding, you can "Find" in TSE.KEY to see if what you want
  1101.     is used.
  1102.  
  1103. //END WhenLoaded() hints
  1104.  
  1105. /**************************************************************************
  1106. /**************************************************************************
  1107.  
  1108. ===========================================================================
  1109.                    Date: 06-06-93  From: TOM WHEELER
  1110.           Subj: Macro to reverse all lines in a marked block.
  1111. ---------------------------------------------------------------------------
  1112. DN> I am looking for a macro which will reverse the order of all lines in a
  1113. DN> marked block, which may not necessarily be in alphabetical order..
  1114.  
  1115. It's simple.
  1116.  
  1117.   x = number of lines in block.
  1118.   while (x)
  1119.     gotoblockbegin()
  1120.     deleteline()
  1121.     gotoblockend()
  1122.     down()
  1123.     undelete()
  1124.   endwhile
  1125.  
  1126. /**************************************************************************
  1127.  END of:
  1128.  Reversing the order of lines marked in a block.Wednesday -  June 9, 1993
  1129. /**************************************************************************
  1130.  
  1131. /**************************************************************************
  1132. /**************************************************************************
  1133.  
  1134. ===========================================================================
  1135.                     Date: 06-09-93  From: MEL HULSE
  1136.                         Subj: Format left margin
  1137. ---------------------------------------------------------------------------
  1138.  
  1139.  ┌─┤ TOM WHEELER on Monday the 7th of June 1993
  1140.  │HS> Does anyone have a simple way I must be overlooking to start all
  1141.  │HS> text in a file from column 2 (or 3, or whatever)?
  1142.  └────>
  1143.  
  1144.  ┌─o TSE mReturn2(),
  1145.  │...which does Return(), Right(), Right().  If you want to be able
  1146.  │to modify the indentation level use a global variable and
  1147.  │RepeatCommand().  Damn, just checked the book, and it says
  1148.  │RepeatCommand() asks the user.
  1149.  └─o
  1150.  
  1151. If you want to do it this way, an undocumented feature takes care
  1152. of this.
  1153.               ┌────────────────────────────────────────┐
  1154.               │ Implement within the TSE.S environment.│
  1155.               └────────────────────────────────────────┘
  1156.  
  1157. Integer Ndent               // global variable
  1158.  
  1159. Somewhere in WhenLoaded():
  1160.  
  1161.     NDent = 2
  1162.  
  1163. PROC SetNdent()
  1164.     String sNdent[2] = Str(Ndent)
  1165.  
  1166.     If Ask("Left Margin...", sNdent)
  1167.         Ndent = val(sNdent)
  1168.     EndIf
  1169. END
  1170.  
  1171. PROC DoNdent()
  1172.     CReturn()
  1173.     Right(Ndent)             // Note cursor movements can take an integer
  1174. End
  1175.  
  1176. <key            SetNdent()
  1177. <Enter>         DoNdent()
  1178.  
  1179. // END of TSE procedure to Format left margin
  1180.  
  1181. /**************************************************************************
  1182.  END   TSE Format left margin with SetNDent() & DoNdent()  06/10/93
  1183. /**************************************************************************
  1184.  
  1185. /**************************************************************************
  1186. Thursday -  June 10, 1993  Changed ClipboardMenu() in 'tak.s' to add
  1187.                            turn WordWrap ON/OFF.  changes marked with
  1188.                            //tak
  1189. /**************************************************************************
  1190. Menu ClipboardMenu()
  1191.  
  1192.     history
  1193.  
  1194.     "Cu&t"              ,   Cut()
  1195.     "C&ut Append"       ,   Cut(_APPEND_)
  1196.     "&Copy"             ,   Copy()
  1197.     "Cop&y Append"      ,   Copy(_APPEND_)
  1198.     ""                  ,                       , Divide
  1199.     "&Paste"            ,   Paste()
  1200.     "Paste &Over"       ,   Paste(_OVERWRITE_)
  1201.  
  1202.  
  1203.     ""                  ,                       , Divide
  1204.     "&Named ClipBoards  ", NamedClipBoardMenu(), DontClose
  1205.  
  1206. //tak additions below
  1207.  
  1208.     ""                  ,                       , Divide
  1209.     "&WordWrap ON"      ,   Set(WordWrap,ON)
  1210.     "WordWrap &OFF"     ,   Set(WordWrap,OFF)
  1211.  
  1212. //tak additions END
  1213.  
  1214. end //  ClipBoardMenu()
  1215. /**************************************************************************
  1216.  END changes to 'tak.s' to add selection of WordWrap ON/OFF to
  1217.      ClipBoardMenu()  6-10-93
  1218. /**************************************************************************
  1219.  
  1220. /**************************************************************************
  1221.  
  1222. ===========================================================================
  1223.                    Date: 06-09-93  From: RAY OCONNOR
  1224. ---------------------------------------------------------------------------
  1225. //tak tickler:  Make a menu selection for Help() <F1> and the selection
  1226.       will be context selectable.  e.g.  Block operations, file operations,
  1227.       make one option the ability to view the '*.hlp' file
  1228.  
  1229.   Online documentation is something I have become quite dependent upon.
  1230.   Use it all the time for C++.   The online docs don't replace the manuals
  1231.   but, they are a great supplement.
  1232.  
  1233.    proc Help()
  1234.  
  1235.        EditFile("TSE_HELP.ME")
  1236.        mCompressView(1)
  1237.  
  1238.    end Help
  1239.  
  1240.    <hot_key>  Help()
  1241.  
  1242. /**************************************************************************
  1243.  Tickler for making F1 help() a menu with selectable help files by context
  1244. /**************************************************************************
  1245.  
  1246. //*************************************************************************
  1247. /************************  Start Comment Area *****************************
  1248.  
  1249. ===========================================================================
  1250.                     Date: 06-13-93  From: MEL HULSE
  1251.               Subj: TSE - adding to block to TAK Commenter
  1252. ---------------------------------------------------------------------------
  1253.  
  1254.  │
  1255.  │e.g. Paragraph after running Commenter v2.0
  1256.  │
  1257.  │REM  The SemWare Editor (or TSE, as affectionately named by our beta
  1258.  │REM  testers) is licensed, commercial software.  Please help us stay in
  1259.  │REM  business by respecting our copyright and keeping this version
  1260.  │     private.
  1261.  └────> MEL HULSE
  1262.  
  1263. Oh!  That should be easy.  The key is being sure the text to be
  1264. REM'd is marked.
  1265.  
  1266. 1)  Save the right margin to a variable and change it to the
  1267.     value you want minus the space for REM.
  1268.  
  1269. 2)  While the text is blocked, do a WrapPara() from the block
  1270.     begining.  You don't need my macro.
  1271.  
  1272. 3)  GotoBlockBegin()
  1273.  
  1274. 4)  Do this:
  1275.  
  1276.   *************************************************************************/
  1277. //tak******************* END of Comment Area ******************************
  1278.  
  1279.     While IsCursorInBlock()
  1280.         InsertText("REM ", _INSERT_).
  1281.         Down()
  1282.     EndWhile
  1283.  
  1284. 5)  UnMark the block and restore the right margin.
  1285.  
  1286. That'll put the REM in front of each line of the text.
  1287.  
  1288. That do what you want?
  1289.  
  1290. //tak**********************************************************************
  1291. //END  Adding to block in TAK Commenter  Monday -  June 14, 1993
  1292. //tak**********************************************************************
  1293.  
  1294. ===========================================================================
  1295.                    Date: 06-14-93  From: DAVID MARCUS
  1296.                    Subj: Removing Double Blank Lines
  1297. ---------------------------------------------------------------------------
  1298.  
  1299. This macro deletes all blank lines that are adjacent to another blank
  1300. line or at top or bottom of file. Useful for cleaning up text files or
  1301. screen captures.
  1302.  
  1303. proc deblank()
  1304.         integer old = NumLines()
  1305.      PushPosition()
  1306.         BegFile()
  1307.         while CurrChar() < 0     // remove blanks from beginning
  1308.                 DelLine()
  1309.         endwhile
  1310.         repeat                          // remove from body of file
  1311.           if CurrChar() < 0
  1312.                 Down()
  1313.                 while ( CurrChar() < 0 )
  1314.                   AND ( CurrLine() < NumLines () )
  1315.                         DelLine()
  1316.                 endwhile
  1317.           endif
  1318.         until NOT Down()
  1319.      while CurrChar() < 0     // remove from end of file
  1320.            DelLine()
  1321.            Up()
  1322.      endwhile
  1323.      PopPosition()
  1324.      UpdateDisplay()
  1325.         Message( Str( old - NumLines() ) + " lines deleted")
  1326. end
  1327.  
  1328. //tak**********************************************************************
  1329. //TSE macro to Remove double blank lines. Tuesday -  June 15, 1993
  1330. //tak**********************************************************************
  1331.  
  1332. //*************************************************************************
  1333.  
  1334. ===========================================================================
  1335.                 Date: 06-17-93  From: RICHARD HENDRICKS
  1336.                             Subj: '}' & '{'
  1337. ---------------------------------------------------------------------------
  1338. JH>I am having trouble with TSE with the '}' and '{' keys.  They seem to
  1339. JH>invoke some special formatting stuff and jump to wierd places.  Is
  1340. JH>there some way to deactivate this and have '{' and '}' be just like
  1341. JH>any other letter?  John Ham
  1342.  
  1343. In your TSE.S file, you probably have some lines something like the
  1344. following...
  1345.  
  1346. // Global variables - assumes globals initialized to 0. // Line 76 or so
  1347.  
  1348. integer
  1349.     cmode,              // used to invoke C-mode
  1350.     language,           // used to invoke language package
  1351.  
  1352. // ....
  1353.  
  1354. proc OnChangingFiles()
  1355.     string fn[65] = CurrFilename()
  1356.     integer mk, cid = GetBufferId()
  1357.  
  1358. // .....
  1359.  
  1360.     language = FALSE
  1361.     cmode = FALSE
  1362.     case CurrExt()
  1363.         when ".s",".asm",".pas",".inc",".prg"
  1364.             language = TRUE
  1365.         when ".c",".h",".cpp",".hpp"
  1366.             language = TRUE
  1367.             cmode = TRUE
  1368.     endcase
  1369. end
  1370.  
  1371. Depending on the settings for 'language' and 'cmode' the '{' and '}' will be
  1372. handled specially.
  1373.  
  1374. //*************************************************************************
  1375.   Handling of { and } ----- 'language' and 'cmode' need to be set
  1376. //*************************************************************************
  1377. ===========================================================================
  1378.                     Date: 06-19-93  From: MEL HULSE
  1379.                     Subj: Cheap and Dirty WHILE loop
  1380. ---------------------------------------------------------------------------
  1381.  
  1382. PROC foo()
  1383.     Integer i = 10
  1384.     While i = 0
  1385.         [command to be repeated]
  1386.         i = i - 1
  1387.     EndWhile
  1388. END
  1389.  
  1390. ===========================================================================
  1391.                 Date: 06-22-93  From: RICHARD HENDRICKS
  1392.                     Subj: Convert:Grphic Box 2 Text
  1393. ---------------------------------------------------------------------------
  1394. Sometimes I need to convert all the Extended ASCII graphics characters to
  1395. more printable or e-mailable characters. Here is a macro that I wrote that
  1396. does that.                                    ╔══════════════════════╗
  1397.                                               ╠══════════════════════╣
  1398. For example -- the file contains boxes like:  ║                      ║
  1399.                                               ║                      ║
  1400.                                               ╚══════════════════════╝
  1401.  
  1402.                                    +----------------------+
  1403. run GRP2TXT and you will now have: +----------------------+
  1404.                                    |                      |
  1405.                                    |                      |
  1406.                                    +----------------------+
  1407.  
  1408. Have fun..
  1409.     Richard // Saturday June 19, 1993 at 14:56:34 EST
  1410.  
  1411. // grp2txt.S  03/27/1992  12/09/1992
  1412. // by Richard Hendricks
  1413.  
  1414. // Suggests by STEVE WATKINS, SemWare & RICHARD BLACKBURN, SemWare
  1415.  
  1416. proc Main()
  1417.     pushposition()
  1418.     begfile()
  1419.     replace('[┤╡╢╖╕╣╗╝╜╛┐└┴┬├┼╞╟╚╔╩╦╠╬╧╨╤╥╙╘╒╓╫╪┘┌█]','+','qxnq')
  1420.     // replace('[┤-╣╗-├┼-╠╬-┌]','+','gxnq') --- shorter but less
  1421.     // readable form of line above
  1422.     begfile()
  1423.     replace('[║│░▒▓▌▐]', '|', 'gxnq')
  1424.     begfile()
  1425.     replace('[─═▄▀]', '-', 'gxnq')
  1426.     popposition()
  1427. end main
  1428.  
  1429. // end-of-message
  1430. //*************************************************************************
  1431.   Convert boxes to text characters
  1432. //*************************************************************************
  1433.  
  1434. ===========================================================================
  1435.                    Date: 06-19-93  From: TOM WHEELER
  1436.                           Subj: Comment macro
  1437. ---------------------------------------------------------------------------
  1438. Here's one for formatting comments in C++ or SAL code.
  1439.  
  1440. It either creates a "comment header" ("// "), or makes sure the comment
  1441. starts at the correct column.  Then it puts the cursor just past the
  1442. header for text insertion/editing.  I hardcoded the column at 41.  A
  1443. neat expansion would be the ability to reformat the comments in a block.
  1444.  
  1445. I hereby donate this code to the public domain.  Use it, abuse it,
  1446. or misuse it as you see fit, unfit, or misfit.
  1447.  
  1448. /*************************************************************************
  1449.   mComment()                                    6-19-93 Tom Wheeler
  1450.  
  1451.   Macro to Create or edit/format a C++ style comment on the cursor line
  1452.  
  1453.   Algorithm:
  1454.  
  1455.   If there is no comment header ("// ") on the line then it creates
  1456.     one either at column 41 or at the first tabstop past end of
  1457.     line, if the line is longer than 41 characters
  1458.   Otherwise, try to make sure the comment starts at column 41
  1459.   Go right 3 characters
  1460.  
  1461. *************************************************************************/
  1462. proc mComment()
  1463.     integer save_insertmode = Query (Insert)
  1464.     integer ComCol = 41                 // hardcoded - so who cares?
  1465.  
  1466.     Set (Insert, 1)
  1467.  
  1468.     BegLine()
  1469.     PushBlock()
  1470.     MarkLine() MarkLine()
  1471.     if (not lFind ("// ", "l"))
  1472.         EndLine()
  1473.         if (CurrCol() < ComCol)
  1474.             GotoColumn (ComCol)
  1475.         else
  1476.             GotoColumn (CurrCol() + DistanceToTab (1))
  1477.         endif
  1478.         InsertText ("// ")
  1479.     else
  1480.         if (CurrCol() < ComCol)
  1481.             while (CurrCol() <> ComCol)
  1482.                 InsertText (" ")
  1483.             endwhile
  1484.         elseif (CurrCol() > ComCol)
  1485.             while (CurrCol() <> ComCol and mLeftChar() == 32)
  1486.                 BackSpace()
  1487.             endwhile
  1488.             if (mLeftChar() <> 32)
  1489.                 InsertText ("   ")      // Note - this is a physical
  1490.                                         // tab (ASCII 9), NOT SPACES
  1491.             endif
  1492.         endif
  1493.  
  1494.         Right (3)
  1495.     endif
  1496.     UnmarkBlock()
  1497.     PopBlock()
  1498.     Set (Insert, save_insertmode)
  1499. end
  1500.  
  1501. //*************************************************************************
  1502.   Inserts comments '//' at column 41
  1503. //*************************************************************************
  1504.  
  1505.   06/24/93  If you want a macro to open HWindow() and you want it to
  1506.   start from the initial command the put UpdateDisplay() before the
  1507.   HWindow() command in the macro.
  1508. //*************************************************************************
  1509. //*************************************************************************
  1510.  
  1511. ===========================================================================
  1512.                   Date: 06-26-93  From: VERNON LEONARD
  1513.                     Subj: Vernon's Commenter macro
  1514. ---------------------------------------------------------------------------
  1515.  
  1516.     I haven't seen your marco to do the comments, it may be close to
  1517.     the one I did (below). I also added a few lines to remove the
  1518.     the comment lines since I was usally trying to find where the
  1519.     problem was in the code.
  1520.  
  1521. //*************************************************************************
  1522.     proc mComment()
  1523.         integer type = 0
  1524.         string word[12] = ""
  1525.  
  1526.         type = isCursorInBlock()    // see if the cursor is in the block
  1527.         if type
  1528.             GotoBlockBegin()        // we are so goto the begining of block
  1529.             Begline()               // make sure we are in 1st column
  1530.         endif
  1531.         PushPosition()              // Save where we are at just in case
  1532.         word = GetText(CurrCol(),2) // get the first word on the line
  1533.         PopPosition()               // now go back there
  1534.         if word == "//"             // we are in comments block
  1535.             while type              // start loop
  1536.                 DelChar()           // delete the comments
  1537.                 DelChar()
  1538.                 DelChar()           // and the space
  1539.                 Down()              // got down a line
  1540.                 type = isCursorInBlock()  // are we still in the block
  1541.             endwhile                // end loop
  1542.         else                        // no comments
  1543.             while type              // begin loop for comments
  1544.                 BegLine()           // make sure we are at 1st column
  1545.                 InsertText("// ")   // insert the comments
  1546.                 Down()              // down a line
  1547.                 type = isCursorInBlock()  // are we still in the block
  1548.             endwhile                // end the while loop
  1549.         endif
  1550.         UnMarkBlock()               // unmark the block
  1551.     end mComment                    // that's all folks
  1552.  
  1553. //*************************************************************************
  1554. ===========================================================================
  1555.                     Date: 06-26-93  From: MEL HULSE
  1556.                       Subj: Better Movement Macros
  1557. ---------------------------------------------------------------------------
  1558.  
  1559.  ┌─┤ RAY ASBURY on Friday the 25th
  1560.  │In the case of GotoColumn() and GotoLine(), I wanted a combined
  1561.  │command, similar to the "-n" command line option of TSE (by the
  1562.  │way - another tester help some with the replacement macro for
  1563.  │these, but I can't for the life of me remember who it was <b>).
  1564.  └────> ALL
  1565.  
  1566. Do you mean this one <g>:
  1567.     -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
  1568. /*  Goto Line and/or column.
  1569.  
  1570.     Bind to a key.
  1571.  
  1572.     Use.
  1573.  
  1574.     To a line only          - Answer prompt with the line number.
  1575.     To a column only        - Answer prompt with a comma followed
  1576.                               by the column number.
  1577.     To a line and column    - Answer prompt with the line number,
  1578.                               a comma and the column number.
  1579.  
  1580.     Ray Asbury, David Marcus, and Mel Hulse
  1581.     March 28, 1993
  1582. */
  1583.  
  1584. PROC GoCol(STRING s)
  1585.     GotoColumn(val (SubStr(s,Pos(',', s)+1 ,3)) )
  1586. END
  1587.  
  1588. PROC linecolumn()
  1589.  
  1590.     STRING  s[10] = ''
  1591.     Integer linecol_hist = 250
  1592.  
  1593.      if Ask('Goto [line][,column]:', s, linecol_hist)
  1594.           If s == ""
  1595.             message("No Entry...")
  1596.           elseif s[1] == ","
  1597.              GoCol(s)
  1598.           elseif NOT Pos(',', s)
  1599.              GotoLine(Val(s))
  1600.           else
  1601.              GotoLine(val (SubStr(s, 1, Pos(',', s) -1)) )
  1602.              GoCol(s)
  1603.           endif
  1604.      endif
  1605. END
  1606. ===========================================================================
  1607. ===========================================================================
  1608.                    Date: 06-28-93  From: KYLE WATKINS
  1609.                           Subj: Sizing Windows
  1610. ---------------------------------------------------------------------------
  1611.  
  1612.    You can use PushKey() with the appropriate cursor keys to resize
  1613.    a window.  When you use PushKey() to push keystrokes on the stack,
  1614.    it is on a LIFO (Last In First Out) basis.  PushKey() is described on
  1615.    page 151 of the Advanced User's Guide.
  1616.  
  1617.    The following example procedure will open a Horizontal window and
  1618.    then reduce the height of the new window by 4 lines.
  1619.  
  1620. proc mReduceWindow()
  1621.         if hwindow()
  1622.             pushkey(<enter>)
  1623.             pushkey(<cursordown>)
  1624.             pushkey(<cursordown>)
  1625.             pushkey(<cursordown>)
  1626.             pushkey(<cursordown>)
  1627.             pushkey(<cursorup>)
  1628.             resizewindow()
  1629.         endif
  1630. end
  1631.  
  1632.  
  1633.    When Resizewindow() is called, the pushkey(<cursorup>) selects the top
  1634. of the window, the 4 pushkey(<cursordown>) moves the bar down for
  1635. positions, and the pushkey(<enter>) causes the window changes to be
  1636. accepted.
  1637.    If a new horizontal window cannot be opened, the resizewindow() is
  1638. bypassed.
  1639.  
  1640. ===========================================================================
  1641.                    Date: 06-29-93  From: KYLE WATKINS
  1642.                        Subj: Regular Expressions
  1643. ---------------------------------------------------------------------------
  1644.  
  1645.    You can use "regular expressions" with the Find() command to find the
  1646.    occurrence of "-" at the end of a line.  See page 75-82 of the
  1647.    "User's Guide" for information about "regular expressions".
  1648.  
  1649. For instance:
  1650.  
  1651.    Find("-$","X") will find any "-" that is the last character on a
  1652.    line. The "$" specifies the end of line, and the "X" specifies to use
  1653.    "regular expressions".
  1654.  
  1655. You can have:
  1656.  
  1657.    while Find("-$","X")
  1658.         delchar()
  1659.         joinline()
  1660.         wordright()  //assumes that you remain on the same line.
  1661.                      //you may want to adjust macro to take into
  1662.                      //account that this may carry you to next line
  1663.                      //and also adjust for a blank line following.
  1664.  
  1665.         splitline()
  1666.    endwhile
  1667.  
  1668. I am not sure how you are defining the page..... if your page has a
  1669. FormFeed character present in the file, then you can account for this by
  1670. checking to see if the Formfeed character follows finding the "-" at the
  1671. end of line.
  1672.  
  1673. //*************************************************************************
  1674. //*************************************************************************
  1675.  
  1676. ===========================================================================
  1677.                    Date: 06-29-93  From: KYLE WATKINS
  1678.                      Subj: More Regular Expressions
  1679. ---------------------------------------------------------------------------
  1680.  
  1681. -> 'any occurrence of a period followed by a nonwhitespace'
  1682.  
  1683.     Find("\.[~\d009~\d032]","X+")
  1684.  
  1685. -> 'all occurrences of a numeral preceding a period'
  1686.  
  1687.     Find("[0-9]\.","X+")
  1688.  
  1689. -> 'find period whitespace lowercase-alphacharacter ". (a-z)" '
  1690.  
  1691.     Find("\.[\d009\d032][a-z]","X+")
  1692.  
  1693. //*************************************************************************
  1694. //*************************************************************************
  1695. ===========================================================================
  1696.                     Date: 07-07-93  From: RAY ASBURY
  1697.                        Subj: PROJECTS Suggestion
  1698. ---------------------------------------------------------------------------
  1699.  
  1700. After seeing a message you sent to George telling him that you're about
  1701. to release a new verison of PROJECTS, I wanted to suggest something.  I
  1702. would very much like to be able to specify whether to return to the
  1703. "current directory" as saved in the project file, or to return to the
  1704. "actual" current directory when TSE was started.  Maybe even a user
  1705. prompt
  1706.  
  1707.     "Return To Original Directory"
  1708.     "Stay In Project's Home Directory"
  1709.     "Abort Exit"
  1710.  
  1711. Just a thought.
  1712.  
  1713. <1½ Hrs Later>
  1714.  
  1715. Heck, I went ahead and did it myself!  Here are the changes that I made
  1716. (ALL TO PROJECTS.S):
  1717.  
  1718.     ADD THE FOLLOWING PRETTY MUCH ANYWHERE:
  1719.  
  1720.         PROC mGetStartupDirectory()
  1721.             DOS("CD > C:\TEMP\@@ERA@@~", _DONT_CLEAR_|_DONT_PROMPT_)
  1722.         END mGetStartupDirectory
  1723.  
  1724.         PROC mRestoreStartupDirectory()
  1725.             EditFile("C:\TEMP\@@ERA@@~")
  1726.             LogDrive(Chr(CurrChar()))
  1727.             MarkStream()
  1728.             EndLine()
  1729.             Left()
  1730.             MarkStream()
  1731.             DOS ("chdir " + GetMarkedText(), _DONT_CLEAR_|_DONT_PROMPT_)
  1732.         END mRestoreStartupDirectory
  1733.  
  1734.         MENU menuExitDirectory()
  1735.             Title = "Exit To Startup Directory?"
  1736.             History
  1737.  
  1738.             "&Yes"
  1739.             "&No"
  1740.         END menuExitDirectory
  1741.  
  1742.     IMMEDIATELY BEFORE THE SAVEALLANDEXIT() CALL IN
  1743.     mSaveFilesWithStatus(), ADD THE FOLLOWING:
  1744.  
  1745.         again:
  1746.             menuExitDirectory()
  1747.             CASE (MenuOption())
  1748.                 WHEN 1
  1749.                     mRestoreStartupDirectory()
  1750.                 WHEN 2
  1751.                     UpdateDisplay()
  1752.                 OTHERWISE
  1753.                     goto again
  1754.             ENDCASE
  1755.  
  1756.     SOMEWHERE IN WhenLoaded(), ADD THE FOLLOWING:
  1757.  
  1758.         mGetStartupDirectory()
  1759.  
  1760. //*************************************************************************
  1761.   TSE select directory up exit                     Thursday -  July 8, 1993
  1762. //*************************************************************************
  1763.  
  1764. //*************************************************************************
  1765.  
  1766. ===========================================================================
  1767.                         Sunday -  July 11, 1993
  1768. ---------------------------------------------------------------------------
  1769. RA> using Shift, pressing Alt-Q, P would only work if the Cap Locks is OFF.
  1770. RA> Key binds are case sensitive ONLY on the second key and ONLY when using
  1771. RA> two-key <Alt>'s, such as <Alt Q><P> & <Alt Q><Shift P>.  I don't believe
  1772. RA> the single keys, or the first key of a two-key bind, are case sensitive.
  1773.  
  1774. Finally it's cleared up!!  The below works:
  1775.  
  1776. ---------------------------------------------------
  1777. proc Test1()
  1778.     Message ("Test 1")
  1779. end
  1780.  
  1781. proc Test2()
  1782.     Message ("Test 2")
  1783. end
  1784.  
  1785. <Alt p><X>             test1()
  1786. <Alt P><Shift x>       test2()
  1787. //*************************************************************************
  1788.                         Sunday -  July 11, 1993
  1789. //*************************************************************************
  1790.  
  1791. ===========================================================================
  1792.                  Date: 07-12-93  From: GEORGE DE BRUIN
  1793.                     Subj: TSE - Query(Type of block)
  1794. ---------------------------------------------------------------------------
  1795.  
  1796. --> Is there any way to detect the block type?
  1797.  
  1798. Both the "isBlockInCurrFile" and "isCursorInBlock" procs will return the
  1799. block type.  I used them in BoxIt! to check for the presence of a block,
  1800. and the type of block (example follows):
  1801.  
  1802.     if isBlockInCurrFile() <> _COLUMN_  // Is there a column block in current
  1803.         message("No Column Block In File.") // buffer? If not, then return.
  1804.         return()
  1805.     endif
  1806.  
  1807.     if isCursorInBlock() <> _COLUMN_    // Is the cursor in the block?
  1808.         message("Cursor Not In Block.") // If not, then return.
  1809.         return()
  1810.     endif
  1811.  
  1812. The first "if" does what you want it to.
  1813. //*************************************************************************
  1814.   Detecting Block Type                           Wednesday -  July 14, 1993
  1815. //*************************************************************************
  1816.  
  1817. ===========================================================================
  1818.                    Date: 07-13-93  From: KYLE WATKINS
  1819.                    Subj: Endless loops...(BREAK, ON)
  1820. ---------------------------------------------------------------------------
  1821. -> Is there a way to interrupt a macro when its trapped in an endless loop?
  1822.  
  1823.     Page 189 of the Advanced User's Guide contains a description of the
  1824. Break editor variable. You can set this ON at the beginning of your macro
  1825. ,saving the current state of the Break variable before setting it ON so
  1826. that you can restore it to the state it was in before running your macro.
  1827.  
  1828. e.g.
  1829.  
  1830. proc something()
  1831.    integer breakset=set(break,on)
  1832.          .....
  1833.          .....
  1834.       your routine
  1835.          ....
  1836.          ....
  1837.     set(break,breakset)
  1838. end
  1839.  
  1840.    You can now use <CTRL BREAK> to stop the running macro.
  1841. //*************************************************************************
  1842.   Using BREAK to stop an runaway TSE macro       Wednesday -  July 14, 1993
  1843. //*************************************************************************
  1844.  
  1845. ===========================================================================
  1846.                     Date: 07-11-93  From: RAY ASBURY
  1847.                             Subj: TSE hooks
  1848. ---------------------------------------------------------------------------
  1849.  
  1850. There is also a very round about way of doing this via the Hook()
  1851. command, but I'm not even going to think I could explain it fully.  The
  1852. idea is to Hook() a macro in TSE.S just before calling an external
  1853. macro.  Then, anytime you wanted to execute a macro in TSE.S, just cause
  1854. the Hook()'d condition to occur.  For example, in TSE.S,
  1855.  
  1856.     CONSTANT INCREMENTAL_SEARCH_MACRO = 1, CURRENT_EXT_MACRO = 2 // etc.
  1857.  
  1858.     PROC mCallExtMacro()
  1859.         Hook(_ON_CHANGING_FILES_, mCallTSEDotSMacro)
  1860.         ExecMacro("ExtMacro")
  1861.         Hook(_ON_CHANGING_FILES_, YourUsualHookedMacro)
  1862.     END
  1863.  
  1864.     PROC mCallTSEDotSMacro()
  1865.         CASE GetGlobalInt("gTseDotSMacroToRun")
  1866.             WHEN INCREMENTAL_SEARCH_MACRO
  1867.                 mIncrementalSearch()
  1868.             WHEN CURRENT_EXT_MACRO
  1869.                 mCurrExt()
  1870.         ENDCASE
  1871.     END
  1872.  
  1873. Then, your external macro could simply do something like
  1874.  
  1875.     CONSTANT INCREMENTAL_SEARCH_MACRO = 1, CURRENT_EXT_MACRO = 2 // etc.
  1876.  
  1877.     SetGlobalInt("gTseDotSMacroToRun", INCREMENTAL_SEARCH_MACRO)
  1878.     EditFile(CurrFileName())
  1879.  
  1880. Ta-da!!  You just called a TSE.S macro from inside an external macro!  I
  1881. know, it's not very clean, but it does work. <G>
  1882. //*************************************************************************
  1883.   Utilizing hooks                                Wednesday -  July 14, 1993
  1884. //*************************************************************************
  1885.  
  1886. ===========================================================================
  1887.                    Date: 07-15-93  From: DAVID MARCUS
  1888.                            Subj: NameClip Fix
  1889. ---------------------------------------------------------------------------
  1890. The following is a fix to a bug in NameClip that was causing the
  1891. UnMarkAfterCopy switch to not work.  The changes are in the proc named
  1892. Clipboard, which begins at about line 310 in nameclip.s.
  1893.  
  1894. 1. Find these lines:
  1895.  
  1896.     UMAP = set(UnMarkAfterPaste,FALSE)
  1897.     if UMAP
  1898.           PushBlock()
  1899.     endif
  1900.  
  1901. Change to:
  1902.  
  1903.     if operation == PASTE_APPEND or operation == PASTE_OVERWRITE
  1904.           UMAP = set(UnMarkAfterPaste,FALSE)
  1905.           if UMAP
  1906.                PushBlock()
  1907.           endif
  1908.     endif
  1909.  
  1910. 2. Find these lines:
  1911.  
  1912.     if UMAP
  1913.          PopBlock()
  1914.     endif
  1915.     set(UnMarkAfterPaste,UMAP)
  1916.  
  1917. Change them to:
  1918.  
  1919.     if operation == PASTE_APPEND or operation == PASTE_OVERWRITE
  1920.         if UMAP
  1921.                PopBlock()
  1922.           endif
  1923.           set(UnMarkAfterPaste,UMAP)
  1924.      endif
  1925.  
  1926. This will be incorporated into the next version of NameClip, but I
  1927. wanted to send them now to avoid any frutration. As far as I know they
  1928. only affect UnMarkAfterCopy.
  1929.  
  1930. //*************************************************************************
  1931.   TSE 'nameclip.s' fix to umark block after copy                   07/16/93
  1932. //*************************************************************************
  1933.  
  1934. ===========================================================================
  1935.                    Date: 07-15-93  From: DAVID MARCUS
  1936.                  Subj: NameClip() Same Fix as above???
  1937. ---------------------------------------------------------------------------
  1938.  
  1939. I've found the reason that the UnMarkAfterCopy after failing ... it
  1940. was a poor implementation of my UnMarkAfterPaste switch. You can fix
  1941. it yourself by changing the following in your code. Both of these
  1942. examples are in the proc Clipboard(), which begins at line 1826 in the
  1943. file you sent me.
  1944.  
  1945. 1. Go to line 1892 and add this line _after_ it:
  1946.  
  1947.      endif
  1948.  
  1949. 2. Go to line 1888 and add these two lines _after_ it:
  1950.  
  1951.     if operation == PASTE_APPEND or
  1952.        operation == PASTE_OVERWRITE
  1953.  
  1954. The result is:
  1955.  
  1956.     if operation == PASTE_APPEND or
  1957.        operation == PASTE_OVERWRITE
  1958.     if UMAP
  1959.           PopBlock()
  1960.     endif
  1961.     set(UnMarkAfterPaste,UMAP)
  1962.  
  1963. 3. Go to line 1847 and add this line _after_ it:
  1964.  
  1965.      endif
  1966.  
  1967. 4. Go to line 1843 and add these two lines _after_ it:
  1968.  
  1969. btw, Line 1558 was still missing the  terminating /
  1970.  
  1971. Let me know if anything else comes up. I'll be getting this fix to the
  1972. copy on the BBS soonish.
  1973.  
  1974. =d=
  1975.  
  1976.     if operation == PASTE_APPEND or
  1977.        operation == PASTE_OVERWRITE
  1978.  
  1979. The result is:
  1980.  
  1981.     if operation == PASTE_APPEND or
  1982.        operation == PASTE_OVERWRITE
  1983.     UMAP = set(UnMarkAfterPaste,FALSE)  // This allows us our choice
  1984.     if UMAP                             // of beg/end block after paste
  1985.           PushBlock()
  1986.     endif
  1987.     endif
  1988.  
  1989. //*************************************************************************
  1990.   TSE unmark block after copy. Could be the same as previous.      07/16/93
  1991. //*************************************************************************
  1992.  
  1993. ===========================================================================
  1994.                   Date: 07-24-93  From: SAMMY MITCHELL
  1995.                         Subj: FIND PASTED STRING
  1996. ---------------------------------------------------------------------------
  1997.  
  1998. I'll do my best to try to explain the concepts behind what is going on
  1999. (and maybe even why!).
  2000.  
  2001. First, lets look at the goals.  Do you want to
  2002. a> mark the string, cut it, and then run the macro (3 steps) or
  2003. b> mark the string, and run the macro (2 steps)
  2004.  
  2005. In designing TSE, we felt like b> was what users wanted to do most of
  2006. the time, so we proceeded accordingly.
  2007.  
  2008. QEdit, because of its simple-minded scripting capability, enticed users
  2009. to do a> (even though b> could have been done in QEdit, it wasn't quite
  2010. a straight forward, and as reliable).
  2011.  
  2012. In TSE, you can _interactively_ copy a marked string into a prompt via
  2013. the CopyBlock command (you could _not_ do this in QEdit - you _had_ to
  2014. first copy/cut it to the Clipboard), or a string in the Clipboard via
  2015. the Paste command.
  2016.  
  2017. In macros, things are a little different.  In TSE, built-in
  2018. commands/functions take either integer or string input.  And TSE has
  2019. macro-oriented commands to extract strings (and string blocks) from the
  2020. currently edited file.  These commands are GetText, and GetMarkedText.
  2021. For example, in a macro, to find the next occurrence of the currently
  2022. marked string:
  2023.  
  2024.     lFind(GetMarkedText(), "")
  2025.  
  2026. And TSE commands return either a string or an integer.  For example, the
  2027. Paste command, pastes the Clipboard contents at the current position,
  2028. whether it be a file or a prompt.  However, the Paste command returns an
  2029. integer, indicating whether the operation was successful or not.
  2030.  
  2031. I hope this helps explain some of the concepts!  Now on to your specific
  2032. problem,  "How to get a string out of the Clipboard, for use in a macro".
  2033.  
  2034.  
  2035. /**********************************************************************
  2036.   Macro to get a string from the Clipboard.  The current contents of
  2037.   the Clipboard are unchanged.
  2038.  
  2039.   Returns only the first line of the text in the Clipboard.
  2040.  
  2041.   Notes:  We could use PushPosition/PopPosition in lieu of GotoBufferId;
  2042.   however, this could produce side-effects (the 'hook' functions), so
  2043.   just to be save, we use the latter.
  2044.  **********************************************************************/
  2045. string proc ClipBoard2String()
  2046.     integer id = GetBufferId()          // save where we're at
  2047.     string s[80]
  2048.  
  2049.     GotoBufferId(GetClipBoardId())      // switch to clipboard
  2050.     s = GetText(1, sizeof(s))
  2051.     GotoBufferId(id)                    // and return to previous file
  2052.     return (s)                          // return string to caller
  2053. end
  2054.  
  2055. proc DelSaved()
  2056.     lFind(ClipBoard2String(), "")
  2057.     DelLine()
  2058. end
  2059.  
  2060. <alt f6>DelSaved()
  2061.  
  2062. Of course, you might want to add just a little error checking to your
  2063. DelSaved routine, to keep from inadvertently deleting lines, in case you
  2064. forget to place something in the ClipBoard in the first place, or no
  2065. further occurrences of the string are found.
  2066.  
  2067. proc DelSaved()
  2068.     string s[80] = ClipBoard2String()
  2069.  
  2070.     if Length(s) <> 0
  2071.         if lFind(s, "")
  2072.             DelLine()
  2073.         else
  2074.             Message(s, " not found...")
  2075.         endif
  2076.     else
  2077.         Warn("Clipboard empty")
  2078.     endif
  2079. end
  2080.  
  2081.  
  2082. And now, after all that, here is something I've been using to do things
  2083. with strings - find and delete them, copy or cut them to the Clipboard.
  2084. I hope you can make use of it too!
  2085.  
  2086. To use it, assign mFindAndDo() to a key (or place it under the Search
  2087. menu like I did - I've replaced the 'Count' function with it, since it
  2088. can also 'count' occurrences of a string).  Now, either place your
  2089. string in the Clipboard, or just mark it.  Execute FindAndDo, and you'll
  2090. have the option of counting, deleting, copying/cutting all lines that
  2091. contain the requested string.  You'll get a find prompt; just either
  2092. type the string in, or press CopyBlock or Paste to get a saved one.
  2093.  
  2094. Anyway, hope this is of interest:
  2095.  
  2096.  
  2097. /***********************************************************************
  2098.   Find and do.
  2099.  
  2100.   Applies one of several options to a found string.
  2101.  ***********************************************************************/
  2102. constant
  2103.     dofCOUNT = 1, dofDELLINE = 2, dofCUTAPPEND = 3, dofCOPYAPPEND = 4
  2104.  
  2105. menu FindAndDoMenu()
  2106.     History
  2107.     Title = "After Find do"
  2108.  
  2109.     "Cou&nt"
  2110.     "&Delete Line"
  2111.     "C&ut Append"
  2112.     "&Copy Append"
  2113. end
  2114.  
  2115. proc mFindAndDo()
  2116.     integer choice, curr_id, count, n, old_sound
  2117.     string find_st[65] = '', find_option_st[12] = ''
  2118.  
  2119.     curr_id = GetBufferId()
  2120.     choice = FindAndDoMenu()
  2121.     case choice
  2122.         when 0
  2123.             return ()
  2124.         when dofCUTAPPEND, dofCOPYAPPEND    // cut/copy to buffer
  2125.             GotoBufferId(GetClipBoardId())
  2126.             EmptyBuffer()
  2127.             GotoBufferId(curr_id)
  2128.     endcase
  2129.     count = 0
  2130.     PushPosition()
  2131.     if Ask("Search for:", find_st, _FIND_HISTORY_) and Ask("Options [BGLIWX]
  2132. (Back Global Local Ignore-case Words reg-eXp):", find_option_st,
  2133. _FIND_OPTIONS_HISTORY_) and lFind(find_st, find_option_st)
  2134.         old_sound = Set(sound, off)
  2135.         repeat
  2136.             count = count + 1
  2137.             n = NumLines()
  2138.             case choice
  2139.                 when dofDELLINE
  2140.                     DelLine()
  2141.                 when dofCUTAPPEND, dofCOPYAPPEND
  2142.                     PushBlock()
  2143.                     MarkLine()
  2144.                     MarkLine()
  2145.                     if choice == dofCUTAPPEND
  2146.                         Cut(_APPEND_)
  2147.                     else
  2148.                         Copy(_APPEND_)
  2149.                     endif
  2150.                     PopBlock()
  2151.             endcase
  2152.             if NumLines() < n
  2153.                 BegLine()
  2154.                 PrevChar()
  2155.             endif
  2156.         until not lRepeatFind()
  2157.         Set(sound, old_sound)
  2158.     endif
  2159.     PopPosition()
  2160.     Message(count, " occurrences found")
  2161. end
  2162. //*************************************************************************
  2163.   TSE find pasted string explanation by Sammy Mitchel              07/25/93
  2164. //*************************************************************************
  2165.  
  2166. ===========================================================================
  2167.                   Date: 07-24-93  From: SAMMY MITCHELL
  2168.  
  2169. ---------------------------------------------------------------------------
  2170.  
  2171. Did you know you can have the statusline on the bottom and the help line
  2172. on the top?  But anyway, as for the 'toggle help/statusline on/off':
  2173.  
  2174. <f1> // Toggles between statusline/helpline on bottom of screen
  2175.     if Query(ShowStatusLine)
  2176.         Set(StatuslineAtTop, ON)
  2177.         Set(ShowStatusLine, OFF)
  2178.         Set(ShowHelpLine, ON)
  2179.     else
  2180.         Set(StatusLineAtTop, OFF)
  2181.         Set(ShowStatusLine, ON)
  2182.         Set(ShowHelpLine, OFF)
  2183.     endif
  2184.     UpdateDisplay()
  2185.  
  2186. //*************************************************************************
  2187.   Toggling statusline/helpline ON-OFF                             07/25/93
  2188. //*************************************************************************
  2189.  
  2190. ===========================================================================
  2191.                    Date: 07-25-93  From: DAVID MARCUS
  2192.  
  2193.                Subj: rePos(), reSubStr(), rePlaceChars()
  2194. ---------------------------------------------------------------------------
  2195.  
  2196. One of the occasional frustrations in TSElife for me has been that I
  2197. cannot use regular expressions in the Pos() and SubString() commands.
  2198.  
  2199. Being that my wife is out of town for a fortnight, we now can use
  2200. these. I've developed three macros that I am uploading in subsequent
  2201. messages:
  2202.  
  2203.        rePos() : Returns the start position of 'needle' within
  2204.                  'haystack,' using regular expression search
  2205.                  and any additional specified search s and replace
  2206.                  options.
  2207.  
  2208.     reSubStr() : Returns the string matching regular expression
  2209.                  'needle' from within string 'haystack', using options
  2210.                  specified (if any).
  2211.  
  2212. rePlaceChars() : Returns a string calculated by taking string
  2213.                  'haystack' and replacing string 'needle' with string
  2214.                  'thread', using regular expression search and any
  2215.                  specified options. This 12-line proc can also be used
  2216.                  to:
  2217.                  * delete needle from haystack
  2218.                  * trim all spaces from the beginning or end of a string
  2219.                  * insert one string into another at a specified
  2220.                    position.
  2221.                  * do multiple replaces within the string (argument
  2222.                    specifies how many, or all)
  2223.                  * do multiple deletes within the string (argument
  2224.                    specifies how many, or all)
  2225.  
  2226. Please let me know any problems with these, or ways that they can be
  2227. enhanced to make them more useful for you!
  2228.  
  2229. ===========================================================================
  2230.                              Subj: rePos()
  2231. ---------------------------------------------------------------------------
  2232.  
  2233. /**************************************************************************
  2234.      rePos() : Returns the start position of 'needle' within
  2235.                'haystack,' using regular expression search and any
  2236.                additional specified search and replace options.
  2237.  
  2238.                Examples:
  2239.  
  2240.                     n = rePos(last_name, full_name, 'i')
  2241.  
  2242.                     if rePos('M[r]?s.', full_name, '^i')
  2243.                          sex = 'F'
  2244.                     endif
  2245.  
  2246.                     (last_name and full_name are two strings in your
  2247.                      proc.)
  2248.  
  2249.                Returns 0 (FALSE) if not found.
  2250.  
  2251.  *************************************************************************/
  2252.  
  2253. integer proc rePos(STRING needle, STRING haystack, STRING options)
  2254.      integer bid = CreateTempBuffer(),
  2255.              location = 0
  2256.      AddLine(haystack)
  2257.      if lfind(needle, options + 'x')
  2258.           location = CurrPos()
  2259.      endif
  2260.      AbandonFile(bid)
  2261.      Return(location)
  2262. end
  2263.  
  2264. ---
  2265. ===========================================================================
  2266.                           Subj: reSubString()
  2267. ---------------------------------------------------------------------------
  2268. /********************************************************************
  2269.  reSubStr() : Returns the string matching regular expression 'needle'
  2270.               from within string 'haystack', using any additional
  2271.               search/replace options specified (if any).
  2272.  
  2273.               Returns '' (empty string) if not found.
  2274.  
  2275.               Example:
  2276.                     title =  rePos('[DM][r]?[s]?\.', full_name, '^')
  2277.               Returns
  2278.                     Dr.  Mr.  Mrs.  Ms.
  2279.                     Title is equal to any of these if they are at the
  2280.                     beginning of full_name.
  2281.  
  2282.  
  2283.  
  2284. **************************************************************************/
  2285. string  proc reSubStr(STRING needle, STRING haystack, STRING options)
  2286.      integer
  2287.           bid = CreateTempBuffer()
  2288.      string
  2289.           s[255] = ''
  2290.      PushBlock()
  2291.      UnMarkBlock()
  2292.      AddLine(haystack)
  2293.      if lfind(needle, options + 'x')
  2294.           MarkChar()
  2295.           BegLine()
  2296.           if lfind(needle + '\c', options + 'x')
  2297.                MarkChar()
  2298.                s = GetMarkedText()
  2299.           else
  2300.                s = ''
  2301.           endif
  2302.      endif
  2303.      AbandonFile(bid)
  2304.      PopBlock()
  2305.      Return(s)
  2306. end
  2307.  
  2308. ---
  2309. ===========================================================================
  2310.                           Subj: rePlaceChars()
  2311. ---------------------------------------------------------------------------
  2312. /**************************************************************************
  2313. rePlaceChars()
  2314.  
  2315. NOTE: 12 lines--80 bytes compiled--possibly the most useful and
  2316.       versatile single proc I've ever written.
  2317.  
  2318. Returns a string calculated by taking string 'haystack' and replacing
  2319. string 'needle' with string 'thread' using regular expression search
  2320. and any specified options. Returns haystack (unchanged) if no find
  2321. occurs. Example:
  2322.  
  2323.      full_name = rePlaceChars( first_name,    // find this
  2324.                                full_name,     // in this
  2325.                                initial,       // replace with this
  2326.                                'wi')          // using these opts
  2327.  
  2328. Use of ^ and $ in options allows this to be used to delete a string
  2329. [of spaces or text] from the start or end. To trim all spaces from
  2330. the end of a string, for instance:
  2331.  
  2332.      old_str = rePlaceChars( ' #',      // 1 or more spaces
  2333.                              old_str,
  2334.                              '',        // replaced with ;;
  2335.                              '^' )      // beginning
  2336.  
  2337. To trim them from the end of the string replace '^' with '$', above.
  2338. To trim them from both the beginning and the end:
  2339.  
  2340.      old_str = rePlaceChars( '{^ #}|{ #$}',  // see your manual
  2341.                              old_str,
  2342.                              '',
  2343.                              '2' )           // must allow 2 replaces
  2344.  
  2345. You can use rePlaceChars to insert a string into the middle of another
  2346. at aspecified position. For instance:
  2347.  
  2348.      old_str = rePlaceChars(
  2349.                               Format( '' : 5 :'.' ),  // 5 = insert pos
  2350.                               old_str,                // string input
  2351.                               '\0' + ins_str,
  2352.                               ''                      // no special opts
  2353.                             )
  2354.  
  2355. To place it 5 chars before the END of old_str, change '' to '$'.
  2356.  
  2357. Finally, you can use a number as part of option string to have that
  2358. nunber of occurrences of needle replaced by thread (if it occurs > 1
  2359. time).  Use 0 to mean 'replace all occurrences'.
  2360.  
  2361.      old_str = rePlaceChars(
  2362.                               ' ',               // space
  2363.                               old_str,           // string input
  2364.                               ''                 // no replace
  2365.                               '12'               // number of times
  2366.                             )
  2367. This deletes the first 12 spaces anywhere in the string.
  2368. **************************************************************************/
  2369. string  proc rePlaceChars(STRING needle, STRING haystack,
  2370.                           STRING thread, STRING options)
  2371.      integer
  2372.           bid = CreateTempBuffer()
  2373.      string
  2374.           s[255] = ''
  2375.      AddLine(haystack)
  2376.      lreplace(needle, thread, options + 'xn1')
  2377.      s = GetText(1,CurrLineLen())
  2378.      AbandonFile(bid)
  2379.      Return(s)
  2380. end
  2381. ---
  2382. //*************************************************************************
  2383.              rePos(), reSubStr(), rePlaceChars()  07/26/93
  2384. //*************************************************************************
  2385.  
  2386. ===========================================================================
  2387.                    Date: 07-20-93  From: BOB CAMPBELL
  2388.               Subj: Deleting Blank Lines macro DelBlank()
  2389. ---------------------------------------------------------------------------
  2390. /**************************************************************************
  2391.  Written by Bob Campbell 5/8/93
  2392.  DelBlank.mac deletes all blank lines saving only one blank
  2393.  between paragraphs.  Printer FormFeeds will be converted
  2394.  to an extra blank line.
  2395.  
  2396.  Usage:  ExecMacro("DelBlank")
  2397.  **************************************************************************/
  2398.  
  2399. integer Proc mIsParaEnd()
  2400.    integer  CurLine,  NextLine
  2401.        CurLine = CurrLineLen()
  2402.        Down()
  2403.        NextLine = CurrLineLen()
  2404.        Up()
  2405.        If Curline >= 1 and NextLine == 0
  2406.            Return (TRUE)           // And return success
  2407.        Endif
  2408.            Return (FALSE)          // And return false
  2409. end
  2410.  
  2411. proc mDelBlanks()
  2412.     if  CurrLineLen() >= 1
  2413.         if mIsParaEnd()
  2414.            Down(2)
  2415.         else
  2416.            Down()
  2417.         Endif
  2418.     else
  2419.         DelLine()
  2420.     Endif
  2421. end
  2422.  
  2423. proc Main()
  2424.     string x[1], y[1], z[2]
  2425.      x=" "        // Form feed
  2426.      y=" "        // Replacement for form feed characters
  2427.      z="gn"       // Start search at file beginning, do not confirm
  2428.     BegFile()
  2429.     while Down()
  2430.        up()
  2431.        mDelBlanks()
  2432.     endwhile
  2433.     Replace(x,y,z)  // Replace form feeds with spaces
  2434. end
  2435.  
  2436. //*************************************************************************
  2437.                     DelBlank()             07/26/93
  2438. //*************************************************************************
  2439.  
  2440. ===========================================================================
  2441.                    Date: 07-23-93  From: IAN CAMPBELL
  2442.                       Subj: mListOpenFiles changes
  2443. ---------------------------------------------------------------------------
  2444.  
  2445. PreScript:  08/08/93:  TAK a complete macro with even more changes is
  2446.                        available as 'a:\listopen.s' on TSE[2]
  2447.  
  2448. Here's a little macro change for TSE.S that you might be interested in
  2449. incorporating into your copy of the editor.
  2450.  
  2451. Did you ever notice that when you bring up TSE's buffer list (default
  2452. keystroke = <Alt 0>) that it just displays all of the files in the
  2453. same order that they exist in the ring, with the current file on the
  2454. top of the list?
  2455.  
  2456. This makes finding things a bit TEDIOUS, particularly when you have a
  2457. lot of files open, since files tend to MOVE AROUND as new ones are
  2458. brought to the "top of the list".
  2459.  
  2460. Now, there is no way to change the order of the files within the ring,
  2461. but it is fairly simple to sort the files just before displaying them
  2462. in the picklist.  The beauty of this approach is that all files within
  2463. a group will ALWAYS be displayed identically, with the same files in
  2464. the same position each time.  This makes finding a file in a large
  2465. group MUCH simpler.
  2466.  
  2467. Heres how to do it:
  2468.  
  2469. In your "TSE.S" file locate the macro mListOpenFiles().  Add a new
  2470. string definition "string fnOrg[65] = CurrFilename()" just below the
  2471. "string fn[65]" definition.
  2472.  
  2473. Find the following two lines in the macro (somewhere near the bottom
  2474. of the macro):
  2475.  
  2476.     GotoBufferID(filelist)
  2477.     BegFile()
  2478.  
  2479. Replace these two lines with the following lines:
  2480.  
  2481.     GotoBufferID(filelist)      // go to the buffer with the filenames
  2482.     PushBlock()                 // save old marking information that might
  2483. exist
  2484.     UnMarkBlock()               // turn off any old marking if it exists
  2485.     BegFile()                   // start at the beginning of the file
  2486.     Right()                     // skip the * field for the column mark
  2487.     MarkColumn()                // start marking a column
  2488.     EndFile()                   // go the the end of the file
  2489.     GotoColumn(79)              // get entire drive/pathname in column mark
  2490.     MarkColumn()                // mark the end of the column
  2491.     Sort()                      // sort the lines based on the columns marked
  2492.     PopBlock()                  // put back any old marking that might exist
  2493.     lFind(fnOrg, "B")           // cursor to original file (search backwards)
  2494.     GotoBufferID(start_file)    // back to the original file for a screen
  2495. update
  2496.     UpdateDisplay()             // update the screen now
  2497.     GotoBufferID(filelist)      // back to the file list with all the
  2498. filenames
  2499.  
  2500. Voila!  An alphabetically sorted picklist, with the current file
  2501. hilited!  If you're working with a lot of open files, and you
  2502. frequently switch between them to using mListOpenFiles(), then you
  2503. will probably LOVE this change!
  2504.  
  2505. //*************************************************************************
  2506. //  Changes to mListOpenFiles() to sort the open files buffer        07/26/93
  2507.  
  2508. //  PostScript:  08/08/93:  TAK a complete macro with even more changes is
  2509. //                          available as 'a:\listopen.s' on TSE[2]
  2510. //*************************************************************************
  2511.  
  2512.  
  2513. ===========================================================================
  2514.                    Date: 07-27-93  From: DAVID MARCUS
  2515.                              Subj: reLength
  2516. ---------------------------------------------------------------------------
  2517. Here are two more commands to let you use regular expression syntax
  2518. more widely. These are based on and require the reSubStr() command I
  2519. uploaded in a message yesterday.
  2520.  
  2521. Enjoy.
  2522.  
  2523. =d=
  2524.  
  2525. /**************************************************************************
  2526.    reLength(): Returns the length of 'needle' within  'haystack,'
  2527.                using regular expression search and any additional specified
  2528.                search and replace options. Examples:
  2529.                     n = reLength(last_name, full_name, 'i')
  2530.                where last_name and full_name are two strings in your proc.
  2531.  
  2532.                Returns 0 (FALSE) if not found.
  2533.                                            Copyright: (c) 1993 David Marcus
  2534.  **************************************************************************/
  2535.  
  2536. integer proc reLength(STRING needle,
  2537.                       STRING haystack,
  2538.                       STRING options)
  2539.      return(Length(reSubStr(needle, haystack, options)))
  2540. end
  2541.  
  2542. /********************************************************************
  2543.  reGetText(): Returns the string matching regular expression 'needle'
  2544.               from within the current line, using any additional
  2545.               search/replace options specified (if any). Example:
  2546.  
  2547.                     title =  '[DM][r]?[s]?\.'
  2548.                     reGetText(title,         // search for
  2549.                               30,            // starting at
  2550.                               4,             // for up to 4 chars
  2551.                               '^')           // must be at begining
  2552.                                              // i.e., col 30
  2553.               Returns
  2554.                     Dr.  Mr.  Mrs.  Ms. D. M. Drs.
  2555.                     (Title is equal to any of these if they begin at
  2556.                      position 30. 4 is the max length I think might
  2557.                      be found.)
  2558.  
  2559.                Returns '' (empty string) if not found.
  2560.                                       Copyright: (c) 1993 David Marcus
  2561. **********************************************************************/
  2562.  
  2563. string  proc reGetText(STRING needle,
  2564.                        INTEGER start_point,
  2565.                        INTEGER str_length,
  2566.                        STRING options)
  2567.      return(reSubStr(needle, GetText(start_point,str_length), options))
  2568. end
  2569. //*************************************************************************
  2570.                           reLength()  07/27/93
  2571. //*************************************************************************
  2572.  
  2573. ===========================================================================
  2574.                 Date: 07-28-93  From: RICHARD HENDRICKS
  2575.                      Subj: Line Drawing with MOUSE
  2576. ---------------------------------------------------------------------------
  2577.  
  2578. // DRAW.S  11/20/1992  01/28/1993
  2579. // by Richard Hendricks
  2580.  
  2581. // Press a key or click the mouse to stop drawing
  2582.  
  2583. proc Main()
  2584.   integer x, xl, y, yl
  2585.   integer vert, horiz
  2586.  
  2587.   LineTypeMenu() // select the desired line type
  2588.  
  2589.   GoToMouseCursor() // get mouse and text cursor together
  2590.   MouseStatus()     // make current and last values the same
  2591.   MouseStatus()
  2592.  
  2593.   xl = query( MouseX )
  2594.   yl = query( MouseY )
  2595.  
  2596.   repeat
  2597.     if WaitForMouseEvent( _Mouse_Move_ )
  2598.       MouseStatus()
  2599.  
  2600.       x  = query( MouseX )
  2601. //    xl = query( LastMouseX )   // removed in .65
  2602.       y  = query( MouseY )
  2603. //    yl = query( LastMouseY )   // removed in .65
  2604.  
  2605.       if y <> yl
  2606.         vert = abs(y - yl)
  2607.         if y < yl
  2608.           repeat
  2609.             vert = vert - 1
  2610.             LineDraw(_up_)
  2611.           until not vert
  2612.         else
  2613.           repeat
  2614.             vert = vert - 1
  2615.             LineDraw(_down_)
  2616.           until not vert
  2617.         endif
  2618.       endif
  2619.  
  2620.       if x <> xl
  2621.         horiz = abs(x - xl)
  2622.         if x < xl
  2623.           repeat
  2624.             horiz = horiz - 1
  2625.             LineDraw(_left_)
  2626.           until not horiz
  2627.         else
  2628.           repeat
  2629.             horiz = horiz - 1
  2630.             LineDraw(_right_)
  2631.           until not horiz
  2632.         endif
  2633.       endif
  2634.       GoToMouseCursor() // get mouse and text cursor together
  2635.       xl = x  // query( LastMouseX )  -- 01/28/1993
  2636.       yl = y  // query( LastMouseY )  -- 01/28/1993
  2637.     endif
  2638.   until keypressed()
  2639. end Main
  2640.  
  2641. //*************************************************************************
  2642. //END of TSE macro DRAW.S to line draw with the MOUSE              07/28/93
  2643. //*************************************************************************
  2644.  
  2645. ===========================================================================
  2646.                     Date: 07-30-93  From: RAY ASBURY
  2647.                     Subj: Alternate keyboards in TS
  2648. ---------------------------------------------------------------------------
  2649. Hi Dave,
  2650.  
  2651. ┌───<<< DAVE BACHMANN >>>─────────────────────────────────────────────┐
  2652. │Am I trying to do something that can't be done?  Do I have to burn-in│
  2653. │2 separate versions of TSE and rename one?  Any suggestions will be  │
  2654. │gratefully accepted.                                                 │
  2655. └───>>> ALL <<<───────────────────────────────────────────────────────┘
  2656.  
  2657. It can be done and it won't require two versions.  Keep you 'normal'
  2658. setup as it is.  Then, create a macro file similar to the following:
  2659.  
  2660.     HELP EmulateHelp            // JUST AN EXAMPLE
  2661.         "This is my emulator"
  2662.     END EmulateHelp
  2663.  
  2664.     // IF ANY OF THE KEYS IN EmulateKeys (BELOW) HAVE MACROS ASSIGNED TO
  2665.     THEM, PUT THEM HERE.
  2666.  
  2667.     KEYDEF EmulateKeys
  2668.  
  2669.         // PUT YOUR KEY ASSIGNMENTS HERE, SUCH AS
  2670.  
  2671.         <F1>                Help(EmulateHelp)
  2672.  
  2673.     END EmulateKeys
  2674.  
  2675.     PROC Main()
  2676.         Enable(EmulateKeys, _EXCLUSIVE_) // THIS "TURNS ON" THE KEYS IN
  2677.                                          // EmulateHelp, AND "TURNS OFF"
  2678.                                          // ALL OTHER ASSIGNABLE KEYS
  2679.     END Main
  2680.  
  2681. Save this file (such as emulate.s) and compile it with "SC EMULATE".
  2682. (Be sure to put it in the same directory as E.EXE or in the directory
  2683. you have MacPath set to).
  2684.  
  2685. Now, just use a command similar to "E <file(s) to edit> /Eemulate", and
  2686. viola, you now have a different version of TSE!!
  2687.  
  2688. "Buddy" E. Ray Asbury, Jr.
  2689. Team TSE
  2690. //*************************************************************************
  2691.   EmulateKeys suggestions for multiple key assignments             07/31/93
  2692. //*************************************************************************
  2693.  
  2694. ===========================================================================
  2695.                 Date: 08-04-93  From: RICHARD BLACKBURN
  2696.                      Subj: mouse programming source
  2697. ---------------------------------------------------------------------------
  2698.  
  2699. What are you wanting to do with the mouse?  Here is an example of making
  2700. the HelpLine mousable:
  2701.  
  2702.     You can add mouse support to the HelpLine with macros.  The following
  2703.     macro will add mouse support for the default HelpLine in TSE.  You
  2704.     should be able to modify this to work with your HelpLine.
  2705.  
  2706.     /***********************************************************************
  2707.       This procedure when tied to the <LeftBtn> will work like the default
  2708.       TSE, with the exception that if you click on the help line, it will
  2709.       process the command in the associated location.
  2710.     ***********************************************************************/
  2711.     proc LeftBtn()
  2712.         if NOT ProcessHotSpot()
  2713.     end
  2714. //*************************************************************************
  2715.  
  2716. ===========================================================================
  2717.                    Date: 08-04-93  From: BOB CAMPBELL
  2718.                      Subj: Obscure forgotten Macros
  2719. ---------------------------------------------------------------------------
  2720. If  you're  like  me  you have macros assigned to  keys  that  you  have
  2721. forgotten. I've got lots of these handy little macros that are so seldom
  2722. used that I've found the only way to recall them is from a Menu.
  2723.  
  2724. But  that circumvents the quick intuitive response of TSE.  For  example
  2725. I've  got a macro that deletes to the beginning of the line.  This is  a
  2726. dangerous  type  of macro to have assigned to a key in the  first  place
  2727. ,especially if you forget what that key does, but since I may find a use
  2728. for  it  I  keep it available.  Trouble is it's too  cumbersome  to  run
  2729. through the menus if I what to use it repeatedly.
  2730.  
  2731. So  here's my solution.  mRepeatMenuOption replays the last menu  option
  2732. with  the push of one key.  Simply use it once and then recall it  overe
  2733. and over with this hotkey.
  2734.  
  2735. proc mRepeatMenuOption()
  2736.     pushkey(<Enter>)   // pushes the menu option when mainmenu() is called
  2737.     pushkey(<Enter>)
  2738.     MainMenu()
  2739. end
  2740.  
  2741. <F12> mRepeatMenuOption()
  2742.  
  2743. Now I can keep all my obscure functions available with descriptions by menu
  2744. and still be able to repeat the command quickly.
  2745.  
  2746. When I first began adding features to my TSE I would simply add them to my
  2747. source file and assign a key, but the EXE file finally got too big to
  2748. compile and I ran out of keys.  Using this method allows me to run most of
  2749. my macro externally, thereby keeping the .EXE program size down to a
  2750. reasonable size.
  2751.  
  2752. The use of the MainMenu() is only an example  You might be better off
  2753. making a separate menu.
  2754.  
  2755. Menu ForgottenProcedures()
  2756. ...
  2757. end
  2758.  
  2759. //*************************************************************************
  2760.   mRepeatMenuOption macro                                          08/07/93
  2761. //*************************************************************************
  2762.  
  2763. ===========================================================================
  2764.                 Date: 08-09-93  From: RICHARD BLACKBURN
  2765.             Subj: Save Changes / Lose Changes prompt change
  2766. ---------------------------------------------------------------------------
  2767. Thanks for the suggestion of changing the QuitFile() menu prompt.  We had a
  2768. lot of people that had requested the prompt changed to "Save Changes".  You
  2769. could use a macro to change the prompt to "Lose Changes".
  2770.  
  2771. integer proc mPQuit()
  2772.     if NumFiles() == 0
  2773.         return (AbandonEditor())
  2774.     endif
  2775.     if isChanged()
  2776.         case YesNo( "Lose changes?" )
  2777.             when 0, 3           // Escape or Cancel
  2778.                 return (FALSE)
  2779.             when 2              // No
  2780.                 return (SaveAndQuitFile())
  2781.         endcase                 // Let "Yes" case fall through
  2782.     endif
  2783.     return(iif(NumFiles() == 1, AbandonEditor(), AbandonFile()))
  2784. end
  2785. //*************************************************************************
  2786.   Change QuitFile() prompt from Save Changes to Lose Changes      08/10/93
  2787. //*************************************************************************
  2788.  
  2789. ===========================================================================
  2790.                    Date: 08-08-93  From: MAYNARD HOGG
  2791.                      Subj: Obscure Forgotten Macros
  2792. ---------------------------------------------------------------------------
  2793.  
  2794. BC>I've got a macro that deletes to the beginning of the line. This is a
  2795.   >dangerous type of macro to have assigned to a key in the first place
  2796.  
  2797. Not if you make the macro undoable as the ^Q-Del combination has been
  2798. since WordStar 4!
  2799.  
  2800. proc DelToBol() //reversible!           //M. Hogg 06/09/93
  2801.     if CurrChar() < 0                   // are we past end of line?
  2802.         BegLine()
  2803.         DelToEOL()                      // let the editor do it for us
  2804.     else
  2805.         PushBlock()
  2806.         MarkChar()
  2807.         BegLine()
  2808.         MarkChar()
  2809.         DelBlock()
  2810.         PopBlock()
  2811.     endif
  2812. end
  2813. //*************************************************************************
  2814.   DelToBOL  with the ability to undo                              08/13/93
  2815. //*************************************************************************
  2816.  
  2817. ===========================================================================
  2818.                     Date: 08-12-93  From: MEL HULSE
  2819.                       Subj: Indent a block  in TSE
  2820. ---------------------------------------------------------------------------
  2821.  
  2822. The Tab key and shift tab keys shift a block right and left for me.
  2823.  
  2824. I use the following macros in TSE.S:
  2825.  
  2826. PROC TabBlockLeft()
  2827.  
  2828.     Iif(isCursorInBlock(), mShiftBlock(-(Query(TabWidth))), TabLeft())
  2829. END
  2830.  
  2831. PROC TabBlockRight()
  2832.     Iif(isCursorInBlock(), mShiftBlock(Query(TabWidth)), TabRight())
  2833. END
  2834.  
  2835. proc TabBlockLeft()
  2836. proc TabBlockRight()
  2837.  
  2838.  
  2839. <shift tab>          TabBlockLeft()
  2840. <tab>                TabBlockRight()
  2841.  
  2842. //*************************************************************************
  2843.   Procedures to use TAB for shifting marked blocks                 08/14/93
  2844. //*************************************************************************
  2845.  
  2846. ===========================================================================
  2847.                    Date: 08-15-93  From: DAVID MARCUS
  2848.                       Subj: Video Cursor Position
  2849. ---------------------------------------------------------------------------
  2850. After having a bit of difficulty with how set my video cursor when I
  2851. want video output to be at the current text cursor position, I have come
  2852. up with this formulation, which may be of help to others:
  2853.  
  2854. integer X11, Y11
  2855.  
  2856.           X11 = CurrCol() + Query(WindowX1) -1
  2857.           Y11 = CurrRow() + Query(WindowY1) -1
  2858.           ... do stuff ...
  2859.           GotoXY(X11, Y11)
  2860.  
  2861. This works regardless of numberof windows, whether display is boxed or
  2862. zoomed, and statusline position.
  2863.  
  2864.  
  2865. p.s. - Semware: WhereX() and WhereY() ought to have WindowX1 and WindowY1
  2866.           as 'See Also' references.
  2867. //*************************************************************************
  2868.   Video cursor                                                     08/16/93
  2869. //*************************************************************************
  2870.  
  2871. ===========================================================================
  2872.                   Date: 08-18-93  From: SAMMY MITCHELL
  2873.                      Subj: BLOCK INDENTATION IN TSE
  2874. ---------------------------------------------------------------------------
  2875. JK> I also think QEDIT handled this better than TSE.  If the cursor was in a
  2876. JK> block and you used the tab key, the whole block moved.  You didn't have
  2877. JK> to fuss around with <Ctrl F7>.  Wouldn't it be better to make TSE work
  2878. JK> the same way?
  2879.  
  2880. I have to disagree.  I _much_ prefer the new way.  But, implementing the
  2881. QEdit style is simple: (Note that this routine requires the mShiftBlock
  2882. procedure and associated constants from the TSE.S file.  You can place it in
  2883. TSE.S just after the mShiftBlock procedure, or at the beginning of your
  2884. TSE.KEY file.)
  2885.  
  2886.  
  2887. proc QEditTab(integer direction)
  2888.     if Query(Insert) and isCursorInBlock()
  2889.         mShiftBlock(Query(TabWidth) * direction)
  2890.     else
  2891.         if direction == SHIFTRIGHT
  2892.             TabRight()
  2893.         else
  2894.             TabLeft()
  2895.         endif
  2896.     endif
  2897. end
  2898.  
  2899. <Tab>       QEditTab(SHIFTRIGHT)
  2900. <Shift Tab> QEditTab(SHIFTLEFT)
  2901.  
  2902. //*************************************************************************
  2903. //Block indentation change from default to use ShiftTAB            08/19/93
  2904. //*************************************************************************
  2905.  
  2906. ===========================================================================
  2907.                  Date: 08-18-93  From: GEORGE DE BRUIN
  2908.                         Subj: Feeding keystrokes
  2909. ---------------------------------------------------------------------------
  2910.  From │ FRED BRUCKER
  2911. ┌─────┴─────────────────────────────────
  2912. │If CopyBlock() isn't bound to a key, then how else could it be
  2913. │executed in a dialog box?  I'm lost here.
  2914. └─────┬─────────────────────────────────
  2915.    To │ GEORGE DE BRUIN
  2916.  
  2917. Whoops.  I think I wasn't too clear on this...  Let's try again:
  2918.  
  2919.     <ALT C>     CopyBlock()         // When compiled is seen by TSE as a
  2920.                                     // native command
  2921.  
  2922.     <ALT Z>     CopyBlock(_DEFAULT_)// When compiled is seen by TSE as a
  2923.                                     // macro
  2924.  
  2925. Since <Alt C> is seen as a native command by TSE it works in the prompt
  2926. windows.  However, since <ALT Z> is seen as a macro (not a native
  2927. command) in TSE it does not function in the prompt boxes.
  2928.  
  2929. Does that make things any clearer?
  2930.  
  2931. ┌───────────────────
  2932. │Another dialog box problem:  In QEdit I could "feed" keystrokes to
  2933. │the dialog box with the likes of this:
  2934. │          MacroBegin EditFile DelLine Return 'g'
  2935. │This would bring up the file list at the first file starting with
  2936. │"g".  How can I do this in TSE?
  2937. └───────────────────
  2938.  
  2939. You would use the PushKey() function to "stack" the keystrokes in the
  2940. sequence you want, then call the command.  Something like this:
  2941.  
  2942. proc OpnSrcMnu()
  2943.     Pushkey(<s>) PushKey(<escape>)          // Pull up Search Menu
  2944. end
  2945.  
  2946. Note that the keystrokes must be pushed on the stack in backwards order
  2947. (ie, it is a true stack).
  2948.  
  2949. ┌───────────────────
  2950. │I'm having trouble loading and executing a macro from the command
  2951. │line.  I have this command line:  tse file1 file2 -k -emsgmac.mac.
  2952. │Here's the macro:
  2953. │proc WhenLoaded()
  2954. │    Set(Wordwrap,ON)
  2955. │    HWindow()
  2956. │end
  2957. └───────────────────
  2958.  
  2959. Change it so that it is not a WhenLoaded().  Place it in a Main(), like
  2960. this:
  2961.  
  2962.  
  2963. proc main()
  2964.     Set(WordWrap, ON)
  2965.     HWindow()
  2966. end
  2967.  
  2968. Now it should work.
  2969.  
  2970. OPENING TSE WITH TWO HORIZONTAL WINDOWS IS DISCUSSED IN THE NEXT NOT
  2971. SEE 'Opening TSE with two windows' on 8-20-93.
  2972.  
  2973. //*************************************************************************
  2974. //Feeding keystrokes and much, much more                           08/19/93
  2975. //*************************************************************************
  2976.  
  2977. ===========================================================================
  2978.                    Date: 08-20-93  From: FRED BRUCKER
  2979.                   Subj:  Opening TSE with two windows
  2980. ---------------------------------------------------------------------------
  2981.  
  2982. Well, either I've mis-communicated my split-window-on-startup problem or
  2983. all of you wizards are asleep at the switch. After getting familiar with
  2984. UpdateDisplay() from our earlier discussions, I tried this as my startup
  2985. macro in my mail reader:
  2986.  
  2987. proc WhenLoaded()
  2988.    UpdateDisplay()
  2989.    Set(Wordwrap,ON) HWindow() NextWindow()
  2990. end
  2991.  
  2992. Works like the proverbial charm!  I even like the appearance of the
  2993. boxed windows in this situation. <reeking with shame>
  2994.  
  2995. This macro splits the screen on startup with the original message in
  2996. the upper window and the reply (usually empty, unless a re-reply) in
  2997. the lower.  The two filenames and the macro are supplied on the
  2998. command line.  It switches the active window to the upper so I'm
  2999. ready to get a quote.
  3000.  
  3001. //*************************************************************************
  3002.   Open TSE with two horizontal windows                             08/20/93
  3003. //*************************************************************************
  3004.  
  3005. ===========================================================================
  3006.                    Date: 08-21-93  From: KYLE WATKINS
  3007.                      Subj: VARIABLE TABULATOR INPUT
  3008. ---------------------------------------------------------------------------
  3009.    The following macro will allow you to toggle the variable tab stop at
  3010.    the cursor location.
  3011.  
  3012. /*** START HERE ***/
  3013.  
  3014. integer t_unit, t_bit, vartabset
  3015. string vtab[32], s_unit[1]
  3016.  
  3017. proc ToggleTab()
  3018.     if vartabset
  3019.         s_unit=chr(asc(s_unit)&(~(1 shl t_bit)))
  3020.         vartabset=FALSE
  3021.     else
  3022.         s_unit=chr(asc(s_unit)|(1 shl t_bit))
  3023.         vartabset=TRUE
  3024.     endif
  3025.     vtab=substr(vtab,1,t_unit-1)+s_unit+substr(vtab,t_unit+1,32)
  3026.     set(vartabs,vtab)
  3027. end
  3028.  
  3029.  
  3030. string proc querytab()
  3031.     if currcol() <256
  3032.         t_unit=(currcol()/8)+1    //Get vartab string element
  3033.         t_bit=(currcol() mod 8)   //Get bit of vartab string element
  3034.         vtab=query(vartabs)
  3035.         s_unit=vtab[t_unit]
  3036.  
  3037.         if (asc(s_unit)&(1 shl t_bit))
  3038.             vartabset=TRUE
  3039.             return("_SET_ ")
  3040.         else
  3041.             vartabset=FALSE
  3042.             return("CLEAR ")
  3043.         endif
  3044.     endif
  3045.     return("INVALID")
  3046. end
  3047.  
  3048.  
  3049. menu tabmenu()
  3050.   Title="Variable Tab Toggle"
  3051.   Command=ToggleTab()
  3052.   "Variable Tab is" [querytab()+" at column "+str(currcol()):22]
  3053.                                                      ,,DONTCLOSE
  3054. end
  3055.  
  3056. <f1> tabmenu()   //Example key assignment
  3057.  
  3058. //*************************************************************************
  3059. //Toggle the TAB stop variable                                     08/22/93
  3060. //*************************************************************************
  3061.  
  3062. ===========================================================================
  3063.                  Date: 08-24-93  From: GEORGE DE BRUIN
  3064.                          Subj: KillMax Variable
  3065. ---------------------------------------------------------------------------
  3066.  
  3067. Whoops.  An oversight in the manual...  Right now you can set KillMax in
  3068. the TSE.CFG file.  Right now it can only be set for 0 or non-zero (ie,
  3069. it will go back to the default value).
  3070.  
  3071. Just add a line that says:
  3072.  
  3073.     KillMax         =   0
  3074.  
  3075. to the TSE.CFG file (make sure it is between the Config / EndConfig
  3076. lines.  This will set it so that no kills are added to the buffer.
  3077.  
  3078. If you want to change the value so it is just different (say to 10), add
  3079. the following to the WhenLoaded() proc in TSE.S:
  3080.  
  3081.     set(KillMax, 10)
  3082.  
  3083. //*************************************************************************
  3084. //KillMax Variable                                                 08/25/93
  3085. //*************************************************************************
  3086.  
  3087. ===========================================================================
  3088.                     Date: 08-31-93  From: PAUL LENZ
  3089.                   Subj: Three (3) MARGIN SETING MACROS
  3090. ---------------------------------------------------------------------------
  3091. Here are 3 macros which set margins quickly and easyly.
  3092. They work like WordStar's ctrl-o-r, ctrl-o-l, and ctrl-o-g.
  3093.  
  3094. Paul Lenz
  3095.  
  3096.  
  3097. /*************************************************************************
  3098.  
  3099. MARGIN.S contains:    SetLeftMargin()     sets left margin
  3100.                       SetRightMargin()    sets right margin
  3101.                       MarginFromLine()    sets left and right margins
  3102.                                           dependig of cursor line
  3103.  
  3104. 31.8.1993 by Paul Lenz
  3105.              Friesenstrasse 22
  3106.              30161 Hannover
  3107.              Germany
  3108.  
  3109. *************************************************************************/
  3110.  
  3111.  
  3112. proc SetLeftMargin()
  3113.     string lm[3] = ""
  3114.     if Ask("Left Margin or ESC for current position",lm)
  3115.         if val(lm) > 0
  3116.             Set(LeftMargin,val(lm))
  3117.         endif
  3118.     else
  3119.         Set(LeftMargin,CurrPos())
  3120.     endif
  3121. end
  3122.  
  3123.  
  3124. proc SetRightMargin()
  3125.     string rm[3] = ""
  3126.     if Ask("Right Margin or ESC for current position",rm)
  3127.         if val(rm) > 0
  3128.             Set(RightMargin,val(rm))
  3129.         endif
  3130.     else
  3131.         Set(RightMargin,CurrPos())
  3132.     endif
  3133. end
  3134.  
  3135.  
  3136. proc MarginFromLine()
  3137.         Set(RightMargin,PosLastNonWhite())
  3138.         Set(LeftMargin,PosFirstNonWhite())
  3139.         Message(str(PosFirstNonWhite())+" <---Margins--->
  3140. "+str(PosLastNonWhite
  3141. end
  3142.  
  3143. ---
  3144. //*************************************************************************
  3145.              Subj: Three (3) MARGIN SETING MACROS  09/02/93
  3146. //*************************************************************************
  3147. //*************************************************************************
  3148. /************************  Start Comment Area *****************************
  3149.  
  3150. ===========================================================================
  3151.                     Date: 09-01-93  From: MEL HULSE
  3152.                       Subj: RT MARGIN Toggle MACRO
  3153. ---------------------------------------------------------------------------
  3154.  
  3155. WHAT IT DOES: It toggles between 64 and 72 characters for the right
  3156.               margin and displays the RT Margin setting in the upper
  3157.               right hand corner.
  3158.  
  3159.  
  3160.     ****************** RIGHT MARGIN MACRO ************************
  3161.         Macro to toggle RT Margin between 72 and 64 characters
  3162.                        Creation date: 04/15/93
  3163.       H. Garth McKay (with a little bit of help! from Mel Hulse)
  3164.                          Source File: RTMGN.S
  3165.                        Assigned Macro Key <F12>
  3166.     **************************************************************
  3167.  
  3168.   *************************************************************************/
  3169. //tak******************* END of Comment Area ******************************
  3170.  
  3171. proc Main()
  3172.     Integer Timer = 18          // 27 is about 1 1/2 seconds
  3173.     IF Query(RightMargin) == 72
  3174.         Set(RightMargin,64)
  3175.     Else
  3176.         IF Query(RightMargin) == 64
  3177.             Set(RightMargin,72)
  3178.         endif
  3179.     endif
  3180.     Message("           Rt Margin... ", (Query(RightMargin)))
  3181.     Delay(Timer)                            // Added
  3182.     UpdateDisplay(_STATUS_LINE_REFRESH_)    // Added
  3183. End
  3184.  
  3185. //*************************************************************************
  3186. //                   Right Margin Toggle  09/02/93
  3187. //*************************************************************************
  3188. ===========================================================================
  3189.                    Date: 09-05-93  From: DAVID MARCUS
  3190.                       Subj: mouse keys and TSE.KEY
  3191. ---------------------------------------------------------------------------
  3192. Define these constants .....
  3193.  
  3194. constant
  3195.      LeftRightBtn  = <LeftBtn> | <RightBtn>,
  3196.      LeftCenterBtn = <LeftBtn> | <CenterBtn>,
  3197.      RightCenterBtn=<RightBtn> | <CenterBtn>,
  3198.      LeftRightCenterBtn = <LeftBtn> | <RightBtn> | <CenterBtn>
  3199.  
  3200. And then you can use them for key definitions:
  3201.  
  3202. <      CenterBtn>
  3203. <Alt   CenterBtn>
  3204. <Ctrl  CenterBtn>
  3205. <Shift CenterBtn>
  3206.  
  3207. <      LeftBtn>
  3208. <Alt   LeftBtn>
  3209. <Ctrl  LeftBtn>
  3210. <Shift LeftBtn>
  3211.  
  3212. <      RightBtn>
  3213. <Alt   RightBtn>
  3214. <Ctrl  RightBtn>
  3215. <Shift RightBtn>
  3216.  
  3217. <      LeftCenterBtn>
  3218. <Alt   LeftCenterBtn>
  3219. <Ctrl  LeftCenterBtn>
  3220. <Shift LeftCenterBtn>
  3221.  
  3222. <      LeftRightBtn>
  3223. <Alt   LeftRightBtn>
  3224. <Ctrl  LeftRightBtn>
  3225. <Shift LeftRightBtn>
  3226.  
  3227. <      LeftRightCenterBtn>
  3228. <Alt   LeftRightCenterBtn>
  3229. <Ctrl  LeftRightCenterBtn>
  3230. <Shift LeftRightCenterBtn>
  3231.  
  3232. <      RightCenterBtn>
  3233. <Alt   RightCenterBtn>
  3234. <Ctrl  RightCenterBtn>
  3235. <Shift RightCenterBtn>
  3236.  
  3237. p.s. - I will not swear that 100% of these combinations work.
  3238.  
  3239. //*************************************************************************
  3240.                   Mouse button combinations  09/06/93
  3241. //*************************************************************************
  3242. ===========================================================================
  3243.                   Date: 09-07-93  From: SAMMY MITCHELL
  3244.     Subj: MYSTERY CODE - DelExtraBlankLines() w/detailed explanation
  3245. ---------------------------------------------------------------------------
  3246.  
  3247. // Remove all occurrences of more than one consecutive blank line, starting
  3248. // at the current line
  3249.  
  3250. proc DelExtraBlankLines()
  3251.     loop
  3252.  
  3253. // Loop, until an empty line (PosFirstNonWhite() == 0) is found, or until the
  3254. // end of file is reached (Down() == FALSE, which is also 'not Down()').
  3255.  
  3256.         repeat
  3257.         until PosFirstNonWhite() == 0 or not Down()
  3258.  
  3259. // We are either at the eof, or on a blank line.  Determine which
  3260.  
  3261.         if not Down()       // if Down() == FALSE, we're at eof, so stop
  3262.             break
  3263.         endif
  3264.  
  3265. // We are not at eof, so the line we were on must be blank.  Now delete
  3266. // additional blanks lines.  PosFirstNonWhite() == 0 signifies a blank line.
  3267. // PosFirstNonWhite() <> 0 means we have a non-empty line.  A shortcut way
  3268. // of writing PosFirstNonWhite() <> 0 is 'if PosFirstNonWhite()'.
  3269. // DelLine will return FALSE if there are no more lines to Delete, as might
  3270. // happen if we reach eof.
  3271.  
  3272.         repeat
  3273.         until PosFirstNonWhite() or not DelLine()
  3274.     endloop
  3275. end
  3276. //*************************************************************************
  3277.  Subj: MYSTERY CODE - DelExtraBlankLines() w/detailed explanation  09/08/93
  3278. //*************************************************************************
  3279.  
  3280. ===========================================================================
  3281.                 Date: 09-07-93  From: RICHARD BLACKBURN
  3282.                  Subj: Switche examples within a macro
  3283. ---------------------------------------------------------------------------
  3284.  
  3285. > Will it work with EditFile(-b file.xyz) in a macro?
  3286.  
  3287. Yes, that will work!  The "-n" goto line/column will also work in a macro.
  3288.  
  3289.                      e.g.  EditFile(-n## file.xyz)
  3290.  
  3291. //*************************************************************************
  3292.                                 09/08/93
  3293. //*************************************************************************
  3294.  
  3295. ===========================================================================
  3296.                 Date: 09-07-93  From: RICHARD BLACKBURN
  3297.                              Subj: HELPLINE
  3298. ---------------------------------------------------------------------------
  3299.  
  3300. >  How can I turn the HelpLine on and off from within a macro?
  3301.  
  3302. >  Can I have different HelpLine text for different macros?
  3303.  
  3304. >  Can I change the HelpLine text for different parts of the same macro?
  3305.  
  3306. Ans.  Yes, Yes, Yes
  3307.  
  3308. To turn the HelpLine on/off in a macro:
  3309.  
  3310.     Set(ShowHelpLine, On/Off)
  3311.  
  3312. To change the HelpLine when you load a macro, just assign the HelpLine in
  3313. your macro like a key assignment.
  3314.  
  3315. To have different help lines while a macro is running, you can put the
  3316. different HelpLines in a KeyDef and enable them when you want the HelpLine
  3317. to change.
  3318.  
  3319. ===========================================================================
  3320.                    Date: 09-09-93  From: FRED BRUCKER
  3321.                          Subj: Binary edit mode
  3322. ---------------------------------------------------------------------------
  3323.     >> If I remember correctly you had some trouble getting TSE to
  3324.     split a window using HWindow() in a main() or whenloaded(). <<
  3325.  
  3326. Thanks for your suggestion using Pushkey().  I also got it to work
  3327. using UpdateDisplay() in the Whenloaded():
  3328.  
  3329. proc WhenLoaded()
  3330.    UpdateDisplay()
  3331.    HWindow()
  3332. end
  3333.  
  3334. //*************************************************************************
  3335.             Opening TSE with a Horizontal Windows  09/09/93
  3336. //*************************************************************************
  3337.  
  3338. ===========================================================================
  3339.                    Date: 09-09-93  From: DAVID MARCUS
  3340.                     Subj: WordWrap with spaces macr
  3341. ---------------------------------------------------------------------------
  3342. Here is a first try at a paragraph wrapping macro that preserves [and
  3343. forces!] two spaces at the end of each sentence except when the sentence
  3344. ends a line.
  3345.  
  3346. forward proc endpara()
  3347. forward proc begpara()
  3348.  
  3349. proc wrap_with_spaces()
  3350.    PushBlock()
  3351.    PushPosition()
  3352.    WrapPara()
  3353.  
  3354.    PopPosition()
  3355.    PushPosition()
  3356.    MarkChar()
  3357.    EndPara()
  3358.    MarkChar()
  3359.    PopPosition()
  3360.    while lfind("[\.\!\?][\d034'\)]@ \c", 'xln1')
  3361.      if CurrChar() > 0 and CurrChar() <> 32
  3362.         InsertText(' ', _INSERT_)
  3363.      endif
  3364.      PushPosition()
  3365.      BegLine()           WrapPara()
  3366.      PopPosition()
  3367.      PushPosition()
  3368.      MarkChar()
  3369.      EndPara()
  3370.      MarkChar()
  3371.      PopPosition()
  3372.    endwhile
  3373.    Down()
  3374.    BegLine()
  3375.    PopBlock()
  3376. end
  3377.  
  3378. proc EndPara()
  3379.    Down()
  3380.    if CurrLineLen() == 0 BegPara() endif
  3381.    repeat until ( Down() AND CurrLineLen() == 0 )
  3382.         OR ( CurrLine() == NumLines() )
  3383.    if CurrLine() <> NumLines() Up() endif
  3384.    EndLine()
  3385. end
  3386.  
  3387. proc BegPara()
  3388.    if CurrLineLen() == 0
  3389.      repeat until ( Down() AND CurrLineLen() <> 0 )
  3390.           OR ( CurrLine() == NumLines() )
  3391.    else repeat until ( Up() AND CurrLineLen() == 0 )
  3392.           OR ( CurrLine() == 1 )
  3393.      if currline() <> 1 Down() endif
  3394.    endif
  3395.    GotoPos(PosFirstNonWhite())
  3396. end
  3397.  
  3398. //*************************************************************************
  3399.             WordWrap with two spaces after a comma  09/10/93
  3400. //*************************************************************************
  3401.  
  3402. ===========================================================================
  3403.                     Date: 09-15-93  From: RAY ASBURY
  3404.                               Subj: Ruler
  3405. ---------------------------------------------------------------------------
  3406.  
  3407.   Here's a simple one that a fellow tester made available quite a while
  3408.   back that I like very well.  Although it is not sticky (as to it's
  3409.   location), it has served me quite well:
  3410.  
  3411.     PROC mRuler()   // originally written by Peter Birch, but released to PD
  3412.  
  3413.         INTEGER i = 1,
  3414.                 j = Query(WindowCols),
  3415.                 k = CurrXOffset() + 1,
  3416.                 nRow = CurrRow() + Query(Windowy1)
  3417.  
  3418.         IF (CurrRow() == Query(WindowRows))
  3419.             nRow = nRow  - 2
  3420.         ENDIF
  3421.         VGotoXY(Query(Windowx1), nRow)
  3422.         WHILE (i <= j)
  3423.             IF (k MOD 10 == 0)
  3424.                 Write(SubStr(Format(k:4:'0'), 3, 1))
  3425.             ELSEIF (k MOD 5 == 0)
  3426.                 Write("┼")
  3427.             ELSE
  3428.                 Write("┬")
  3429.             ENDIF
  3430.             i = i + 1
  3431.             k = k + 1
  3432.         ENDWHILE
  3433.         VGotoXY(Query(Windowx1), nRow)
  3434.         PutAttr(Color(Bright White ON Red), j)
  3435.     END mRuler
  3436.  
  3437. //*************************************************************************
  3438.                             RULER  09/16/93
  3439. //*************************************************************************
  3440.  
  3441. ===========================================================================
  3442.                    From: IAN CAMPBELL  Date: 09-17-93
  3443.                   Subj: Switch between Last 2 Buffers
  3444. ---------------------------------------------------------------------------
  3445. Hi ALL,
  3446.  
  3447. One of the strengths of the TSE editor is its ability to load a
  3448. seemingly endless number of files.  It doesn't seem to matter what you
  3449. throw at this editor, it just takes it in stride.  However, a problem
  3450. develops when there are a lot of files loaded -- it becomes difficult
  3451. to find them all!
  3452.  
  3453. Now, I've been using the "Buffer List" (Alt-0) command to bring up the
  3454. open files menu, and to switch between them, (and I've even modified
  3455. the buffer list code so that things are sorted alphabetically and I
  3456. can consistently find all of the files).  But when one file starts
  3457. with, say, an "A", and another starts with a "W",  and there are
  3458. thirty or so files open, it can take a while to move from one end of
  3459. the buffer list to the other.
  3460.  
  3461. This becomes especially tiresome when you are moving bits and pieces
  3462. from one file to another, and must continually switch back and forth
  3463. between the two of them.  So I cooked up a little macro to allow
  3464. toggling between just the last two files that you have looked at.  It
  3465. doesn't matter how many files are open, just touch one key and you're
  3466. instantly in the previous file.  Touch it again and you're back where
  3467. you were!
  3468.  
  3469. Here's the macro:
  3470.  
  3471. ---------------------------------------------------------------------
  3472. integer PreviousID = 0, CurrentID = 0
  3473. proc mTrackFileChanges()
  3474.     if PreviousID == 0
  3475.         PreviousID = GetBufferID()
  3476.         CurrentID = GetBufferID()
  3477.     elseif GetBufferID() <> CurrentID
  3478.         PreviousID = CurrentID
  3479.         CurrentID = GetBufferID()
  3480.     endif
  3481. end mTrackFileChanges
  3482.  
  3483. proc mToggleBuffers()
  3484.     if PreviousID
  3485.         GotoBufferID(PreviousID)
  3486.         EditFile(Currfilename())
  3487.     endif
  3488. end mToggleBuffers
  3489.  
  3490. ---------------------------------------------------------------------------
  3491.  
  3492. Add the line:
  3493.  
  3494. Hook(_ON_CHANGING_FILES_, mTrackFileChanges)
  3495.  
  3496. to the Whenloaded() macro in TSE.S, and add the above two macros into
  3497. TSE.S just above the WhenLoaded() macro.
  3498.  
  3499. Finally, bind the mToggleBuffers() macro to a suitable key.  You might
  3500. want to choose a single key if you can find one.  I used the <GreyEnter>
  3501. key on the lower right corner of the keyboard.  I found that I always
  3502. used the left <Enter> key for my editing, so this key was available.
  3503. And it is VERY convenient <grin>.  Anyway, my key mapping went as
  3504. follows:
  3505.  
  3506. <GreyEnter> mToggleBuffers()
  3507.  
  3508. I find that I REALLY LIKE this macro.  Let me know what you think!
  3509.  
  3510. //*************************************************************************
  3511.             Switch between last two files(buffers)  09/18/93
  3512. //*************************************************************************
  3513.  
  3514. ===========================================================================
  3515.                 Date: 09-19-93  From: DAVID MAYEROVITCH
  3516.                       Subj: RECURSIVE CALLS IN SAL
  3517. ---------------------------------------------------------------------------
  3518.  
  3519.                       integer proc Content ( string book )
  3520.                         integer real = true
  3521.                         integer unreal = false
  3522.  
  3523.                         if Great(book) == true
  3524.                           return ( real )
  3525.                           else return ( unreal )
  3526.                           endif
  3527.  
  3528.                       end Content
  3529.  
  3530. //*************************************************************************
  3531.                         Recursive Calls 09/20/93
  3532. //*************************************************************************
  3533.  
  3534. ===========================================================================
  3535.                 Date: 09-27-93  From: RICHARD BLACKBURN
  3536.                            Subj: Macro Repeat
  3537. ---------------------------------------------------------------------------
  3538.  
  3539. .....what code do I need to add to the macro to make it loop 162 times?
  3540.  
  3541. I assume you are referring to a TSE macro, so you could have loop with a
  3542. variable you decrement, for example:
  3543.  
  3544. proc test()
  3545.     integer i = 162
  3546.  
  3547.     while i <> 0
  3548.         i = i - 1
  3549.         // Do whatever you want in the loop
  3550.     endwhile
  3551. end
  3552.  
  3553. //*************************************************************************
  3554.                  Example of a simple 'WHILE'  09/28/93
  3555. //*************************************************************************
  3556.  
  3557. ===========================================================================
  3558.                 Date: 09-28-93  From: RICHARD BLACKBURN
  3559.                          Subj: KEY ASSIGNMENTS
  3560. ---------------------------------------------------------------------------
  3561. > The default TSE.KEY file has RepeatCmd() assigned to <Ctrl q><Ctrl q>.
  3562. > How come pressing either <Ctrl q><Ctrl q> or <Ctrl q><q> executes
  3563. > the RepeatCmd()?  I'm sure the answer to the previous question will
  3564. > clear up what is happening with my four key assignments below:
  3565. >
  3566. > <Ctrl e><Ctrl e> Message("<Ctrl e><Ctrl e>")
  3567. > <Ctrl e><Alt e> Message("<Ctrl e><Alt e>")
  3568. > <Ctrl e><Shift e> Message("<Ctrl e><Shift e>")
  3569. > <Ctrl e><e> Message("<Ctrl e><e>")
  3570. >
  3571. > I placed them at the end of TSE.KEY.
  3572. > When I compile I get duplicate key warnings for the last two.
  3573. >
  3574. > Warning 056  (280,1)    duplicate key defined... ignored
  3575. > Warning 056  (281,1)    duplicate key defined... ignored
  3576. >
  3577. > Those four assignments are the only ones using <Ctrl e>.
  3578.  
  3579. For ctrl two keys are relaxed for the 2nd key.  The following keys are the
  3580. same:
  3581.  
  3582. <Ctrl E><Ctrl E>
  3583. <Ctrl E><Shift E>
  3584. <Ctrl E><E>
  3585.  
  3586. Since the 2nd key is relaxed the only shift state TSE will see for the 2nd
  3587. key is if you use Alt.
  3588.  
  3589. //*************************************************************************
  3590.                    Relaxed Key Assignments  09/28/93
  3591. //*************************************************************************
  3592.  
  3593. ===========================================================================
  3594.                  Date: 09-30-93  From: JACK HAZLEHURST
  3595.                        Subj: Another STATUS line
  3596. ---------------------------------------------------------------------------
  3597. CM>Is there anyway I can add to the status line how many lines
  3598. CM>the current file contains?
  3599.  
  3600. I have a bunch of things I like to know about my  settings  in  TSE.
  3601. What  I  did  was  to  assign  a key to a macro that builds a string
  3602. containing all the little tidbits I want to know about and  displays
  3603. it on the message line.  The next keystroke, of course, wipes it out
  3604. and brings back the status line, but I can see what I need this way.
  3605. There  are  so  many  things  I  want  to  be able to check that I'm
  3606. considering adding a second line of stuff (assigned, of  course,  to
  3607. another key combination).
  3608.  
  3609. //
  3610. // Additional status line
  3611. //
  3612. proc mStatusLine2()
  3613.     Message( "ColMod=", OnOffStr(column_mode),
  3614.             " FulJst=", OnOffStr( Justify ),
  3615.             " TbsOut=", OnOffStr( TabsOut ),
  3616.             " ExpTbs=", OnOffStr( Query( ExpandTabs ) ),
  3617.             " WrdEnd=", iif( WESwitch, "END", "BEG" ),
  3618.             " LngCfg=", MenuStr(StdCfgMenu,CfgID) )
  3619. end
  3620.  
  3621. "OnOffStr" is a macro you'll find in TSE.S.  The other variables are
  3622. peculiar (ve-e-ery peculiar) to my customization  of  TSE,  but  I'm
  3623. sure you get the idea.
  3624.  
  3625. //*************************************************************************
  3626.                      Another STATUS line  09/30/93
  3627. //*************************************************************************
  3628.  
  3629. ===========================================================================
  3630.                  Date: 09-29-93  From: GEORGE DE BRUIN
  3631.                    Subj: Temporarily changing margin
  3632. ---------------------------------------------------------------------------
  3633.  
  3634. If you just want to change the setting for the right margin while the
  3635. mWrapPara() command is being executed, you could write a short macro:
  3636.  
  3637. proc mWrap()
  3638.     integer rm = Set(RightMargin, 55)  // Set new right margin, save old
  3639.                                        // value
  3640.     mWrapPara()                        // Wrap the paragraph
  3641.     Set(RightMargin, rm)               // Set the right margin back to
  3642.                                        // the old value
  3643. end
  3644.  
  3645. This temporarily sets the margin would keep the right margin set the way
  3646. it normally is, but allow you to have it at a different setting for
  3647. wrapping.  This macro would need to be inserted in your TSE.S file.  The
  3648. best place for the macro would be right above the lines:
  3649.  
  3650. //*************************************************************************
  3651.                   Temporarily Change Margin  09/30/93
  3652. //*************************************************************************
  3653.  
  3654. ===========================================================================
  3655.                   Date: 09-29-93  From: SAMMY MITCHELL
  3656.                             Subj: NOT logic
  3657. ---------------------------------------------------------------------------
  3658. > I do have a question about this segment of the macro though:
  3659. >
  3660. >           if NOT Down()
  3661. >               break
  3662. >           endif
  3663. >
  3664. > I understand the "NOT" logic, the "break," and why it's necessary
  3665. > to prevent things from getting locked up on the last line of the
  3666. > file; however, does the "Not Down()" test actually execute the
  3667. > "Down()" function?  It would appear so, or else I can't see what
  3668. > advances the process a line at a time.
  3669. >
  3670. > It seems confusing and incorrect to me that an _IF_ should
  3671. > execute the cited function.  Is this documented somewhere?
  3672. > One would never expect ordinary compares such as "If X == 3" to
  3673. > result in X being set to the value of 3.  Consistency should
  3674. > dictate that "If function()" or "If NOT funtion()" should behave
  3675. > the same way, shouldn't it?
  3676.  
  3677. The if logic above could be rewritten as:
  3678.  
  3679. integer ok
  3680.  
  3681. ok = Down()     // assign result to ok
  3682. if ok == FALSE  // test value of ok
  3683.     break
  3684. endif
  3685.  
  3686. The "if not Down()" form is just a convenient short-cut.
  3687.  
  3688. Perhaps you're confusing the assignment operator '=' with the test for
  3689. equality operator '==' ?
  3690.  
  3691. 'a = b' can be read as "assign the value of b to a", while 'if a == b' can
  3692. be read "if the value of a is the same as the value of b, do what follows".
  3693.  
  3694. Does this make more sense now?  If not, let me know.
  3695.  
  3696. Can you think of something we could say in the manual to help make this
  3697. point more clear?
  3698.  
  3699. By the way, this is the way many other programming languages work, including
  3700. C, Pascal and Visual Basic.
  3701.  
  3702. //*************************************************************************
  3703.                           NOT logic  09/30/93
  3704. //*************************************************************************
  3705.  
  3706. ===========================================================================
  3707.                     Date: 10-05-93  From: RAY ASBURY
  3708.                        Subj: Menus and time delay
  3709. ---------------------------------------------------------------------------
  3710. ┌───<<< STEVE KRAUS >>>──────────────────────────────────────────────────────┐
  3711. │Another good idea! I have <Ctrl V> assigned to "View" functions. <Ctrl V><F>│
  3712. │Views Found text (CompressView), while <Ctrl V><O> Views the Old screen, and│
  3713. │<Ctrl V><A> views text found in all files loaded.                           │
  3714. │                                                                            │
  3715. │I do wish for WordStar-style menus that would work like the HelpLines do.   │
  3716. │If I press down the first key of a two-key and wait for some specified time,│
  3717. │it would be nice to pop up a menu.                                          │
  3718. │                                                                            │
  3719. └───>>> RAY ASBURY <<<───────────────────────────────────────────────────────┘
  3720.  
  3721. You could do a WordStar-style menu.  At least, one similar to what you
  3722. describe here.  Basically, here what you would need:
  3723.  
  3724.     proc OptionOneMacro()
  3725.         Message("this is OptionOneMacro()")
  3726.     end OptionOneMacro
  3727.  
  3728.     proc OptionTwoMacro()
  3729.         Message("this is OptionTwoMacro()")
  3730.     end OptionTwoMacro
  3731.  
  3732.     menu mMenu()
  3733.         "Menu Option &One", OptionOneMacro(), CloseAllBefore
  3734.         "Menu Option &Two", OptionTwoMacro(), CloseAllBefore
  3735.     end mMenu
  3736.  
  3737.     proc mShellMenu()
  3738.         INTEGER hrs, min, sec, hun, start, keyPress,
  3739.                 wait = 5 // 5 second wait
  3740.  
  3741.         GetTime(hrs, min, sec, hun)
  3742.         start = ((((hrs * 60) + min) * 60) + sec) * 60
  3743.         REPEAT
  3744.             IF (KeyPressed())
  3745.                 keyPress = GetKey()
  3746.                 CASE keyPress
  3747.                     WHEN <o>
  3748.                         OptionOneMacro()
  3749.                     WHEN <t>
  3750.                         OptionTwoMacro()
  3751.                     WHEN <Escape>
  3752.                         Return
  3753.                 ENDCASE
  3754.             ENDIF
  3755.             GetTime(hrs, min, sec, hun)
  3756.         UNTIL ( (start + wait) > (((((hrs * 60) + min) * 60) + sec) * 60) )
  3757.         mMenu()
  3758.     end mShellMenu
  3759.  
  3760. I just put this together without testing, so I may have made a mistake
  3761. or two.  Hope this helps get you started.
  3762.  
  3763. //*************************************************************************
  3764.                      Menus and time delay  10/06/93
  3765. //*************************************************************************
  3766.  
  3767. ===========================================================================
  3768.                 Date: 10-05-93  From: RICHARD BLACKBURN
  3769.                          Subj: Mouse functions
  3770. ---------------------------------------------------------------------------
  3771.  
  3772. If  you  do  not mind losing one of your  mouse  keys,  you  can  assign
  3773. TrackMouseCursor()  and  it will scroll the screen while you are holding
  3774. the key.
  3775.  
  3776. Syntax:     TrackMouseCursor()
  3777.  
  3778. Returns:    Nothing.
  3779.  
  3780. Notes:      While MouseKeyHeld() is TRUE, this function continuously moves
  3781.             the text cursor to the mouse cursor.  If the mouse is moved
  3782.             outside the current window, the window is scrolled.
  3783.  
  3784.             Any block within the current file is extended to the new cursor.
  3785.  
  3786.             Internally this function uses MouseStatus(), which updates
  3787.             MouseX, MouseY, and MouseKey.
  3788.  
  3789. See Also:   Mousestatus(), MouseKeyHeld()
  3790.  
  3791. //*************************************************************************
  3792.                        Mouse functions  10/06/93
  3793. //*************************************************************************
  3794.  
  3795. //*************************************************************************
  3796. /************************  Start Comment Area *****************************
  3797. //tak**********************************************************************
  3798.  
  3799. ===========================================================================
  3800.                     Date: 10-05-93  From: RAY ASBURY
  3801.                         Subj: A statusline clock
  3802. ---------------------------------------------------------------------------
  3803.  
  3804. With a 486/33 my cursor looked as if was having an epileptic seisure it
  3805. was blinking so fast!!  I added a check of the last posted time against
  3806. the current time and only update the clock if it's changed.  That
  3807. eliminated the flicker.  I also added code to use the same colors as the
  3808. statusline uses.  Here's you macro with my mods:
  3809.  
  3810.   *************************************************************************/
  3811. //tak******************* END of Comment Area ******************************
  3812.  
  3813.     PROC mClock()
  3814.         INTEGER nowTime,
  3815.                 saveAttr
  3816.  
  3817.         IF (Query(EditState) & _STATE_EDIT_MAIN_LOOP_)
  3818.             GetTime(gHrs, gHun, gMin, gSec) // global variables in my TSE.S
  3819.             nowTime = (gHrs * 60) + gMin
  3820.             IF (nowTime <> gLastPostedTime) // must be a global variable
  3821.                 gLastPostedTime = nowTime
  3822.                 Set(Cursor,Off)
  3823.                 GotoXY(Query(ScreenCols) - 8, 1)  // position for time
  3824.                 saveAttr = Set(Attr, Query(StatusLineAttr))
  3825.                 PutStr(' '+GetTimeStr()+' ')      // write the time
  3826.                 Set(Attr, saveAttr)
  3827.                 Set(Cursor,On)
  3828.                 UpdateDisplay()
  3829.             ENDIF
  3830.         ENDIF
  3831.     END mClock
  3832.  
  3833. Except for the time disappearing for about a 1/2 second when
  3834. UpdateDisplay() is called, it now works great.  Thanks for sharing your
  3835. macro.
  3836.  
  3837. //*************************************************************************
  3838.                       Status Line Clock  10/06/93
  3839. //*************************************************************************
  3840.  
  3841. ===========================================================================
  3842.                    Date: 10-07-93  From: DAVID MARCUS
  3843.                         Subj: TINY BUG IN TSGREP
  3844. ---------------------------------------------------------------------------
  3845.  
  3846. Find these two lines and delete the second line: [line numbers approximate]
  3847.  
  3848. 1247           while lFind(sstring, options)
  3849. 1248                AND CurrLine() <> NumLines()  // stops processing if EOF
  3850.  
  3851. Find these lines:
  3852.  
  3853. 1342                else
  3854. 1343                     Down()                   // AND down
  3855. 1344                     BegLine()                // to beginning of next line
  3856. 1345                endif
  3857. 1346                check_for_abort()
  3858. 1347           endwhile
  3859.  
  3860. and change to:
  3861.  
  3862. 1342                else
  3863. 1343                     if NOT Down()
  3864.                               goto end_of_file
  3865.                          endif
  3866. 1344                     BegLine()                // to beginning of next line
  3867. 1345                endif
  3868. 1346                check_for_abort()
  3869. 1347           endwhile
  3870.              end_of_file:
  3871.  
  3872. //*************************************************************************
  3873.                    Tiny bug fix in TSEGREP5  10/07/93
  3874. //*************************************************************************
  3875. //*************************************************************************
  3876. /************************  Start Comment Area *****************************
  3877.  
  3878. ===========================================================================
  3879.                 Date: 10-10-93  From: LOUIS VONDERSCHEER
  3880.                     Subj: Displaying compile errors
  3881. ---------------------------------------------------------------------------
  3882.  
  3883.   *************************************************************************/
  3884. //tak******************* END of Comment Area ******************************
  3885.  
  3886. Integer Proc JumpToError(String Type)
  3887.   String   Colm[3],
  3888.            Line[4],
  3889.            ErrMsg[78]
  3890.   If GotoBufferId(Errors)
  3891.     If LFind(Type,'w+')
  3892.       ErrMsg = GetText(PosFirstNonWhite(),PosLastNonWhite())
  3893.       Message('['+ErrMsg+']')
  3894.       Line = GetText(Pos('(',ErrMsg)+1,(Pos(',',ErrMsg)-Pos('(',ErrMsg))-1)
  3895.       Colm = GetText(Pos(',',ErrMsg)+1,(Pos(')',ErrMsg)-Pos(',',ErrMsg))-1)
  3896.       GotoBufferId(source)
  3897.       GotoLine(Val(Line,10))
  3898.       GotoColumn(Val(Colm,10))
  3899.       ScrollToRow(Query(WindowRows)/2)
  3900.     Else
  3901.       BegFile()
  3902.       GotoBufferId(source)
  3903.         If Flag
  3904.           Return(False)
  3905.         Else
  3906.           GotoBufferId(source)
  3907.           Beep(1)
  3908.           Message('No '+Type+'s found...')
  3909.           Return(false)
  3910.         EndIf
  3911.     EndIf
  3912.   Else
  3913.     Message('Error Buffer not found...')
  3914.     halt
  3915.   EndIf
  3916.   Return(true)
  3917. End JumpToError
  3918. //----------
  3919. Proc ShowErrors()
  3920.   string temp[10] = ''
  3921.   if not gotobufferid(source) Source = GetBufferId() endif
  3922.   If GotoBufferId(Errors)
  3923.     if lList('Errors',80,Query(ScreenRows),0)
  3924.       BegLine()
  3925.       EndWord()
  3926.       temp=GetText(1,CurrPos())
  3927.       if Pos('Error',temp) or Pos('Warning',Temp) or Pos('Note',Temp)
  3928.         Up() // move up a line so jump to err find it
  3929.         JumpToError(temp)
  3930.       EndIf
  3931.     EndIf
  3932.     GotoBufferId(Source)
  3933.     Return()
  3934.   Else
  3935.     GotoBufferId(Source)
  3936.     Return()
  3937.   EndIf
  3938. End ShowErrors
  3939. .
  3940. .
  3941. .
  3942. <Ctrl e> JumpToError('Error')       // find next error
  3943. <Ctrl w> JumpToError('Warning')     // find next warning
  3944. <Ctrl v> ShowErrors()
  3945.  
  3946. //*************************************************************************
  3947. /************************  Start Comment Area *****************************
  3948.  
  3949. These are some excerpts from my sCompile macro.  I use message() to put
  3950. the error on the status line rather then open another window.  To see
  3951. the entire error output I press <ctrl v>.  At that point I can pick the
  3952. specific error/warning/note to jump to.  I like it this way but milage
  3953. may vary...
  3954.  
  3955.   *************************************************************************/
  3956. //tak******************* END of Comment Area ******************************
  3957.  
  3958. ===========================================================================
  3959.                 Date: 10-04-93  From: RICHARD BLACKBURN
  3960.                        Subj: Inserting LetterHaed
  3961. ---------------------------------------------------------------------------
  3962. You could do your letterhead by setting it up as a DATA structure in your
  3963. TSE.S file, for example (NOTE, I shortened it for the message):
  3964.  
  3965. DATA LetterHead
  3966. " ≡    ≡   ≡   ≡   ≡   ≡   TAKnet Infromation Exchange     ..."
  3967. "                          Fort Wayne, Indiana             ..."
  3968. "────────────────────────────────────────────────────────  ..."
  3969. "<::::]    <::::]    <::::]    <::::]      <::::]    <:::  ..."
  3970. "────────────────────────────────────┐    ┌──────────────  ..."
  3971. "                                    │====│                ..."
  3972. "      CALL: (219) 745-3635          │    │                ..."
  3973. "..."
  3974. END
  3975.  
  3976. Then you can assign the the following to a key to insert your letter head
  3977. into the file:
  3978.  
  3979. InsertData(LetterHead) // Insert the LetterHead DATA into the file.
  3980.  
  3981. Once you have done this, be sure to use SC.EXE to update E.EXE with the
  3982. changes.
  3983.  
  3984. //*************************************************************************
  3985.                Adding Letterhead by using DATA  10/14/93
  3986. //*************************************************************************
  3987.  
  3988. ===========================================================================
  3989.             Date: 10-14-93  From: JONATHAN DE BOYNE POLLARD
  3990.                   Subj: Regular expressions [General]
  3991. ---------------------------------------------------------------------------
  3992.  
  3993.   Having never used TSE, but having use regular expressions in other
  3994.   programs for a long time, you will probably find most of these
  3995.   supported everywhere.
  3996.  
  3997.       .  Any character                *  Zero or more repetitions
  3998.       ?  Zero or one repetitions      +  One or more repetitions
  3999.      []  Encloses a character set    ()  Encloses a subexpression
  4000.       |  Separates alternatives       \  Quote literal next char
  4001.       ^  Match beginning of line      $  Match end of line
  4002.  
  4003.   Some programs don't supply | and ().  Other programs add
  4004.  
  4005.      \<  Match the start of a word   \>  Match the end of a word
  4006.      \(  Start a substring           \)  End a substring
  4007.  
  4008.   In the replace part of search and replace, most regexps that support
  4009.   \( and \) should also support \1 to \9 for substring insertion.
  4010.  
  4011.   How does this lot match against TSE ?
  4012.  
  4013.   │                                           Is there any
  4014.   │ standardization, or do language and system developers define them as
  4015.   │ they please?
  4016.   │
  4017.   │ I have a vague impression that the idea of regexps comes out of the C
  4018.   │ and Unix world.
  4019.  
  4020.   The second is the answer to the first.  They are used extensively in
  4021.   UNIX tools such as ex (vi by another name), ed, sed, and grep, although
  4022.   I doubt that they originated with UNIX.
  4023.  
  4024.   The "standard" regular expressions are usually those documented in the
  4025.   UNIX V8 regexp(3) manual, although the \< and \> metasequences are
  4026.   part of ex(1).  There is a widely distributed regular expression C
  4027.   library written by Henry Spencer of the University of Toronto based
  4028.   upon the regexp(3) stuff.
  4029.  
  4030. //*************************************************************************
  4031.           General discussion of regular expressions  10/15/93
  4032. //*************************************************************************
  4033.  
  4034. ===========================================================================
  4035.                 Date: 10-15-93  From: DAVID MAYEROVITCH
  4036.                    Subj: More on Regular expressions
  4037. ---------------------------------------------------------------------------
  4038.  
  4039. JD>  How does this lot match against TSE ?
  4040.  
  4041. JD>      .  Any character                *  Zero or more repetitions
  4042. JD>      ?  Zero or one repetitions      +  One or more repetitions
  4043. JD>     []  Encloses a character set    ()  Encloses a subexpression
  4044. JD>      |  Separates alternatives       \  Quote literal next char
  4045. JD>      ^  Match beginning of line      $  Match end of line
  4046.  
  4047. TSE includes all of the above, with {} instead of (), and also has ~
  4048. for a complement class (you may have omitted this from your list).
  4049.  
  4050. JD>  Some programs don't supply | and ().  Other programs add
  4051.  
  4052. JD>     \<  Match the start of a word   \>  Match the end of a word
  4053. JD>     \(  Start a substring           \)  End a substring
  4054.  
  4055. TSE lacks the preceding four.
  4056.  
  4057. JD>  In the replace part of search and replace, most regexps that support
  4058. JD>  \( and \) should also support \1 to \9 for substring insertion.
  4059.  
  4060. TSE does this too.
  4061.  
  4062. TSE also includes @, which is similar to * but matches with maximum
  4063. closure where * matches with minimum closure, and it includes #, which
  4064. stands in a similar relation to +.
  4065.  
  4066. JD>  │                                           Is there any
  4067. JD>  │ standardization, or do language and system developers define them as
  4068. JD>  │ they please?
  4069.  
  4070. JD>  The "standard" regular expressions are usually those documented in the
  4071. JD>  UNIX V8 regexp(3) manual, although the \< and \> metasequences are
  4072.  
  4073. //*************************************************************************
  4074.                  More on regular expressions  10/16/93
  4075. //*************************************************************************
  4076.  
  4077. ===========================================================================
  4078.                  Date: 10-15-93  From: ANDREAS MARTINI
  4079.                          Subj: PEARL OF WISDOM
  4080. ---------------------------------------------------------------------------
  4081. Hello to Sammy Mitchell
  4082.  
  4083. the man who invented
  4084.         home   MacroBegin FirstNonWhite jTrue done: Begline done:
  4085.  
  4086. also known as
  4087.         <Home>    IF not BegLine()
  4088.                       GotoPos(PosFirstNonWhite())
  4089.                   Endif
  4090.  
  4091. From this great man, to whom I am not worth to clean his shoes, I took
  4092. his wisdom and changed the lines in the unchangeable TSE.KEY file to
  4093.  
  4094. // if Remove Trailing Whitespace is set to OFF
  4095.         <End>     If not EndLine()
  4096.                       GotoPos(PosLastNonWhite())
  4097.                       Right()
  4098.                   EndIf
  4099.  
  4100. //*************************************************************************
  4101.                                 10/16/93
  4102. //*************************************************************************
  4103.  
  4104. ===========================================================================
  4105.                     Date: 10-15-93  From: MEL HULSE
  4106.               Subj: Cursor commands that accept an Integer
  4107. ---------------------------------------------------------------------------
  4108.  
  4109. Here's the cursor commands I know of that work with an integer
  4110. parameter:
  4111.  
  4112.     Backspace() DelChar() DelLeftWord() DelLine() DelRightWord()
  4113.     Down() DupLine() Left() NextFile() PageDown() PageDown()
  4114.     PageUp() PrevChar() PrevFile() Right() RollDown() RollLeft()
  4115.     RollRight() RollUp() ScrollDown() ScrollLeft() ScrollRight()
  4116.     ScrollUp() SplitLine() TabLeft() TabRight() Up() WordLeft()
  4117.     WordRight()
  4118.  
  4119. Unfortunatly, CRETURN() doesn't work with an integer parameter.
  4120.  
  4121. //*************************************************************************
  4122.               Command that accept Integer value  10/16/93
  4123. //*************************************************************************
  4124. ==========================================================================
  4125.               Date: 10-15-93  From: David Daniel Anderson
  4126.                           Subj: mAbandonAll()
  4127. ---------------------------------------------------------------------------
  4128.  
  4129.      proc mAbandonAll()
  4130.        while NextFile() <> 0
  4131.          AbandonFile()
  4132.      endwhile
  4133.        AbandonFile()
  4134.      end
  4135.  
  4136. //*************************************************************************
  4137.                         mAbandonAll()  10/16/93
  4138. //*************************************************************************
  4139.  
  4140. ===========================================================================
  4141.               Date: 10-16-93  From: DAVID DANIEL ANDERSON
  4142.                          Subj: Old TSE Macros
  4143.                          Reload file from disk
  4144. ---------------------------------------------------------------------------
  4145.  
  4146.  It allows the user to get the most recent "saved to disk" version of
  4147. the current file.
  4148.  
  4149. It prompts for confirmation, and defaults to "y" if only enter is
  4150. pressed.  This could be changed to "n" to make it safer (see the
  4151. second line).
  4152.  
  4153. proc mRefreshFile()
  4154.      string rfr[1]="y"
  4155.      string ThisFile[80] = CurrFileName()
  4156.      Ask("Do You Want to Get the Saved Copy of This File?", rfr)
  4157.      if rfr == "y"
  4158.         ChangeCurrFileName("#tsetemp")
  4159.         EditFile(ThisFile)
  4160.         PrevFile()
  4161.         AbandonFile()
  4162.         EditFile(ThisFile)
  4163.      endif
  4164. end
  4165.  
  4166. It could be enhanced to save the current position in the file and
  4167. restore that position when the saved version is reloaded, should
  4168. you desire.  I don't care to do it, though.
  4169.  
  4170. //*************************************************************************
  4171.                     Reload file from disk  10/16/93
  4172. //*************************************************************************
  4173.  
  4174. ===========================================================================
  4175.                   Date: 10-20-93  From: SAMMY MITCHELL
  4176.                     Subj: FIND & REMOVE BLANK LINES
  4177. ---------------------------------------------------------------------------
  4178. Here it is (msg 708) and probably in a file too:
  4179.  
  4180. // Remove all occurrences of more than one consecutive blank line,
  4181. // starting at the current line
  4182. proc DelExtraBlankLines()
  4183.     loop
  4184.         repeat
  4185.         until PosFirstNonWhite() == 0 or not Down()
  4186.         if not Down()
  4187.             break
  4188.         endif
  4189.         repeat
  4190.         until PosFirstNonWhite() or not DelLine()
  4191.     endloop
  4192. end
  4193.  
  4194. <f1> DelExtraBlankLines()
  4195.  
  4196. //*************************************************************************
  4197.                  DelExtraBlankLines()  again?  10/20/93
  4198. //*************************************************************************
  4199.  
  4200. ===========================================================================
  4201.                     Date: 10-18-93  From: BOB KOWITT
  4202.                          Subj: Reload from disk
  4203. ---------------------------------------------------------------------------
  4204.  
  4205. //  Abandons file on screen and reloads same file
  4206.  
  4207.         proc Reload()
  4208.             string fn[65] = CurrFilename()
  4209.             AbandonFile()
  4210.             EditFile(fn)
  4211.         end
  4212.  
  4213. //*************************************************************************
  4214.                                 10/20/93
  4215. //*************************************************************************
  4216.  
  4217. ===========================================================================
  4218.                 Date: 10-20-93  From: RICHARD BLACKBURN
  4219.                        Subj: Synchronized Windows
  4220. ---------------------------------------------------------------------------
  4221. SEE SYNCHRONIZED FIX!!! - later in this file
  4222.  
  4223. >  What is the possibility of getting Synchronized Windows for at  least
  4224. >  two of the windows. It would help.
  4225.  
  4226. The following macro will scroll all windows together.  You need to assign
  4227. ScrollWindows() to a key.  When you want to lock the windows together press
  4228. the key you have assigned to ScrollWindows().  When you want to stop
  4229. scrolling the windows press <Escape>:
  4230.  
  4231. constant    cLEFT        = 1,
  4232.             cRIGHT       = 2,
  4233.             cUP          = 3,
  4234.             cDOWN        = 4,
  4235.             cPAGEUP      = 5,
  4236.             cPAGEDOWN    = 6,
  4237.             cBEGLINE     = 7,
  4238.             cBEGFILE     = 8,
  4239.             cENDLINE     = 9,
  4240.             cENDFILE     = 10
  4241.  
  4242. proc mScrollWindows(integer direction)
  4243.     integer winid = WindowId(), num = 1
  4244.  
  4245.     while num < 10
  4246.         if GotoWindow(num)
  4247.             case direction
  4248.                 when cLEFT           Left()
  4249.                 when cRIGHT          Right()
  4250.                 when cUP             Up()
  4251.                 when cDOWN           Down()
  4252.                 when cPAGEUP         PageUp()
  4253.                 when cPAGEDOWN       PageDown()
  4254.                 when cBEGLINE        BegLine()
  4255.                 when cBEGFILE        BegFile()
  4256.                 when cENDLINE        EndLine()
  4257.                 when cENDFILE        EndFile()
  4258.             endcase
  4259.         endif
  4260.         num = num + 1
  4261.     endwhile
  4262.     GotoWindow(winid)
  4263. end
  4264.  
  4265. keydef ScrollKeys
  4266. <CursorLeft>        mScrollWindows(cLEFT)
  4267. <CursorRight>       mScrollWindows(cRIGHT)
  4268. <CursorUp>          mScrollWindows(cUP)
  4269. <CursorDown>        mScrollWindows(cDOWN)
  4270. <PgUp>              mScrollWindows(cPAGEUP)
  4271. <PgDn>              mScrollWindows(cPAGEDOWN)
  4272. <Home>              mScrollWindows(cBEGLINE)
  4273. <Ctrl PgUp>         mScrollWindows(cBEGFILE)
  4274. <End>               mScrollWindows(cENDLINE)
  4275. <Ctrl PgDn>         mScrollWindows(cENDFILE)
  4276. <Escape>            EndProcess()
  4277. end
  4278.  
  4279. proc ScrollWindows()
  4280.     Enable(ScrollKeys)
  4281.     Process()
  4282.     Disable(ScrollKeys)
  4283. end
  4284.  
  4285. //*************************************************************************
  4286.                  Syncronize Window Scrolling  10/20/93
  4287. //*************************************************************************
  4288.  
  4289. ===========================================================================
  4290.                   Date: 10-23-93  From: SAMMY MITCHELL
  4291.                  Subj: Find & remove *ALL* blank lines
  4292. ---------------------------------------------------------------------------
  4293.  
  4294. If you want to delete _all_ blank lines, how about:
  4295.  
  4296. proc DeleteAllBlankLines()
  4297.     PushPosition()                  // save our place
  4298.     loop
  4299.         if PosFirstNonWhite() == 0
  4300.             if not DelLine()
  4301.                 break               // if eof
  4302.             endif
  4303.         elseif not Down()           // if eof
  4304.             break
  4305.         endif
  4306.     endloop
  4307.     PopPosition()
  4308. end
  4309.  
  4310. <f1> DeleteAllBlankLines()
  4311.  
  4312. //*************************************************************************
  4313.             Subj: Find & remove *ALL* blank lines  10/24/93
  4314. //*************************************************************************
  4315.  
  4316.                  ┌────────────────────────────────────┐
  4317.                  │SYNCHRONIZED FIX!!! from macro above│
  4318.                  └────────────────────────────────────┘
  4319.  
  4320. ===========================================================================
  4321.                 Date: 10-25-93  From: RICHARD BLACKBURN
  4322.                  Subj: Synchronized Windows Macro FIX!!
  4323. ---------------------------------------------------------------------------
  4324. DD>   Richard, when I implemented your macro, I noticed that with 2 windows
  4325. DD>   opened vertically, if the cursor is in window 1 when I invoke the
  4326. DD>   macro, only window 2 scrolls, windows 1 is locked.  If I'm in window
  4327. DD>   2, then both windows scroll together.  Is this the way it's supposed
  4328. DD>   to work?  This is with v1.00z.  Thanks.
  4329.  
  4330. The following macro should fix the problem:
  4331.  
  4332. constant    cLEFT        = 1,
  4333.             cRIGHT       = 2,
  4334.             cUP          = 3,
  4335.             cDOWN        = 4,
  4336.             cPAGEUP      = 5,
  4337.             cPAGEDOWN    = 6,
  4338.             cBEGLINE     = 7,
  4339.             cBEGFILE     = 8,
  4340.             cENDLINE     = 9,
  4341.             cENDFILE     = 10
  4342.  
  4343. proc Scroll(integer direction)
  4344.     case direction
  4345.         when cLEFT           Left()
  4346.         when cRIGHT          Right()
  4347.         when cUP             Up()
  4348.         when cDOWN           Down()
  4349.         when cPAGEUP         PageUp()
  4350.         when cPAGEDOWN       PageDown()
  4351.         when cBEGLINE        BegLine()
  4352.         when cBEGFILE        BegFile()
  4353.         when cENDLINE        EndLine()
  4354.         when cENDFILE        EndFile()
  4355.     endcase
  4356. end
  4357.  
  4358. proc mScrollWindows(integer direction)
  4359.     integer winid = WindowId(), num = 1
  4360.  
  4361.     while num < 10
  4362.         if GotoWindow(num)
  4363.             Scroll(direction)
  4364.         endif
  4365.         num = num + 1
  4366.     endwhile
  4367.     GotoWindow(winid)
  4368.     if winid == 1
  4369.         Scroll(direction)
  4370.     endif
  4371. end
  4372.  
  4373. keydef ScrollKeys
  4374. <CursorLeft>        mScrollWindows(cLEFT)
  4375. <CursorRight>       mScrollWindows(cRIGHT)
  4376. <CursorUp>          mScrollWindows(cUP)
  4377. <CursorDown>        mScrollWindows(cDOWN)
  4378. <PgUp>              mScrollWindows(cPAGEUP)
  4379. <PgDn>              mScrollWindows(cPAGEDOWN)
  4380. <Home>              mScrollWindows(cBEGLINE)
  4381. <Ctrl PgUp>         mScrollWindows(cBEGFILE)
  4382. <End>               mScrollWindows(cENDLINE)
  4383. <Ctrl PgDn>         mScrollWindows(cENDFILE)
  4384. <Escape>            EndProcess()
  4385. end
  4386.  
  4387. proc ScrollWindows()
  4388.     Enable(ScrollKeys)
  4389.     Process()
  4390.     Disable(ScrollKeys)
  4391. end
  4392.  
  4393. <F7> ScrollWindows()
  4394.  
  4395. //*************************************************************************
  4396.                 Lock scrolling Windows FIX!!!  10/26/93
  4397. //*************************************************************************
  4398.  
  4399. ===========================================================================
  4400.                    Date: 10-25-93  From: DAVID MARCUS
  4401.                      Subj: Making New CmdLine Opts
  4402. ---------------------------------------------------------------------------
  4403.  
  4404.         ALSO see next message for CmdLine() use with NameClip()
  4405.  
  4406. I am uploading to the library here a pair of helper macros that
  4407. faciliate (make easy!) the creation of custom command line options.
  4408.  
  4409. They allow you to test to see if any option [1 or more letters
  4410. preceded by a '-'] was used on the TSE commandline and what argument,
  4411. if any, followed the option. They also allow you to retrieve the
  4412. filespecs used on the command line.
  4413.  
  4414. Included are two command line options:
  4415.  
  4416.      * -p to print those files included on the command line.
  4417.      * -N to goto line,col rather than just going to line.
  4418.  
  4419.         For instance
  4420.  
  4421.                tse -p c:\autoexec.bat c:\config.sys
  4422.  
  4423.         prints both these files, first querying to print all (2)
  4424.         files. If you say yes, it does. If you say no, it queries
  4425.         on an individual basis for printing each file.
  4426.  
  4427.         In any case, the editor ends after printing.
  4428.  
  4429.         And:
  4430.  
  4431.                tse *.s -n5,10
  4432.  
  4433.         goes to line 5, column 10 of the first file loaded.
  4434.  
  4435. The file name is CmdLine3.ZIP.
  4436.  
  4437.        ┌───────────────────────────────────────────────────────┐
  4438.        │ALSO see next message for CmdLine() use with NameClip()│
  4439.        └───────────────────────────────────────────────────────┘
  4440.  
  4441. //*************************************************************************
  4442.                         CmdLine3 Macro  10/26/93
  4443. //*************************************************************************
  4444.  
  4445. ===========================================================================
  4446.                    Date: 10-26-93  From: DAVID MARCUS
  4447.                     Subj: Load Named Clipboards Cmd
  4448. ---------------------------------------------------------------------------
  4449.  
  4450. SEE CmdLine() in previous message
  4451.  
  4452. ┌───────────────────────────────────────────────────────────────────────┐
  4453. │        PLUG:  Using the CmdLine helper macros, the TSE command        │
  4454. │        line option described here took less than 15 minutes to        │
  4455. │        conceive, implement, and test.                                 │
  4456. └───────────────────────────────────────────────────────────────────────┘
  4457.  
  4458. For NameClip() users only ... a command line option to load a stored
  4459. clipboard file at startup.
  4460.  
  4461. You can use my CmdLine helper macros to create a command line option to
  4462. automatically load a file of saved clipboards.  Note: To do this, you
  4463. must have included NameClip as part of your TSE configuration [that is,
  4464. using a #INCLUDE rather than loading it as an external macro].
  4465.  
  4466. To do this....
  4467.  
  4468. 1. Find the GET_CLIPS_FROM_FILE() proc in NameClip.S and find these
  4469.    lines:
  4470.  
  4471.           if Ask('File name for clipboards?', saveclipfilename) ─┐
  4472.                AND Length(saveclipfilename)                      │
  4473.           else                                                   │
  4474.                msg = 'bad file name'                             ├───┐
  4475.                pop_message('', Query(MsgAttr), 19)               │    │
  4476.                goto ending                                       │    │
  4477.           endif                                                 ─┘    │
  4478.                                                                       │
  4479. 2. Wrap these lines in an add'l   if...else...endif:                  │
  4480.                                                                       
  4481.      if Length(GetGlobalStr(global_saveclipfilename))                 │
  4482.           saveclipfilename = GetGlobalStr(global_saveclipfilename)    │
  4483.      else                                                             │
  4484.           if Ask('File name for clipboards?', saveclipfilename) //*─┐ │
  4485.                AND Length(saveclipfilename)                     //* │ │
  4486.           else                                                  //* │ │
  4487.                msg = 'bad file name'                            //* ├┘
  4488.                pop_message('', Query(MsgAttr), 19)              //* │
  4489.                goto ending                                      //* │
  4490.           endif                                                 //*─┘
  4491.      endif
  4492.  
  4493.                     //* these lines don't change, they are just wrapped
  4494.                     //* in the extra "if...endif"
  4495.  
  4496. 3. Add this to your WhenLoaded() in your TSE config file:
  4497.  
  4498.   /* Load clipboard file */
  4499.  
  4500.      if CmdLineOptionUsed('cb')
  4501.         AND Length(GetGlobalStr('CmdLineArgForcb'))
  4502.           SetGlobalStr( 'global_saveclipfilename',
  4503.                          GetGlobalStr('CmdLineArgForcb') )
  4504.           get_clips_from_file()
  4505.      endif
  4506.  
  4507. 4. Recompile TSE.
  4508.  
  4509. You can now start TSE like this:
  4510.  
  4511.      e filespecs -cbCLIP_FILE_NAME
  4512.  
  4513.    where CLIP_FILE_NAME is the name of the file you have previously
  4514.    specified when storing clipboards to a file using the named clipboard
  4515.    Other Functions menu.
  4516.  
  4517. Command line helper macros are in file CmdLine3.ZIP, in Conference 4,
  4518. when released by sysops.
  4519.  
  4520. //*************************************************************************
  4521.                   CmdLine3() and NameClip()  10/27/93
  4522. //*************************************************************************
  4523.  
  4524.  
  4525. ===========================================================================
  4526.                     Date: 10-26-93  From: MEL HULSE
  4527.                      Subj: TSE REGULAR EXPRESSIONS
  4528. ---------------------------------------------------------------------------
  4529. Here's a post from Internet that should prove helpful.
  4530.  
  4531. Here are some quick and dirties from my files. Also attached is a brief
  4532. description of each regexp character.
  4533.  
  4534. expr = "^\@major head"
  4535.  
  4536. expr = "{^\@major head}|{^\@med head}"
  4537.  
  4538. expr = "<\$\!\.{NOT }?INCLUDE"
  4539.  
  4540. expr = "^{\@maj}|{\@med}|{\@min}|{\@command name}"
  4541.  
  4542. expr = "^{forward }?{public }?{{integer }|{string }}?{proc }|{menu }"
  4543.  
  4544. expr = "\<\$[IAS]"
  4545.  
  4546. expr = "{else }|{elseif }|{while }|{repeat }|{loop }|{for }|{switch}
  4547.          |{case }|{
  4548.  
  4549. expr = "{unix}|{vms}|{vax}|{aos}|{non-}|{dos}|{windows}|{motif}|{iq[wx]}"
  4550.  
  4551. expr = "^{forward }?{public }?{{integer }|{string }}?{proc }|{menu }"
  4552.  
  4553. expr = "{<\$M}|{<\$R\[}"
  4554.  
  4555.  
  4556.   Symbol   Regular Expression Search Behavior
  4557.   ......   ....................................................................
  4558.  
  4559.     .      Matches any single character (except end-of-line).
  4560.  
  4561.     ^      Beginning of line/block
  4562.  
  4563.     $      End of line/block
  4564.  
  4565.     \n     In a REPLACE pattern:  references a tagged component pattern
  4566.            from th search pattern, where "n" is a single-digit number
  4567.            from 0 through 9.
  4568.  
  4569.     |      "Or" operator:  matches the preceding or the following pattern.
  4570.  
  4571.     ?      Optionally matches the preceding pattern.
  4572.  
  4573.    [ ]     Identifies a Class of characters against which to match a single
  4574.             character.
  4575.  
  4576.   [ - ]    Indicates a range of characters (based on ASCII sequence)
  4577.            when used BETWEEN characters in a Class.
  4578.  
  4579.   [~ ]     Identifies a complement Class of characters to match against
  4580.            a single character, when "~" is used as the first character
  4581.            within the Class
  4582.  
  4583.     *      Matches 0 or more occurrences of the preceding pattern, with
  4584.            minimum closure.
  4585.  
  4586.     +      Matches 1 or more occurrences of the preceding pattern, with
  4587.            minimum closure.
  4588.  
  4589.     @      Matches 0 or more occurrences of the preceding pattern, with
  4590.            maximum closure.  (See "Minimum/Maximum Closure" below).
  4591.  
  4592.     #      Matches 1 or more occurrences of the preceding pattern, with
  4593.            maximum closure.  (See "Minimum/Maximum Closure" below).
  4594.  
  4595.    { }     Serve as Tags to identify a pattern group or component
  4596.            pattern withi the search pattern.  Tagged patterns can be
  4597.            nested.
  4598.  
  4599.     \      Serves as an Escape operator.  This symbol is used to
  4600.            override a Regular Expression operator so the operator symbol
  4601.            is treated as a literal character.  It is also used with
  4602.            certain other characters to indicate additional Regular
  4603.            Expression options; and is used within a Replace pattern to
  4604.            reference a Tagged component (see the explanation of "{ }"
  4605.            (Tags) above).
  4606.  
  4607.     \a     Matches the alert (beep) character (^G or ASCII 7).
  4608.     \b     Matches the backspace character (^H or ASCII 8).
  4609.     \f     Matches the formfeed character (^L or ASCII 12).
  4610.     \n     Matches the newline (line feed) character (^J or ASCII 10). **
  4611.     \r     Matches the return character (^M or ASCII 13). **
  4612.     \t     Matches the tab character (^Ior ASCII 9).
  4613.     \v     Matches the vertical tab character (^K or ASCII 11).
  4614.     \c     Designates the placement of the cursor within the
  4615.             located string whe used with the Find command.
  4616.  
  4617.   \xnn     Matches the character equivalent to the indicated hexadecimal
  4618.             value,
  4619.  
  4620.   \dnnn    Matches the character equivalent to the indicated decimal value,
  4621.  
  4622.   \onnn    Matches the character equivalent to the indicated octal
  4623.             value, where
  4624.  
  4625. //*************************************************************************
  4626.              Information on 'regular expressions'  10/28/93
  4627. //*************************************************************************
  4628.  
  4629.            File:  'tse_tip1.txt  Tuesday -  November 9, 1993
  4630.        Snippets of information from messages on various networks
  4631.                     From May 1993 thru October 1993
  4632.                                   END
  4633.