home *** CD-ROM | disk | FTP | other *** search
/ Tools en Utilities / CDASS_5.ISO / shell / file / tse_tip4.arj / TSE_TIP4.TXT < prev   
Encoding:
Text File  |  1994-11-06  |  60.7 KB  |  1,657 lines

  1.                        ┌────────────────────────┐
  2.                        │TSE Tips and Mini-Macros│
  3.                        └────────────────────────┘
  4.  
  5.                         ThisFile:  \tse_tip4.txt
  6.  
  7.          Compiled by Tom Klein from Personal Notes and Slips of
  8.                      Paper used for Memory Joggers
  9.  
  10.                and covers the dates 09/27/94 to 11/06/94
  11.        although some tips/macros may be outside these two dates.
  12.  
  13.   TIPS4 contains several 'OLD but GOLD' macros from the past:
  14.  
  15.         Convert Graphics Box to ASCII  06-23-93
  16.         Temporary Change of Margin     09-29-93
  17.         Syncronized Windows Scroll     10-25-93
  18.         Re-Wrap Quoted Text in replies 07-05-94
  19.           while retaining initials.
  20.  
  21.   TIPS are intended to be a continuing series of hints and tips and each
  22.   subsequent release will be in-addition-to the previous versions.  That
  23.   is TIP4 will not contain any of the information in TIP3.  The one
  24.   exception is that grievous errors from a previous edition will be
  25.   corrected in the next release.
  26.  
  27.  ┌────────────────┐
  28.  │Public Releases:│  'tsetip3.zip', 'tsetip4.zip'
  29.  └────────────────┘
  30.  
  31.   If you have any problems or find errors please let me know [Tom Klein]
  32.   so that they may be fixed in the next version.
  33.  
  34.   Contact me in any conference on the SemWare BBS or via RIME #330
  35.   (SemWare) or via Internet at either of the addresses below.
  36.  
  37.           tom.klein@chrbbs.sccsi.com  OR tom.klein@lunatic.com
  38.  
  39.   In general all macros start with this:
  40.  
  41. /**************************************************************************
  42.  
  43.   If you clip the macro area from that line to the end of the macro you
  44.   should be able to compile the clip.  Include the above ' /** ' because
  45.   it is the first part of a comment area.
  46.  
  47.   Macro generally end with:
  48.  
  49. //*************************************************************************
  50. //             Comment Here Indicating What Macro  <DATE>
  51. //*************************************************************************
  52.  
  53.   and you could mark the ' /** .... '  as the start of a block and then
  54.   search for ' //***... ' for the end of each macro.  At least that is
  55.   how it worked when I tested it ;-).
  56.  
  57. ┌────────────────┐
  58. │REVISION HISTORY│
  59. └────────────────┘
  60.  
  61. 10/21/94:  Start TIP4 with forgotten macros in the original public
  62.            release.
  63.  
  64.                 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  65.  
  66. //***********************  Start Comment Area *****************************
  67. /**************************************************************************
  68.  
  69. ===========================================================================
  70.                 Date: 06-22-93  From: RICHARD HENDRICKS
  71.                     Subj: Convert:Grphic Box 2 Text
  72. ---------------------------------------------------------------------------
  73.  
  74.   'grp2txt.s'  OLD one but a GOLD one
  75.  
  76.   Sometimes I need to convert all the Extended ASCII graphics characters to
  77.   more printable or e-mailable characters. Here is a macro that I wrote that
  78.   does that.
  79.  
  80.   WARNING:  Do NOT execute this macro on the source file ('grp2txt.s')
  81.             or all of the graphic characters that are used for searching
  82.             purposes will be converted and thereafter the source file
  83.             will be corrupt.
  84.  
  85.                                                   ╔══════════════════════╗
  86. For example -- the file contains boxes like:      ╠══════════════════════╣
  87.                                                   ║                      ║
  88.                                                   ║                      ║
  89.                                                   ╚══════════════════════╝
  90.  
  91.   run GRP2TXT and you will now have:              +----------------------+
  92.                                                   +----------------------+
  93.                                                   |                      |
  94.                                                   |                      |
  95.                                                   +----------------------+
  96.  
  97.   Richard // Saturday June 19, 1993 at 14:56:34 EST
  98.  
  99. //*********************** END of MAIN Comment Area *************************
  100. ***************************************************************************/
  101.  
  102. // grp2txt.S  03/27/1992  12/09/1992
  103. // by Richard Hendricks
  104.  
  105. // Suggests by STEVE WATKINS, SemWare & RICHARD BLACKBURN, SemWare
  106.  
  107. proc Main()
  108.     pushposition()
  109.     begfile()
  110.     replace('[┤╡╢╖╕╣╗╝╜╛┐└┴┬├┼╞╟╚╔╩╦╠╬╧╨╤╥╙╘╒╓╫╪┘┌█]','+','qxnq')
  111.     // replace('[┤-╣╗-├┼-╠╬-┌]','+','gxnq') --- shorter but less
  112.     // readable form of line above
  113.     begfile()
  114.     replace('[║│░▒▓▌▐]', '|', 'gxnq')
  115.     begfile()
  116.     replace('[─═▄▀]', '-', 'gxnq')
  117.     popposition()
  118. end main
  119.  
  120. // end-of-message
  121. //*************************************************************************
  122. //             Convert boxes to text characters 06/22/93
  123. //*************************************************************************
  124.  
  125. ===========================================================================
  126.                  Date: 09-29-93  From: GEORGE DE BRUIN
  127.                    Subj: Temporarily changing margin
  128. ---------------------------------------------------------------------------
  129.  
  130.   If you just want to change the setting for the right margin while the
  131.   mWrapPara() command is being executed, you could write a short macro:
  132.  
  133. proc mWrap()
  134.     integer rm = Set(RightMargin, 55)  // Find the current right margin
  135.                                        // Set new right margin, save old
  136.  
  137.     mWrapPara()                        // Wrap the paragraph
  138.     Set(RightMargin, rm)               // Set the right margin back to
  139.                                        // the old value
  140. end
  141.  
  142.   This temporarily changes the margin for wrapping but would keep the
  143.   right margin set the way it normally is, but allow you to have it at a
  144.   different setting for wrapping.  This macro would need to be inserted in
  145.   your TSE.S file. The best place for the macro would be right above the
  146.   lines:
  147.  
  148. /****************************************************************************
  149.   Macro to wrap text in a column block, without distrubing the surrounding
  150.   text.
  151.   If a column isn't marked, the normal WrapPara() is called.
  152.  ***************************************************************************/
  153. proc mWrapPara()
  154. .
  155. .
  156.  
  157. //*************************************************************************
  158.                   Temporarily Change Margin  09/30/93
  159. //*************************************************************************
  160.  
  161. //***********************  Start Comment Area *****************************
  162. /**************************************************************************
  163.  
  164. ===========================================================================
  165.                 Date: 10-25-93  From: RICHARD BLACKBURN
  166.                 Subj: Synchronized Windows Macro!! v.02
  167. ---------------------------------------------------------------------------
  168.  
  169. The following macro will scroll all windows together.  You need to assign
  170. ScrollWindows() to a key.  When you want to lock the windows together press
  171. the key you have assigned to ScrollWindows().  When you want to stop
  172. scrolling the windows press <Escape>.  Works with Horoz. or Vert. windows.
  173.  
  174. The following macro should fix the problem:  (Original had a minor glitch)
  175.  
  176. //*********************** END of MAIN Comment Area *************************
  177. ***************************************************************************/
  178.  
  179. constant    cLEFT        = 1,
  180.             cRIGHT       = 2,
  181.             cUP          = 3,
  182.             cDOWN        = 4,
  183.             cPAGEUP      = 5,
  184.             cPAGEDOWN    = 6,
  185.             cBEGLINE     = 7,
  186.             cBEGFILE     = 8,
  187.             cENDLINE     = 9,
  188.             cENDFILE     = 10
  189.  
  190. proc Scroll(integer direction)
  191.     case direction
  192.         when cLEFT           Left()
  193.         when cRIGHT          Right()
  194.         when cUP             Up()
  195.         when cDOWN           Down()
  196.         when cPAGEUP         PageUp()
  197.         when cPAGEDOWN       PageDown()
  198.         when cBEGLINE        BegLine()
  199.         when cBEGFILE        BegFile()
  200.         when cENDLINE        EndLine()
  201.         when cENDFILE        EndFile()
  202.     endcase
  203. end
  204.  
  205. proc mScrollWindows(integer direction)
  206.     integer winid = WindowId(), num = 1
  207.  
  208.     while num < 10
  209.         if GotoWindow(num)
  210.             Scroll(direction)
  211.         endif
  212.         num = num + 1
  213.     endwhile
  214.     GotoWindow(winid)
  215.     if winid == 1
  216.         Scroll(direction)
  217.     endif
  218. end
  219.  
  220. keydef ScrollKeys
  221. <CursorLeft>        mScrollWindows(cLEFT)
  222. <CursorRight>       mScrollWindows(cRIGHT)
  223. <CursorUp>          mScrollWindows(cUP)
  224. <CursorDown>        mScrollWindows(cDOWN)
  225. <PgUp>              mScrollWindows(cPAGEUP)
  226. <PgDn>              mScrollWindows(cPAGEDOWN)
  227. <Home>              mScrollWindows(cBEGLINE)
  228. <Ctrl PgUp>         mScrollWindows(cBEGFILE)
  229. <End>               mScrollWindows(cENDLINE)
  230. <Ctrl PgDn>         mScrollWindows(cENDFILE)
  231. <Escape>            EndProcess()
  232. end
  233.  
  234. proc ScrollWindows()
  235.     Enable(ScrollKeys)
  236.     Process()
  237.     Disable(ScrollKeys)
  238. end
  239.  
  240. <CtrlAlt S> ScrollWindows()
  241.  
  242. /**************************************************************************
  243. ===========================================================================
  244.                  Date: 01-05-94  From: DAVID GOODENOUGH
  245.             Subj: Quote Reformatting / Wrap Quoted Paragraph
  246. ---------------------------------------------------------------------------
  247.  
  248. > I'd really like to be able to re-format a quoted paragraph (like with
  249. > the Wrap Paragraph command) but keep the initials "AB>" in the left hand
  250. > column (I believe some message editors do this, so I assume TSE can!).
  251.  
  252.   mWrapQPara() is the one that you bind to a key.
  253.  
  254.   To activate it, take a paragraph like:
  255.  
  256. AB> This is some text that is quoted and it would be really nice if it
  257. could be
  258. AB> re-formatted quickly and easily.
  259.  
  260.   and sit on the 'T' of "This". Then invoke the macro, and this is
  261.   what you wind up with:
  262.  
  263. AB> This is some text that is quoted and it would be really nice if it
  264. AB> could be re-formatted quickly and easily.
  265.  
  266. TAKnote:  This macro wraps from the cursor location to the end of a
  267.           paragraph.  It is useful, therefore for partial wrap paragraph
  268.           from the cursor.
  269.  
  270. ***************************************************************************/
  271.  
  272. integer proc mKillQuote(string quotetext, integer numch)
  273.     integer i
  274.  
  275.     BegLine()
  276.     if GetText(1, numch) == quotetext
  277.         i = 0
  278.         while numch <> i
  279.             DelChar()
  280.             i = i + 1
  281.         endwhile
  282.     endif
  283.     return (iif(CurrChar() >= 0, 1, 0))
  284. end
  285. proc mWrapQPara()
  286.     string quotetext[20]
  287.     integer numch
  288.     integer i
  289.  
  290.     UnMarkBlock()
  291.     MarkChar()
  292.     BegLine()
  293.     MarkChar()
  294.     quotetext = GetMarkedText()
  295.     numch = Length(quotetext)
  296.     UnMarkBlock()
  297.     if numch <> 0
  298.         MarkLine()
  299.         repeat
  300.             i = mKillQuote(quotetext, numch)
  301.         until not i or not Down()
  302.         if not i
  303.             Up()
  304.         endif
  305.         MarkLine()
  306.         GotoBlockBegin()
  307.         WrapPara()              //changed from mWrapPara()  10/21/94 tak
  308.         GotoBlockBegin()
  309.         i = 1
  310.         while i and isCursorInBlock()
  311.             Begline()
  312.             InsertText(quotetext, _INSERT_)
  313.             i = Down()
  314.         endwhile
  315.         UnMarkBlock()
  316.     endif
  317. end mWrapQPara
  318.  
  319. <CtrlAlt J>  mWrapQPara()         //Change to suit your setup
  320.  
  321. //*************************************************************************
  322. //        Quote Reformatting / Wrap Quoted Paragraph  01/05/94
  323. //*************************************************************************
  324.  
  325. ===========================================================================
  326.                  Date: 09-28-94  From: GEORGE DE BRUIN
  327.                        Subj: Up() & Down() Alarm
  328. ---------------------------------------------------------------------------
  329.  
  330.   /---------------------------------------
  331.   |What I'd like to do is have TSE beep (such as the beep that sounds on
  332.   |failed searches) whenever the Down(), and Up(), reaches the bottom and
  333.   |top limits!
  334.   \---------------------------------------
  335.  
  336. No problem!  Just modify your key assignments as follows:
  337.  
  338.     <Up>    if not Up() then Alarm() endif
  339.     <Down>  if not Down() then Alarm() endif
  340.  
  341. Then burn-in your new configuration, and you should be set.
  342.  
  343. //*************************************************************************
  344. //*************************************************************************
  345. ===========================================================================
  346.                  Date: 10-04-94  From: GEORGE DE BRUIN
  347.                  Subj: Adding KeyBinding to Calendar()
  348. ---------------------------------------------------------------------------
  349.  
  350.   ┌─────┴─────────────────────────────────
  351.   │Hi George. I loaded the Calendar, and executed the compiled macro from
  352.   │the menu. What is the pop-up hot key for that calendar screen? Looks
  353.   │otherwise pretty nice. Thanks Semware for a nice feature included. :-)
  354.   └─────┬─────────────────────────────────
  355.  
  356.   There isn't a specific key to pop-up the calendar.  The macro is set up
  357.   to be executed from the Potpourri menu.  If you wanted to assign it to a
  358.   key in your standard user interface, you would have to modify the macro
  359.   itself.
  360.  
  361.   Add the following to the end of the CALENDAR.S file, and recompile
  362.   (using <CTRL F9>).  This will allow you to pop-up the calendar using
  363.   <CtrlShift C>:
  364.  
  365.       proc ShowCal()
  366.  
  367.         Enable( CalKeys, _EXCLUSIVE_ )
  368.         DisplayCalendar()
  369.  
  370.       End
  371.  
  372.       <CtrlShift C>   ShowCal()
  373.  
  374. //*************************************************************************
  375.                Adding KeyBinding to Calendar()  10/04/94
  376. //*************************************************************************
  377.  
  378. /**************************************************************************
  379. ===========================================================================
  380.                     Date: 10-11-94  From: RAY ASBURY
  381.                    Subj: ASCII display on Status Line
  382. ---------------------------------------------------------------------------
  383.  
  384.   ┌───<<<             >>>───────────────────────────────────────────────┐
  385.   │Seriously, I was wondering if anyone has a macro to display the      │
  386.   │ASCII/Hex value of the character above the cursor on the status line?│
  387.   │This could make my life complete...  :-)                             │
  388.   └───>>>     <<<───────────────────────────────────────────────────────┘
  389.  
  390.  
  391.   ADD THE FOLLOW STUFF SOMEWHERE NEAR THE BEGINNING OF YOUR *.UI FILE
  392.  
  393. ***************************************************************************/
  394.  
  395.     FORWARD         PROC pnShowSpecialStats()
  396.     FORWARD INTEGER PROC piShortenFileName()
  397.  
  398.     STRING      fsBuf[250],
  399.                 fsCFName[250]
  400.  
  401.     INTEGER              fiLastCurrChar
  402.  
  403.     PROC WhenLoaded()
  404.  
  405.         // ADD THESE THREE LINES TO YOUR EXISTING STUFF IN *.UI
  406.  
  407.         Hook(_IDLE_, pnShowSpecialStats)
  408.         Hook(_AFTER_UPDATE_STATUSLINE_, pnShowSpecialStats)
  409.         SetGlobalInt("giShowSpecialStats", TRUE)
  410.     END WhenLoaded
  411.  
  412.     // ADD THE FOLLOWING TWO MACROS TO YOUR *.UI FILE
  413.  
  414.     PROC pnShowSpecialStats()
  415.  
  416.         STRING  lsStr[15]   = ""
  417.  
  418.         INTEGER liAttr,
  419.                 liCurrChr,
  420.                 liAttribs,
  421.                 liLineLoc   = 1
  422.  
  423.         IF (NOT GetGlobalInt("giShowSpecialStats"))
  424.             IF (GetGlobalInt("giSpecStatsUpdateStatLine"))
  425.                 SetGlobalInt("giSpecStatsUpdateStatLine", FALSE)
  426.                 UpdateDisplay(_STATUSLINE_REFRESH_)
  427.             ENDIF
  428.             Return()
  429.         ENDIF
  430.  
  431.         IF (Query(StatusLineAtTop) == FALSE)
  432.             liLineLoc = Query(ScreenRows)
  433.         ENDIF
  434.  
  435.   /* GET CURRENT FILE'S ATTRIBUTES ************************************/
  436.  
  437.         liAttribs = FileExists(CurrFileName())
  438.         IF (liAttribs & _READONLY_)
  439.             lsStr = lsStr + "R"
  440.         ELSE
  441.             lsStr = lsStr + Chr(Query(StatusLineFillChar))
  442.         ENDIF
  443.         IF (liAttribs & _ARCHIVE_)
  444.             lsStr = lsStr + "A"
  445.         ELSE
  446.             lsStr = lsStr + Chr(Query(StatusLineFillChar))
  447.         ENDIF
  448.         IF (liAttribs & _SYSTEM_)
  449.             lsStr = lsStr + "S"
  450.         ELSE
  451.             lsStr = lsStr + Chr(Query(StatusLineFillChar))
  452.         ENDIF
  453.         IF (liAttribs & _HIDDEN_)
  454.             lsStr = lsStr + "H"
  455.         ELSE
  456.             lsStr = lsStr + Chr(Query(StatusLineFillChar))
  457.         ENDIF
  458.  
  459.  /* GET CURR CHAR ASCII CODES ****************************************/
  460.  
  461.         liCurrChr = CurrChar()
  462.         IF (liCurrChr < 0)
  463.             lsStr = Format(lsStr, Chr(Query(StatusLineFillChar)),
  464.                             "<AT_EOL>":-8:Chr(Query(StatusLineFillChar)))
  465.         ELSE
  466.             fiLastCurrChar = liCurrChr
  467.             lsStr = Format(lsStr, Chr(Query(StatusLineFillChar)),
  468.                             fiLastCurrChar:2:"0":16, "h,",
  469.                             fiLastCurrChar:3:"0", "d")
  470.         ENDIF
  471.         liAttr = Set(Attr, Query(StatusLineAttr))
  472.         IF (piShortenFileName())
  473.             VGotoXY(35, liLineLoc)
  474.             PutStr(fsCFName)
  475.         ENDIF
  476.         VGotoXY(Query(ScreenCols) - 12, liLineLoc)
  477.         PutStr(lsStr)
  478.         Set(Attr, liAttr)
  479.     END pnShowSpecialStats
  480.  
  481.     INTEGER PROC piShortenFileName()
  482.  
  483.         INTEGER liMaxLength = Query(ScreenCols) - 48,
  484.                 liStart
  485.  
  486.         fsCFName = CurrFileName()
  487.         IF (Length(fsCFName) <= liMaxLength)
  488.             Return(FALSE)
  489.         ENDIF
  490.         fsBuf = fsCFName
  491.         fsCFName = Format(SubStr(fsCFName, 1, 3), "...\")
  492.         fsBuf = SubStr(fsBuf, 4, (Length(fsBuf) - 3))
  493.         WHILE (Length(fsBuf) > (liMaxLength - 7))
  494.             liStart = Pos("\", fsBuf)
  495.             fsBuf = SubStr(fsBuf, (liStart + 1), (Length(fsBuf) - liStart))
  496.         ENDWHILE
  497.         fsCFName = Format(fsCFName,
  498.                             fsBuf:-(liMaxLength - 7):Chr(
  499.                                     Query(StatusLineFillChar)))
  500.         fsCFName = Format(fsCFName:-(liMaxLength + 1):
  501.                             Chr(Query(StatusLineFillChar)))
  502.         Return(TRUE)
  503.     END piShortenFileName
  504.  
  505.  
  506. //  E. Ray Asbury, Jr. (rasbury@msmailpc01.saic.com)
  507. //  Team TSE
  508.  
  509. //*************************************************************************
  510. //                Display ASCII on Status Line  10/12/94
  511. //*************************************************************************
  512.  
  513. /**************************************************************************
  514. ===========================================================================
  515.                  Date: 10-14-94  From: GEORGE DE BRUIN
  516.                          Subj: Remove Bookmarks
  517. ---------------------------------------------------------------------------
  518.  
  519.   ┌─────┴─────────────────────────────────
  520.   │I have BOOK.MAC auto loaded and it works GREAT!  I was wondering however
  521.   │if there is a way to delete a bookmark once it has been set.  You see, I
  522.   │also use PROJECTS and the bookmarks being set add up after a while.  It
  523.   │would be nice to be able to delete the marks no longer needed.  No big
  524.   │deal but was just wondering.
  525.   └─────┬─────────────────────────────────
  526.  
  527.   Believe it or not, this is a trickier question than it would seem. <g>
  528.   But we put on our collective thinking caps, and came up with a creative
  529.   solution.  Try this macro, it will remove all of the Marks you have
  530.   set (even the ones you haven't set! <g>) using the Book macro:
  531.  
  532. ***************************************************************************/
  533.  
  534.     proc KillPlaceMarks()
  535.  
  536.         Integer tBuf = CreateTempBuffer(),
  537.                    c = 97
  538.  
  539.         If tBuf
  540.             GotoBufferId(tBuf)              // Create a TempBuffer
  541.         else
  542.             Warn("Could Not Create Temporary Buffer!!!")
  543.             Return()
  544.         endif
  545.  
  546.         While c <= 122                 // Set PlaceMarks In TempBuffer
  547.             PlaceMark(Chr(c))
  548.             C = C + 1                  // Added from subsequent message
  549.         EndWhile
  550.  
  551.         AbandonFile()                  // Abandon the TempBuffer!
  552.     End
  553.  
  554.     <Ctrl 5>    KillPlaceMarks()
  555.  
  556. /**************************************************************************
  557.  
  558.   In a subsequent message Ralph Weeks said:
  559.  
  560.   Works pretty good after making a minor adjustment.  I added C = C + 1
  561.   right after PlaceMark(Chr(C)).  Thanks for the quick reply....you guys
  562.   ARE REALLY GOOD.
  563.  
  564. ***************************************************************************/
  565.  
  566. //*************************************************************************
  567. //                     Remove Bookmarks  10/14/94
  568. //*************************************************************************
  569.  
  570. ===========================================================================
  571.                  Date: 10-17-94  From: JACK HAZLEHURST
  572.                            Subj: FRCapture()
  573. ---------------------------------------------------------------------------
  574.  
  575. >>  What I  do is to work out my regular expressions and debug them
  576. >>  using Find() or Replace() from inside TSE.   The problem is that you
  577. >>  run  into  trouble  when you want to transfer your results BACK into
  578. >>  your text file.   To this end I have added the following macro to my
  579. >>  UI:
  580.  
  581. //
  582. // Macro to copy Find and Replace strings to the current cursor position
  583. //
  584. proc FRCapture( integer HB )            // Parameter is history buffer number.
  585.     string S[128] = ""
  586.  
  587.     if Ask( "Pick a string:", S, HB )   // Let the user pick something.
  588.         InsertText( S )                 // Stuff to the buff.
  589.     endif
  590. end
  591.  
  592. Menu FRStrMenu()                        // Menu lets user select Find or
  593.     title = "Get which?"                // Replace string.
  594.  
  595.     "&Find string"      , FRCapture(_FIND_HISTORY_)
  596.     "&Replace string"   , FRCapture(_REPLACE_HISTORY_)
  597. end
  598.  
  599.  
  600.   I bind the menu to a key (I also have a menu selection for it in the
  601.   Search menu).   When I hit the key,  up comes  the  choice  of  Find
  602.   string or Replace string.   It works as though there it is a two-key
  603.   macro,  and I usually don't have to look at the little  menu,   but,
  604.   what the hey -- in case I forget.
  605.  
  606.   I  just  put  a couple of double quotes in the text,  put the cursor
  607.   over the second one,  then use this macro to  copy  in  the  desired
  608.   string.
  609.  
  610.   The  use  of  the history buffer this way allows you to have a whole
  611.   bunch of experiments going and just hit the down-arrow go  back  and
  612.   fetch the variant you want to use.
  613.  
  614.   As you can see, the FRCapture() takes a parameter that specifies the
  615.   history to use,  so  you  can  add  stuff  to  the  menu,   such  as
  616.   _EDIT_HISTORY_,  or your own private histories.   For now, the macro
  617.   as shown is all I need.
  618.  
  619.   I limited the string size to 128 since that's the limit of the  Find
  620.   and Replace strings in TSE.
  621.  
  622. //*************************************************************************
  623.                          FRCapture()  10/17/94
  624. //*************************************************************************
  625.  
  626. ===========================================================================
  627.                  Date: 10-19-94  From: GEORGE DE BRUIN
  628.                            Subj: Colors macro
  629. ---------------------------------------------------------------------------
  630. ┌─────┴─────────────────────────────────
  631. │highlighted text setting.  After setting Group L, shown as the last
  632. │available spare in the menu, the macro notified me that Group M existed
  633. │and was configured the same as the highlighted text.  Ditto for Group N.
  634. │Am I doing something wrong?  Where can I access Group M and N (and any
  635. │subsequent Groups)?  The macro is useful and more Spare Groups seems
  636. │great but I need a way to reconfigure them.
  637. └─────┬─────────────────────────────────
  638.  
  639.   Ian ran out of menu space for the extra color groups.  In his haste to
  640.   get things done, he forgot that he has a loop that checks all of the
  641.   group colors...  Alas, his loop checks for 16 groups, instead of the 12
  642.   that he was able to implement.
  643.  
  644.   So, the trick here is to change the SENTRY.S file so that it only checks
  645.   the twelve group colors that are available.  Load SENTRY.S into TSE,
  646.   and find the mCheckAllColors() proc.  A short ways into this proc you
  647.   will find the following section of code:
  648.  
  649.   SpinCheck:
  650.   i = 1
  651.   while i <= 16
  652.             if gs[i] == Chr(Query(BlockAttr))
  653.  
  654.   The '16' needs to be changed to a 12.  Once you have made this change,
  655.   save the file and press <Ctrl F9>.  When the macro is done compiling,
  656.   you will be prompted to Load / Execute the macro. You can go ahead and
  657.   select either of these options.
  658.  
  659.   Thats it.  The non-existent "Group-M" problem should never get in your
  660.   way again.
  661.  
  662.  
  663. //*************************************************************************
  664.                         COLORS bug fix  10/19/94
  665. //*************************************************************************
  666.  
  667. ===========================================================================
  668.                  Date: 10-19-94  From: GEORGE DE BRUIN
  669.                        Subj: Invalid keystrokes??
  670. ---------------------------------------------------------------------------
  671.  
  672.   ┌─────┴─────────────────────────────────
  673.   │I have discovered that when I try to assign a function to the
  674.   │keystrokes <Ctrl ,> (Ctrl-comma) or <Ctrl .> (Ctrl-period),
  675.   │I get, e.g.:
  676.   │
  677.   │      Error 112 (1939,1)    unknown key  <Ctrl ,>
  678.   │      .....                 unknown key  <Ctrl .>
  679.   └─────┬─────────────────────────────────
  680.  
  681.   Correct, these keys are not supported by TSE.  If you try them
  682.   with Showkey, you would see that they do not return a value.
  683.  
  684.   The PC doesn't support them.
  685.  
  686. //*************************************************************************
  687.                                 10/19/94
  688. //*************************************************************************
  689.  
  690. ===========================================================================
  691.                  Date: 10-19-94  From: GEORGE DE BRUIN
  692.                           Subj: SpellWrdLeft()
  693. ---------------------------------------------------------------------------
  694.  
  695.   ┌─────┴─────────────────────────────────
  696.   │the left of the word in question.  Not having the patience simple
  697.   │batch files tax me.  Is there something I can do to have the "Word"
  698.   │function in the spell checker look at the word to the left of the
  699.   │cursor?
  700.   └─────┬─────────────────────────────────
  701.  
  702.   Actually, a relatively simple macro should do the trick for this:
  703.  
  704.     proc SpellWrdLeft()
  705.         PushPosition()
  706.         PushBlock()
  707.         WordLeft()
  708.         PushKey(<w>)
  709.         ExecMacro("Spellchk")
  710.         PopBlock()
  711.         PopPosition()
  712.     end
  713.  
  714.  
  715.     <CtrlAlt F1>     SpellWrdLeft()
  716.  
  717.   Just copy the above code into a .S file in the \TSE\MAC directory (for
  718.   example: \TSE\MAC\CHKWORD.S), change the key assignment to use the key
  719.   that you want, and press <Ctrl F9> to compile the macro.
  720.  
  721.   Now, to add it to your configuration so it loads every time you load
  722.   TSE, goto the (M)acro menu and select (A)utoLoad List.  Press insert to
  723.   add a new entry, and type the name of the macro file without the
  724.   extension (ie, for the example above: CHKWORD).  Press <Escape> several
  725.   times until you get back to the editing buffer.
  726.  
  727. //*************************************************************************
  728.                                 10/19/94
  729. //*************************************************************************
  730.  
  731. ===========================================================================
  732.                  Date: 10-19-94  From: GEORGE DE BRUIN
  733.                      Subj: Inserting Printer Codes
  734. ---------------------------------------------------------------------------
  735.  
  736.   ┌─────┴─────────────────────────────────
  737.   │What I'm not sure about is the best way of putting together a macro.
  738.   │(e.g., a menu in one macro? separate macros for each key? Any help
  739.   │much appreciated.
  740.   └─────┬─────────────────────────────────
  741.  
  742.   You can do this one either way.  The thing that you need to know is the
  743.   InsertText() command.  If you were to do this as key assignments, it
  744.   would look like this:
  745.  
  746.  
  747.   <Ctrl><F4>     InsertText("(s0p12h12v0s0b1q6T", _INSERT_)
  748.   <Ctrl><F5>     InsertText("(s0p12h12v0s0b6T", _INSERT_)
  749.   <Ctrl><F6>     InsertText("(s0p12h12v1s0b6T", _INSERT_)
  750.   <Ctrl><F7>     InsertText("(s1p12v0s0b4101T", _INSERT_)
  751.   <Ctrl><F8>     InsertText("(s1p12v1s0b4101T", _INSERT_)
  752.   //  ^ Escape Character In
  753.   //     this column
  754.  
  755.   If you wanted to put these on a menu instead, it would look like this:
  756.  
  757.   // This should be placed before the key assignments.
  758.  
  759.   menu mFonts()
  760.  
  761.   Title = "Fonts Menu"
  762.  
  763.   "Letter Gothic &Draft 12 pt" ,InsertText("(s0p12h12v0s0b1q6T", _INSERT_)
  764.   "Letter &Gothic 12 pt"       ,InsertText("(s0p12h12v0s0b6T", _INSERT_)
  765.   "Letter Gothic &Italic 12 pt",InsertText("(s0p12h12v1s0b6T", _INSERT_)
  766.   "&Times Roman 12 pt"         ,InsertText("(s1p12v0s0b4101T", _INSERT_)
  767.   "Times &Roman Italic 12 pt"  ,InsertText("(s1p12v1s0b4101T", _INSERT_)
  768.   //  ^ Escape Character In
  769.   //     this column
  770.   end
  771.  
  772.  
  773.   <Ctrl F5>   mFonts()        // This line would be in the key assignments area
  774.  
  775.   It's really up to you, and what you think will be easier.
  776.  
  777.   You can try out both of these, and decide which you like better.  Note
  778.   that if you want to change the hot-keys on the mFonts() menu, just move
  779.   the &'s in front of the appropriate letters, making sure that you don't
  780.   use the same letter on two different entries.
  781.  
  782. //*************************************************************************
  783.                     Entering Printer Codes  10/19/94
  784. //*************************************************************************
  785.  
  786. /**************************************************************************
  787. ===========================================================================
  788.                  Date: 10-21-94  From: GEORGE DE BRUIN
  789.                           Subj: Book.S Change
  790. ---------------------------------------------------------------------------
  791.  
  792. >  I have 'book.mac' autoloaded and it work GREAT!  I was wondering if
  793. >  there is a way to delete a bookmark once it has been set.  In PROJECTS
  794. >  the bookmarks add up after a while.
  795.  
  796.   Believe it or not, this is a trickier question than it would seem.
  797.   <g> But we put on our collective thinking caps, and came up with a
  798.   creative solution.  Try this macro, it will remove all of the Marks
  799.   you have set (even the ones you haven't set! <g>) using the Book
  800.   macro:
  801.  
  802. ***************************************************************************/
  803.  
  804.     proc KillPlaceMarks()
  805.         Integer tBuf = CreateTempBuffer(),
  806.                    c = 97
  807.         If tBuf
  808.             GotoBufferId(tBuf)              // Create a TempBuffer
  809.         else
  810.             Warn("Could Not Create Temporary Buffer!!!")
  811.             Return()
  812.         endif
  813.         While c <= 122
  814.             PlaceMark(Chr(c))
  815.             C = C + 1           // Added by Ralph Weeks
  816.         EndWhile
  817.         AbandonFile()           // Abandon the TempBuffer!
  818.     End
  819.  
  820.     <Ctrl 5>    KillPlaceMarks()
  821.  
  822. /**************************************************************************
  823.  
  824. In an another message Ralph Weeks said:
  825.  
  826.   Works pretty good after making a minor adjustment.  I added C = C + 1
  827.   right after PlaceMark(Chr(C)).  Thanks for the quick reply....you guys
  828.   ARE REALLY GOOD.
  829.  
  830. ***************************************************************************/
  831.  
  832. //*************************************************************************
  833. //                 KILL book.mac Bookmarks  10/22/94
  834. //*************************************************************************
  835.  
  836. /**************************************************************************
  837. ===========================================================================
  838.                 Date: 10-26-94  From: RICHARD BLACKBURN
  839.                      Subj: Word Count w/output file
  840. ---------------------------------------------------------------------------
  841.  
  842.   See if this macro is more to your liking.  I did not know that you were
  843.   depending on the output file from Tom's macro.  I wrongly assumed you
  844.   were just using it for the word count (which is what the macro is
  845.   supposed to do :))
  846.  
  847. ***************************************************************************/
  848.  
  849. proc wc(integer normal)
  850.     string WordSet[32] = ""
  851.     integer cid = GetBufferId(), tid = 0
  852.  
  853.     tid = CreateBuffer("!")
  854.     if NOT tid
  855.         Warn("ERROR in setup")
  856.         return()
  857.     endif
  858.     GotoBufferId(cid)
  859.  
  860.     if normal
  861.         WordSet = Set(WordSet,ChrSet("0-9A-Z_a-z"))
  862.     else
  863.         WordSet = Set(WordSet,ChrSet("~ \t"))
  864.     endif
  865.     PushPosition()
  866.     PushBlock()
  867.     BegFile()
  868.     repeat
  869.         if MarkWord()
  870.             AddLine(GetMarkedText(), tid)
  871.         endif
  872.     until NOT WordRight()
  873.     PopBlock()
  874.     PopPosition()
  875.     Set(WordSet, WordSet)
  876.     GotoBufferId(tid)
  877. end
  878.  
  879. <Alt 9>     wc(1)
  880. <Alt 0>     wc(0)
  881.  
  882. //*************************************************************************
  883.                    Word Count w/output file  10/26/94
  884. //*************************************************************************
  885.  
  886. //***********************  Start Comment Area *****************************
  887. /**************************************************************************
  888. ===========================================================================
  889.                  Date: 10-27-94  From: GEORGE DE BRUIN
  890.                Subj:  Modified SetDataBuffer()  10/27/94
  891. ---------------------------------------------------------------------------
  892.  
  893.   ┌───────────────────
  894.   │again. The Procomm aspect language has explicit, one-word
  895.   │commands to open a file, to read (the next line of) the file,
  896.   │to pass the string read to become the next value of a string
  897.   │variable, and to test for end of file (so as to break out of the
  898.   │loop when all conferences have been read).  I'm hoping for
  899.   └───────────────────
  900.  
  901.   By modifying SetDataBuff() a bit you would have those commands for TSE.
  902.   Here's a modified SetDataBuff() that would allow you to open a file:
  903.  
  904.   The GetString() proc already returns a Null string if any of the
  905.   following things happen:
  906.  
  907.     - The buffer doesn't exist
  908.     - The line number you passed in doesn't exist (ie, if you try to
  909.       read past the end of the file.)
  910.     - There is nothing on the line you asked for (ie, it already is
  911.       Null).
  912.  
  913.   Also, realize that this has the advantage of allowing you to access the
  914.   lines in any order you want to.  You aren't forced to access it
  915.   sequentially.
  916.  
  917. //*********************** END of MAIN Comment Area *************************
  918. ***************************************************************************/
  919.  
  920. // Open data buffer - Returns buffer ID
  921. // ----------------------------------------------------------------------
  922. integer proc SetDataBuff(string fn[255])
  923.     integer cID = GetBufferID(),
  924.             dID = 0
  925.  
  926.     dID = CreateTempBuffer()              // Create the Temporary Buffer
  927.     if dID
  928.         PushBlock()                       // Save current block
  929.         UnMarkBlock()                     // UnMark Current Block
  930.         InsertFile(fn)                    // Insert The Datafile
  931.         UnMarkBlock()                     // UnMark Inserted Data
  932.         PopBlock()                        // Restore Previous Block
  933.         GotoBufferID(cID)                 // Go back to original buffer
  934.     else
  935.         Warn("Could Not Create Buffer!")  // Warn user if there was an error
  936.     endif
  937.     Return(dID)
  938. end
  939.  
  940.  
  941. //*************************************************************************
  942.                    Modified SetDataBuffer()  10/27/94
  943. //*************************************************************************
  944.  
  945. ===========================================================================
  946.                  Date: 10-28-94  From: GEORGE DE BRUIN
  947.                       Subj: Command Line Interface
  948. ---------------------------------------------------------------------------
  949.  
  950.   ┌─────┴─────────────────────────────────
  951.   │LIST.COM has a startup switch, "/s", that allows output to the
  952.   │console to be piped to LIST, so that it can be viewed with all of
  953.   │LIST's features.  For example:
  954.   └─────┬─────────────────────────────────
  955.  
  956.  
  957.   Richard Hendricks wrote a macro during the Beta cycle that does this:
  958.  
  959.   proc DeletePipeFile()       // added 06/02/1994 -- /d"dos cmd"
  960.        EraseDiskFile( LoadDir()+"!!PIPE!!.!!!" )
  961.   end DeletePipeFile
  962.  
  963.   proc mPipe()
  964.        string NewDOStail[150] //  /d"dos cmd"
  965.        string QuoteChr[1]=chr(0)  //  /d"dos cmd"; user is using ' or "
  966.        string SwitchChr[1]=chr(0) //  /d"dos cmd"; user used /d or -d
  967.        string DOStail[150] = Query( DOSCMDLINE )      // added 06/02/1994 -- /d"dos cmd"
  968.  
  969. // Execute any DOS commands that are supplied on the command line
  970.  
  971.   if( pos( "/d", Lower( DOStail ) ) )
  972.     SwitchChr = "/"
  973.   endif
  974.   if( pos( "-d", Lower( DOStail ) ) )
  975.     SwitchChr = "-"
  976.   endif
  977.   if( pos( SwitchChr+"d", Lower( DOStail ) ) )
  978.     DOStail = Trim( SubStr( Lower( DOStail ),
  979.               pos( SwitchChr+"d", lower( DOStail ) )+2, 255 ) )
  980.     if( DOStail[1] == '"' )
  981.       QuoteChr = '"'
  982.     endif
  983.     if( DOStail[1] == "'" )
  984.       QuoteChr = "'"
  985.     endif
  986.     if( QuoteChr[1] == "'" or QuoteChr[1] == '"' )
  987.       DOStail = substr( DOStail, 2, 255 )
  988.       DOStail = substr( DOStail, 1, iif( pos( QuoteChr, DOStail ),
  989.                 pos( QuoteChr, DOStail )-1, 255 ) )
  990.       DOS( DOStail+" >"+LoadDir()+"!!PIPE!!.!!!", _DONT_PROMPT_|_DONT_CLEAR_ )
  991.  
  992. //   Compose a NEW DOSCMDLINE that doesn't include the /d"dos command" and
  993. //   includes !!PIPE.!!!
  994.  
  995.       DOStail = Query( DOSCMDLINE )
  996.       NewDOStail = SubStr( DOStail, 1, pos( SwitchChr+"d",
  997.                    Lower( DOStail ) )-1 ) +
  998.                    " "+LoadDir()+"!!PIPE!!.!!! "
  999.       DOStail    = Trim( SubStr( DOStail, pos( SwitchChr+"d",
  1000.                    Lower( DOStail ) )+2, 255 ) )
  1001.       DOStail    = SubStr( DOStail, 2, 255 )
  1002.       NewDOStail = NewDOStail + SubStr( DOStail,
  1003.                    iif( pos( QuoteChr, DOStail ),
  1004.                    pos( QuoteChr, DOStail )+1, 255 ), 255 )
  1005.       Set( DOSCMDLINE, NewDOStail )
  1006.       Hook( _ON_ABANDON_EDITOR_, DeletePipeFile )
  1007.     endif
  1008.   endif
  1009. end
  1010.  
  1011.   To install this macro, just add the above code right before the
  1012.   WhenLoaded() proc in your UI file.  Then, near the end of the
  1013.   WhenLoaded(), add a call to mPipe().
  1014.  
  1015.   To use this with TSE, all you need to do is execute the editor using the
  1016.   /d command line parameter, and pass in the DOS command that you want to
  1017.   see in quotes.  For example, if I wanted to view a listing of a
  1018.   directory in TSE:
  1019.  
  1020.     e /d"dir"
  1021.  
  1022. //*************************************************************************
  1023.                     Command Line Interface  10/28/94
  1024. //*************************************************************************
  1025.  
  1026. //*************************************************************************
  1027. ===========================================================================
  1028.                      Date: 10-29-94  From: TOM HALL
  1029.                      Subj: Modification to Template
  1030. ---------------------------------------------------------------------------
  1031.   I've been trying _really_ hard to find something wrong with TSE 2.0... :-)
  1032.  
  1033.   The closest I could come was a modification to the way the Template Editor
  1034.   operates.
  1035.  
  1036.   The special case of "\c" or "\C" got me to thinking: if "\C" forces insert
  1037.   mode ON, why not simply have "\c" force insert mode OFF?
  1038.  
  1039.   My particular application of this feature involves positioning the cursor
  1040.   in the middle of a line of text, and since I always had to hit the Insert
  1041.   key because I wanted to fill in some whitespace at the cursor position, I
  1042.   asked myself, "why not have the Template Editor turn it off for me?".
  1043.  
  1044.   So, after some experimentation, I came up with the following modification
  1045.   to TEMPLATE.S:
  1046.  
  1047.     // see if user has specified cursor location
  1048.     if lFind('\c','gli')
  1049.         ScrollToRow(CurrLine() - delta)
  1050.         DelChar()
  1051.         if (CurrChar() == ASC('C')) // special handling required!
  1052.             if Set(Insert, ON) == OFF
  1053.                 cursor_line = CurrLine()
  1054.                 SetGlobalInt("Template->Editing",TRUE)
  1055.                 Hook(_AFTER_UPDATE_DISPLAY_, RestoreInsert)
  1056.             endif
  1057.         endif
  1058.  
  1059. // THIS SECTION ADDED BY ME
  1060.  
  1061.         if (CurrChar() == ASC('c')) // set insert explicitly OFF
  1062.             Set(Insert,OFF)
  1063.                 cursor_line = CurrLine()
  1064.                 SetGlobalInt("Template->Editing",TRUE)
  1065.                 Hook(_AFTER_UPDATE_DISPLAY_, RestoreInsert)
  1066.             endif
  1067.  
  1068. // END ADDED SECTION
  1069.  
  1070.         DelChar()
  1071.     elseif
  1072.         GotoBlockEnd()
  1073.         if CurrChar() >= 0 and not isWhite()
  1074.             InsertText(" ",_INSERT_)
  1075.         else
  1076.             Right()
  1077.         endif
  1078.     endif
  1079. end
  1080.  
  1081. //*************************************************************************
  1082.                    Modification to Template  10/29/94
  1083. //*************************************************************************
  1084.  
  1085. ===========================================================================
  1086.                    Date: 10-29-94  From: RALPH WEEKS
  1087.                         Subj: mCompressView use
  1088. ---------------------------------------------------------------------------
  1089.  
  1090. >  I'm looking for an editor which will allow me, when programming in C,
  1091. >  to (a) see a "pop-up" list of all function names, then (b) by picking
  1092. >  one, moving the screen to that function.
  1093.  
  1094.   Yes, this function is built into the TSE editor.  It can easily be
  1095.   configured to handle any programming language.  Where I work we have an
  1096.   inhouse language and it took only a few minutes to configure TSE to
  1097.   handle the our function names. If you have TSE now then search the .UI
  1098.   file for mCompressView and review the 'case CurrExt()' section.
  1099.  
  1100. //*************************************************************************
  1101. //*************************************************************************
  1102.  
  1103. //*************************************************************************
  1104.                    Modification to Template  10/29/94
  1105. //*************************************************************************
  1106.  
  1107. ===========================================================================
  1108.                    Date: 10-31-94  From: DAVID MARCUS
  1109.                       Subj: Using Global Variables
  1110. ---------------------------------------------------------------------------
  1111.  
  1112. >  macros are limited to 16k? Is there a way to get around the 16k limit?
  1113.  
  1114.   FWIW, the easiest way to reduce the size is to reduce static strings.
  1115.  
  1116.   HOWEVER, it sounds as if you're going to need to end up dividing your
  1117.   procs into two or more files. One way to get around the multitude of
  1118.   set/get globals is to put the values you want to pass around into a
  1119.   buffer, and set the buffer number as a global int. Or, if a lot of
  1120.   your values are single-integer values, put them into a string and use
  1121.   it as an array. Then just pass around the string via a global.
  1122.  
  1123.   But, the best technique I've found is to write two procs. One writes
  1124.   every setting I use to globals, the other reads them. Put them into a
  1125.   file that has [more or less] nothing else in it. Then #INCLUDE this
  1126.   file in all of the macro files for a particular "cross-file" macro.
  1127.   In the primary file, you might have something like this:
  1128.  
  1129.   proc tsgrep()
  1130.     ...
  1131.     set_all_globals()
  1132.     execmacro('TSGREP2')
  1133.     get_all_globasl()
  1134.     ...
  1135.     ...
  1136.     ...
  1137.     set_all_globals()
  1138.     execmacro('TSGREP3')
  1139.     get_all_globasl()
  1140.     ...
  1141.     ...
  1142. end
  1143.  
  1144. The main() function in TSGREP2 and TSGREP3 would then do
  1145.  
  1146.     get_all_globals()
  1147.     foo1()
  1148.     foo2()
  1149.     foo3()
  1150.     foo4()
  1151.     foo5()
  1152.     set_all_globals()
  1153.  
  1154.   where foo?s are the procs that really do whatever work I need done.
  1155.  
  1156.   Hope this helps.... it is the technique I used in TSGREP, which ended
  1157.   up as a 64k macro.
  1158.  
  1159.  
  1160. //*************************************************************************
  1161.                     Using Global Variables  10/31/94
  1162. //*************************************************************************
  1163.  
  1164. ===========================================================================
  1165.                     Date: 10-31-94  From: MEL HULSE
  1166.                        Subj: SmartReplace() Macro
  1167. ---------------------------------------------------------------------------
  1168.  
  1169.        Paul Lenz posted this great idea on the SemWare BBS.  I've
  1170.             twiddled it a bit to increase its functionality.
  1171. ---------------------------------------------------------------------------
  1172.  
  1173.   PL> This macro adds the "Local" option to the Replace Options if
  1174.   PL> a block is marked:
  1175.  
  1176.   May I extend it a bit?  When replacing without a marked block
  1177.   after replacing with one, the with block options are presented.
  1178.   The following resets the defaults after a block find.
  1179.  
  1180.   Also, it is handy to do a replace in a block from wherever the
  1181.   cursor is.  Adding the option "G" (global) does this.
  1182.  
  1183.   Here's the mod:
  1184.  
  1185. PROC SmartReplace()
  1186.   // Paul Lenz, October 25, 1994
  1187.   // Minor mode, Mel Hulse, October 31, 1994
  1188.  
  1189.     if isBlockMarked()
  1190.         AddHistoryStr(Query(ReplaceOptions) + "LG", _REPLACEOPTIONS_HISTORY_)
  1191.         Replace()
  1192.         AddHistoryStr(Query(ReplaceOptions), _REPLACEOPTIONS_HISTORY_)
  1193.     Else
  1194.         Replace()
  1195.     EndIf
  1196. END
  1197.  
  1198. //*************************************************************************
  1199.                   SmartReplace() even better  10/31/94
  1200. //*************************************************************************
  1201.  
  1202. //***********************  Start Comment Area *****************************
  1203. /**************************************************************************
  1204.  
  1205.  Taken from the SemWare BBSs 'quote11.zip' file with one enhancement
  1206. ===========================================================================
  1207.  
  1208. /*   Quote, v.1.1.01, October 31, 1994 TAK added blank line after quote
  1209. /*   Quote, v.1.1,    October 22, 1994
  1210.  
  1211.   Places a quote line at the beginning of a BBS network message that is
  1212.   derived from the header information placed within the file by your
  1213.   off-line mail reader.  The macro will then delete the header
  1214.   information before continuing with your reply.
  1215.  
  1216.   This macro was adapted by Mel Hulse based on a macro by Richard
  1217.   Blackburn, SemWare Technical Support.
  1218.  
  1219.   Because the names and subject can each be 25 characters long, It
  1220.   is possible that the quote line could exceed 80 characters.  If
  1221.   your name is very long, you may want to disable showing the
  1222.   subject.
  1223.  
  1224. Sample header:
  1225.  
  1226. ===========================================================================
  1227.  BBS: SEMWARE
  1228. Date: 10-11-91 (18:39)             Number: 305  COMPEASE
  1229. From: FROM NAME                    Refer#: 281
  1230.   To: TO NAME                       Recvd: YES
  1231. Subj: Standard Quote Macro           Conf: (15) RoadRNR
  1232. ---------------------------------------------------------------------------
  1233.  
  1234. The intro quote line will look like:
  1235.  
  1236. On Wed. the 10th FROM NAME wrote TO NAME about "Standard Quote Macro":
  1237.  
  1238. This macro can be made to operate automagically by adding the
  1239. following within the OnFirstEdit() proc in your TSE.UI at the end
  1240. and deleting the key binding at the end of this file.
  1241.  
  1242. ===========================================================================
  1243.  
  1244. PROC OnFirstEdit()                  // add if not there
  1245.  
  1246.  If SplitPath(CurrFileName(), _NAME_|_EXT_) == "reply.msg" //lower case req'd
  1247.      PushPosition()              // save our cursor position
  1248.      Down()                      // go to second line of file
  1249.      If GetText(1,3) == "On "    // check to see if quote line already there
  1250.          Return()                // if so, quit
  1251.      Else                        // otherwise
  1252.          LoadMacro("Quote")      // get the macro
  1253.          ExecMacro("Quote")      // and execute it
  1254.      EndIf
  1255.      PopPosition()               // restore the cursor
  1256.  EndIf
  1257.  
  1258. End
  1259.  
  1260. ===========================================================================
  1261.  
  1262.   If you make the above a file you can #INCLUDE this file in your TSE.UI
  1263.   immediately following the keybindings.  If you use the OnFirstEdit()
  1264.   above then you will automatically generate the quote line and delete
  1265.   the header.
  1266.  
  1267. //*********************** END of Comment Area ******************************
  1268. ***************************************************************************/
  1269.  
  1270. /*
  1271.     Day of the week macro using Zeller's Congruence.
  1272.     By Mel Hulse, April 10, 1993
  1273. */
  1274.  
  1275. String PROC DayOfWeek(Integer Month, Integer Day, Integer Year)
  1276.     Integer DOW, Y1, Y2
  1277.  
  1278.     If Month < 3
  1279.         Month = Month + 10
  1280.         Year = Year - 1
  1281.     Else
  1282.         Month = Month - 2
  1283.     EndIf
  1284.  
  1285.     Y1 = (Year * 10) / 1000
  1286.     Y2 = Year Mod 100
  1287.  
  1288.     DOW =  1+((Day+(26*Month-1)/10)+Y2+(Y2/4)+(Y1/4)-(2*Y1)+49) Mod 7
  1289.  
  1290.     Case DOW mod 7
  1291.         When 1    Return("Sun.")
  1292.         When 2    Return("Mon.")
  1293.         When 3    Return("Tue.")
  1294.         When 4    Return("Wed.")
  1295.         When 5    Return("Thu.")
  1296.         When 6    Return("Fri.")
  1297.         Otherwise Return("Sat.")
  1298.     EndCase
  1299.     Return("Fake It Out!")
  1300. END
  1301.  
  1302.  
  1303. String Proc FormatDate(String Date)
  1304. /*
  1305. Convert the message MM-DD-YY date into quote format "Wednesday the 10th"
  1306. */
  1307.     String  Suffix[2] = ""              // st, nd, rd, th
  1308.  
  1309.     Integer Day,
  1310.             Month,
  1311.             Year
  1312.  
  1313.     Month = Val(SubStr(Date,1,2))       // convert date components to integer
  1314.     Day   = Val(SubStr(Date,4,2))
  1315.     Year  = Val(SubStr(Date,7,2))
  1316.  
  1317.     If Year <= 90                       // expand 2-digit year
  1318.         Year = Year + 2000
  1319.     Else
  1320.         Year = Year + 1900
  1321.     EndIf
  1322.  
  1323.     Case Day
  1324.         When  1 Suffix = "st"
  1325.         When  2 Suffix = "nd"
  1326.         When  3 Suffix = "rd"
  1327.         When 21 Suffix = "st"
  1328.         When 22 Suffix = "nd"
  1329.         When 23 Suffix = "rd"
  1330.         When 31 Suffix = "st"
  1331.     Otherwise
  1332.                Suffix = "th"
  1333.     EndCase
  1334.  
  1335.     // return the date string to calling function
  1336.     // include call to StrDayOfWeek function
  1337.     Return(DayOfWeek(Month, Day, Year) + " the " + Str(Day) + suffix)
  1338. End FormatDate
  1339.  
  1340. PROC Quote()
  1341.  
  1342. string  From[25]     = "",          //  who the message is from
  1343.         To[25]       = "",          //  who the message is to
  1344.         Date[8]      = "",          //  from header
  1345.         Subject[25]  = ""           //  from header
  1346.  
  1347.  
  1348. // Get the header info or quit, if no a header in the file.
  1349.     BegFile()                       // goto begining of the file
  1350.     if (GetText(2, 2) <> "==" )     // if no equal signs assume no header
  1351.         PopPosition()
  1352.         Return()                    // no header, quit
  1353.     else
  1354.  
  1355. //*****Blank line after header even if original message was on top line ***
  1356.  
  1357.         Down(7)
  1358.         If CurrLine() <> 0
  1359.                 CReturn()
  1360.                 BegFile()
  1361.         EndIf
  1362.         BegFile()
  1363.         lFind("Date:","^")          // move to date line
  1364.         Date = GetText(7, 14)       // get date field
  1365.         lFind("From:","^")          // move to "From:" line
  1366.         From = GetText( 7, 28 )     // get "from" field
  1367.         lFind("  To:","^")          // move to "To:" line
  1368.         To = GetText( 7, 28 )       // get "to" field
  1369.         lFind("Subj:","^")          // move to "Subj:" field
  1370.         Subject = GetText( 7, 28 )  // get "subject" field
  1371.         BegFile()                   // goto start of file
  1372.         DelLine( 7 )                // delete the header
  1373.         CReturn()                   // leave an empty line at the top
  1374. // Insert quote line in the message
  1375.         InsertLine('On ' + FormatDate(Date) +
  1376.                 ' ' + RTrim(From) +
  1377.                 ' wrote ' + RTrim(To) +
  1378.                 ' about "' + RTrim(subject) +
  1379.                 '"')
  1380.         Down(2)
  1381.     EndIf
  1382. END
  1383.  
  1384. <CtrlAlt Q>           Quote()        // don't use this if using OnFirstEdit()
  1385.  
  1386.  
  1387. //*************************************************************************
  1388.                            Quote11+  10/31/94
  1389. //*************************************************************************
  1390.  
  1391. /**************************************************************************
  1392. ===========================================================================
  1393.                  Date: 11-02-94  From: GEORGE DE BRUIN
  1394.                           Subj: Finding words
  1395. ---------------------------------------------------------------------------
  1396.  
  1397.   ┌─────┴─────────────────────────────────
  1398.   │Do you remember that I asked if there was a way to search a file
  1399.   │against a list of words in another file?  As 2.0 was just shipping
  1400.   │you asked if I could put this request on hold for a while.
  1401.   └─────┬─────────────────────────────────
  1402.  
  1403.   Here's a greatly expanded version of the macro.  This one does a _lot_
  1404.   of error checking (much more than is normally needed).  This is just for
  1405.   testing purposes, after we determine what we need in the macro, I will
  1406.   shorten and speed it up.
  1407.  
  1408.   Search for //! to change user input information
  1409.  
  1410. ***************************************************************************/
  1411. //! Enter the name of the file that contains words to search for
  1412. String NameFile[] = "D:\NAMES"      // Set the name of list file here
  1413.  
  1414. String Name1[20] = "", Name2[20] = "", Name3[20] = ""
  1415. integer nBufId = 0, cBufId = 0
  1416.  
  1417. proc On_Exit()
  1418.  
  1419.     if not AbandonFile(nBufId)
  1420.         Warn("Unable to abandon list buffer!")
  1421.     endif
  1422. end
  1423.  
  1424. proc WhenLoaded()
  1425.     cBufId = GetBufferId()  // Get buffer ID of current buffer
  1426.  
  1427.     // Set up names list buffer
  1428.  
  1429.     PushPosition()
  1430.     PushBlock()
  1431.     nBufId = CreateBuffer("++Names++")      // Temporary buffer
  1432.     if not nBufId
  1433.         warn("Unable to create Names List buffer! Aborting...")
  1434.         AbandonFile()
  1435.         PurgeMacro(SplitPath(CurrMacroFileName(), _NAME_))
  1436.         return()
  1437.     endif
  1438.     if not InsertFile(NameFile)
  1439.         warn("Unable to read ",NameFile,"!  Macro aborting.")
  1440.         AbandonFile()
  1441.         PurgeMacro(SplitPath(CurrMacroFileName(), _NAME_))
  1442.         return()
  1443.     endif
  1444.     UnMarkBlock()
  1445.     FileChanged(FALSE)
  1446.     PopBlock()
  1447.     PopPosition()
  1448.  
  1449.     Hook(_ON_EXIT_CALLED_, ON_EXIT)
  1450. end
  1451.  
  1452. proc mGetNameErr(string no)
  1453.  
  1454.     warn("Name #",no," not marked!")
  1455.     down()
  1456. end
  1457.  
  1458. proc mGetNames()
  1459.     GotoPos(PosFirstNonWhite())
  1460.     if MarkWord()
  1461.         Name1 = GetMarkedText()
  1462.         UnMarkBlock()
  1463.         WordRight()
  1464.     else
  1465.         mGetNameErr("1")
  1466.         return()
  1467.     endif
  1468.     if MarkWord()
  1469.         Name2 = GetMarkedText()
  1470.         UnMarkBlock()
  1471.         WordRight()
  1472.     else
  1473.         mGetNameErr("2")
  1474.         return()
  1475.     endif
  1476.     if MarkWord()
  1477.         Name3 = GetMarkedText()
  1478.         UnMarkBlock()
  1479.     else
  1480.         mGetNameErr("3")
  1481.         return()
  1482.     endif
  1483.     Down()
  1484. end
  1485.  
  1486. proc rr8()
  1487.  
  1488.     cBufId = GetBufferId()  // Get current file ID
  1489.  
  1490.     GotoBufferId(nBufId)    // Goto the names list
  1491.     mGetNames()             // Get the names
  1492.     GotoBufferId(cBufId)    // Return to the original Buffer
  1493.     if Name1 <> "" and Name2 <> "" and Name3 <> ""
  1494.         // Search for the names from list
  1495.         if not Find("{"+Name1+"}|{"+Name2+"}|{"+Name3+"}", "GX")
  1496.             warn("Search Failed!")
  1497.         endif
  1498.     else
  1499.         Warn("One of the name strings is null???")
  1500.     endif
  1501. end
  1502.  
  1503. <Alt =>     rr8()
  1504.  
  1505. //*************************************************************************
  1506.          Finding Words with word list in another file  11/02/94
  1507. //*************************************************************************
  1508.  
  1509. ===========================================================================
  1510.                  Date: 11-04-94  From: GEORGE DE BRUIN
  1511.                     Subj: Justify() Entire Document
  1512. ---------------------------------------------------------------------------
  1513.  
  1514.   /---------------------------------------
  1515.   | Is there anyone who has a macro that will Justify a Complete
  1516.   | document and Justify it BETWEEN the Left and Right Margin
  1517.   | settings?
  1518.   \---------------------------------------
  1519.  
  1520.   There is a macro included with TSE to justify a paragraph.  The macro is
  1521.   called JUSTIFY, and is listed on the Potpourri menu (via the Util menu,
  1522.   or <Shift F10>).
  1523.  
  1524.   Knowing this is available, you could have a macro that walks through the
  1525.   file and justifies each paragraph until the end of the file is reached.
  1526.   Here is such a macro:
  1527.  
  1528.     proc JustifyAll()
  1529.  
  1530.        PushPosition()
  1531.        PushBlock()
  1532.        UnMarkBlock()
  1533.        BegFile()
  1534.        while down()
  1535.            ExecMacro("justify")
  1536.        endwhile
  1537.        PopBlock()
  1538.        PopPosition()
  1539.     end
  1540.  
  1541.    <Shift F11>     JustifyAll()
  1542.  
  1543. //*************************************************************************
  1544.                          JustifyAll()  11/04/94
  1545. //*************************************************************************
  1546.  
  1547. ===========================================================================
  1548.             ┌──────────────────────────────────────────────┐
  1549.             │TAK Information Exchange; Fort Wayne, Indiana │
  1550.             └──────────────────────────────────────────────┘
  1551.    InterNet: tom.klein@chrbbs.sccsi.com  OR tom.klein@lunatic.com
  1552.  
  1553. ===========================================================================
  1554.  
  1555.         ┌─────────────────────────────────────────────────────┐
  1556.         │              Additions to ClipMenu() -              │
  1557.         │WordWrap(on|off), mSetRightMargin(), mSetLeftMargin()│
  1558.         └─────────────────────────────────────────────────────┘
  1559.  
  1560.   I find that I often need to change word wrap, right and left margins
  1561.   quite often and to make it easier I have added these items to the
  1562.   ClipMenu() that is activated with the right mouse button.  The items
  1563.   must be added to the Menu ClipMenu() area of your 'tse.ui'.
  1564.  
  1565.   Menu ClipMenu()
  1566.     x = 10
  1567.     y = 5
  1568.     history
  1569.  
  1570.     "Cu&t"              ,   Cut()
  1571.     "C&ut Append"       ,   Cut(_APPEND_)
  1572.     "&Copy"             ,   Copy()
  1573.     "Cop&y Append"      ,   Copy(_APPEND_)
  1574.     ""                  ,                       , Divide
  1575.     "&Paste"            ,   Paste()
  1576.     "Paste &Over"       ,   Paste(_OVERWRITE_)
  1577.     ""                  ,                       , Divide
  1578.     "Un&Mark"           ,   UnMarkBlock()
  1579.     "&Named ClipBoards  ", NamedClipBoardMenu(), DontClose
  1580.  
  1581. // Additions to ClipBoardMenu start here
  1582.  
  1583.     ""                  ,                       , Divide
  1584.     "&WordWrap"   [OnOffStr(Query(WordWrap)):3], Toggle(WordWrap),
  1585.            DontClose
  1586.     "&RIGHT Margin"  [Query(RightMargin):3], mSetRightMargin(), DontClose
  1587.     "&Left Margin"   [Query(LeftMargin):3],  mSetLeftMargin() , DontClose
  1588.  
  1589. // Additions to ClipBoardMenu END here
  1590.  
  1591. end
  1592.  
  1593. ---------------------------------------------------------------------------
  1594.   You need to add these two items to you 'tse.ui' before the line ---
  1595. // Global variables - assumes globals initialized to 0.
  1596.  
  1597. Forward proc mSetRightMargin()
  1598. Forward proc mSetLeftMargin()
  1599.  
  1600. and add the following procedures to you 'tse.ui' before your keydef or
  1601. before the line #include ["tse.key"]
  1602.  
  1603. //*****mRight & mLeft MARGIN***********************************************
  1604.  
  1605. // Thursday -  June 30, 1994 changed to new version from Ray Waters
  1606. // mSetRightMargin()-keypad 6/CursorRight
  1607. // mSetLeftMargin()-keypad 4/CursorLeft
  1608. //*************************************************************************
  1609.  
  1610. proc mSetRightMargin()
  1611.  
  1612.     string s[3] = str(query(RightMargin))
  1613.     ask("Right Margin [1..255]: ", s)
  1614.     if val(s) > 255
  1615.         warn("Value out of range: ")
  1616.         return()
  1617.     endif
  1618.     set(RightMargin, val(s))
  1619.  
  1620. End  mSetRightMargin    // bound to keypad 6/CursorRight
  1621.  
  1622. //*************************************************************************
  1623.  
  1624. proc mSetLeftMargin()
  1625.  
  1626.     string s[3] = str(query(LeftMargin))
  1627.     ask("Left Margin [1..255]: ", s)
  1628.     if val(s) > 255
  1629.         warn("Value out of range: ")
  1630.         return()
  1631.     endif
  1632.     set(LeftMargin, val(s))
  1633.  
  1634. End mSetLeftMargin      // bound to keypad 4/CursorLeft
  1635.  
  1636. ===========================================================================
  1637.  
  1638.   In addition to using the mSet.....Margin() procedures in the ClipMenu()
  1639.   you can assign the procedures to keys and I used the keypad items.
  1640.   NUMLOCK must be on for these assignments to function.
  1641.  
  1642.   <keypad4>    mSetLeftMargin()
  1643.   <keypad6>    mSetRightMargin()
  1644.  
  1645.   These two key assignments can be place in your keydef area or in you
  1646.   'tse.key' file depending on which you are using.
  1647.  
  1648.   The Set...Margin() procedures QUERY the current value of the margins
  1649.   and displays that value in the prompt box.
  1650.  
  1651. //*************************************************************************
  1652. //                    ClipMenu() Changes  11/04/94
  1653. //*************************************************************************
  1654.  
  1655.             END  'tse_tips4.txt'  Sunday -  November 6, 1994
  1656.  
  1657.