home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR8 / SLMRHELP.ZIP / SLMRHELP.S < prev    next >
Text File  |  1993-09-30  |  5KB  |  86 lines

  1. /******************************************************************************/
  2. /* Macro file : SLMRHELP.S                                                    */
  3. /* Programmer : Todd Fiske                                                    */
  4. /*                                                                            */
  5. /* Purpose    : Routines to provide some entry and exit processing for        */
  6. /*              editing replies and messages in SLMR via TSE                  */
  7. /*                                                                            */
  8. /* Revision   : 09/29/1993 - first version                                    */
  9. /* History                                                                    */
  10. /*                                                                            */
  11. /* Language   : SAL 1.0 (Pre-Release)                                         */
  12. /*                                                                            */
  13. /******************************************************************************/
  14.  
  15. /******************************************************************************/
  16. /* Globals                                                                    */
  17. /******************************************************************************/
  18. integer
  19.    main_buffer = 0 //                  primary message-editing buffer
  20.  
  21. string //                              tear line text
  22.    tear_line[] = '------------tear-line-------everything-above-this-line-will-be-deleted!!--------'
  23.  
  24. /******************************************************************************/
  25. /* Procedure  : Exit Process                                                  */
  26. /******************************************************************************/
  27. proc ExitProcess()
  28.    GotoBufferID(main_buffer) //        return to primary message editing buffer
  29.    if lFind(tear_line, '^g') //        if tear line found at start of line
  30.       BegFile() //                     go to top of file
  31.       MarkChar() //                    start a block
  32.       lRepeatFind() //                 mark up to...
  33.       Down() //                        ...and including the tear line...
  34.       Down() //                        ...and the blank line following
  35.       DelBlock() //                    delete it
  36.    endif
  37.    // else, user may have already cleaned it up
  38. end
  39.  
  40. /******************************************************************************/
  41. /* Function S : Proper - very simple proper-casing function                   */
  42. /******************************************************************************/
  43. string proc Proper(string sName)
  44.    string sWork[30] = sName
  45.    Lower(sWork)
  46.    return ( UpCase(sWork) + SubStr(sWork, 2, Length(sWork)-1 ) )
  47. end
  48.  
  49. /******************************************************************************/
  50. /* Procedure  : When Loaded                                                   */
  51. /******************************************************************************/
  52. proc WhenLoaded()
  53.    string
  54.       sender_name[30] = ""
  55.  
  56.    BegFile() //                        try to get parent message senders name
  57.    if lFind('From:', '^g') //          look for From: label at start of line
  58.       WordRight() //                   go to next word
  59.       MarkWord() //                    mark it
  60.       sender_name = Proper( GetMarkedText() ) // snip it and proper-case it
  61.       UnMarkBlock()
  62.  
  63.       EndFile() //                     go to end of file
  64.       AddLine(tear_line) //            add a tear line
  65.       AddLine() //                     add another blank line
  66.  
  67.       AddLine('Hi  -') //              add salutation
  68.       BegFile() EndFile() //           leave first line visible if possible
  69.       Left() Left() //                 move to within salutation
  70.  
  71.       InsertText(sender_name, _INSERT_) // insert it into the salutation
  72.       EndLine() //                     go to end of line
  73.       CReturn() //                     add two blank lines, leaving cursor
  74.       CReturn() //                     at eof in ready-to-write position
  75.  
  76.       main_buffer = GetBufferID() //   save id of current buffer
  77.       Hook(_ON_EXIT_CALLED_, ExitProcess) // link exit process
  78.    endif
  79.  
  80.    // else, if not found, assume that we're not in a message file, so don't do
  81.    // any special processing
  82.  
  83.    Set(RightMargin, 79) //          set right margin
  84.    Set(WordWrap,    ON) //          turn word wrap on
  85. end
  86.