home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / memacs32.zip / newpage.cmd < prev    next >
OS/2 REXX Batch file  |  1993-08-07  |  3KB  |  135 lines

  1. ;    NEWPAGE.CMD:    Startup page Loader
  2. ;            for MicroEMACS 3.9d and above
  3. ;            (C)opyright 1987 by Daniel M Lawrence
  4.  
  5. ; Get rid of the last page
  6.     set $discmd FALSE
  7.     write-message [Cleaning]
  8.     !force run clean
  9.  
  10. !force    delete-buffer "[clean]"
  11.  
  12. ; make sure the function key window is up
  13.     set %rcfkeys FALSE
  14.     toggle-fkeys
  15.  
  16. !if ¬ $pending
  17.  
  18.     ; Write out the page load instructions
  19.     save-window
  20.     1 next-window
  21.     beginning-of-file
  22.     set $curcol 25
  23.     overwrite-string "           Available Pages to Load:                 "
  24.     next-line
  25.     set $curcol 25
  26.     overwrite-string "    [W]  WORDprocessing  [P]  Pascal  [L] Lisp      "
  27.     next-line
  28.     set $curcol 25
  29.     overwrite-string "    [E]  EMACS macroes   [C]  C                     "
  30.     next-line
  31.     set $curcol 18
  32.     overwrite-string "    "
  33.     set $curcol 25
  34.     overwrite-string "    [B]  Block editing   [O]  Cobol                 "
  35.     next-line
  36.     set $curcol 25
  37.     overwrite-string "[space]  to load a user page                        "
  38.     unmark-buffer
  39.     beginning-of-file
  40.     !force restore-window
  41.     update-screen
  42.  
  43.  
  44. ; prompt for the page
  45.  
  46.     write-message "Page to load: "
  47. !endif
  48.  
  49. *prompt
  50.     set %rctmp >cmd
  51.  
  52.     ;eat mouse moves
  53.     !if &or &or &seq %rctmp "MSm" &seq %rctmp "S-MSm" &seq %rctmp "MS^m"
  54.         !goto prompt
  55.     !endif
  56.  
  57.     clear-message-line
  58.  
  59. ; check for mouse press
  60.  
  61.     !if &seq &left %rctmp 2 "MS"
  62.  
  63.         save-window
  64.         !force mouse-move-down
  65.  
  66.         ;eat the mouse up
  67.         set %junk >cmd
  68.  
  69.         ;If not in the function key window... don't bother
  70.         !if ¬ &sequal $cbufname "Function Keys"
  71.             restore-window
  72.             !goto prompt
  73.         !endif
  74.  
  75.         forward-character
  76.         !force search-reverse "["
  77.         !if &seq $status FALSE
  78.             restore-window
  79.             !goto prompt
  80.         !endif
  81.  
  82.         !force forward-character
  83.         set %rctmp &chr $curchar
  84.         !if &seq %rctmp "s"
  85.             set %rctmp " "
  86.         !endif
  87.         set %rctmp &lower %rctmp
  88.         restore-window
  89.     !endif
  90.  
  91. ; check for an abort
  92.     !if &seq %rctmp "^G"
  93.         write-message "[Aborted]"
  94.         save-window
  95.         1 next-window
  96.         beginning-of-file
  97.         set $curcol 25
  98.         overwrite-string "   MicroEMACS:  Text Editor                         "
  99.         next-line
  100.         set $curcol 25
  101.         overwrite-string "                                                    "
  102.         next-line
  103.         set $curcol 25
  104.         overwrite-string "  Available function key Pages include:             "
  105.         next-line
  106.         set $curcol 25
  107.         overwrite-string "    WORD  BOX  EMACS  PASCAL  C                     "
  108.         next-line
  109.         set $curcol 25
  110.         overwrite-string "  [use the f8 key to load Pages]                    "
  111.         unmark-buffer
  112.         beginning-of-file
  113.         !force restore-window
  114.         set $discmd TRUE
  115.         !return
  116.     !endif
  117.     
  118. ; if it is an unlisted page, get it's name
  119.     !if &seq %rctmp " "
  120.         set %rcfile &cat @"Name of Page to load: " ".cmd"
  121.     !else
  122.         set %rcfile &cat %rctmp "page.cmd"
  123.     !endif
  124.  
  125. ; see if this is a legit file
  126.     !if &seq &find %rcfile ""
  127.         write-message "%No Such Page, Page to load: "
  128.         !goto prompt
  129.     !endif
  130.  
  131. ;and lastly, execute it
  132.  
  133.     execute-file %rcfile
  134.     set $discmd TRUE
  135.