home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / UE311CMD.ZIP / NEWPAGE.CMD < prev    next >
OS/2 REXX Batch file  |  1991-10-30  |  3KB  |  128 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.     clear-message-line
  52.  
  53. ; check for mouse press
  54.  
  55.     !if &seq &left %rctmp 2 "MS"
  56.         save-window
  57.         !force mouse-move-down
  58.  
  59.         ;eat the mouse up
  60.         set %junk >cmd
  61.  
  62.         ;If not in the function key window... don't bother
  63.         !if ¬ &sequal $cbufname "Function Keys"
  64.             restore-window
  65.             !goto prompt
  66.         !endif
  67.  
  68.         forward-character
  69.         !force search-reverse "["
  70.         !if &seq $status FALSE
  71.             restore-window
  72.             !goto prompt
  73.         !endif
  74.  
  75.         !force forward-character
  76.         set %rctmp &chr $curchar
  77.         !if &seq %rctmp "s"
  78.             set %rctmp " "
  79.         !endif
  80.         set %rctmp &lower %rctmp
  81.         restore-window
  82.     !endif
  83.  
  84. ; check for an abort
  85.     !if &seq %rctmp "^G"
  86.         write-message "[Aborted]"
  87.         save-window
  88.         1 next-window
  89.         beginning-of-file
  90.         set $curcol 25
  91.         overwrite-string "   MicroEMACS:  Text Editor                         "
  92.         next-line
  93.         set $curcol 25
  94.         overwrite-string "                                                    "
  95.         next-line
  96.         set $curcol 25
  97.         overwrite-string "  Available function key Pages include:             "
  98.         next-line
  99.         set $curcol 25
  100.         overwrite-string "    WORD  BOX  EMACS  PASCAL  C                     "
  101.         next-line
  102.         set $curcol 25
  103.         overwrite-string "  [use the f8 key to load Pages]                    "
  104.         unmark-buffer
  105.         beginning-of-file
  106.         !force restore-window
  107.         set $discmd TRUE
  108.         !return
  109.     !endif
  110.     
  111. ; if it is an unlisted page, get it's name
  112.     !if &seq %rctmp " "
  113.         set %rcfile &cat @"Name of Page to load: " ".cmd"
  114.     !else
  115.         set %rcfile &cat %rctmp "page.cmd"
  116.     !endif
  117.  
  118. ; see if this is a legit file
  119.     !if &seq &find %rcfile ""
  120.         write-message "%No Such Page, Page to load: "
  121.         !goto prompt
  122.     !endif
  123.  
  124. ;and lastly, execute it
  125.  
  126.     execute-file %rcfile
  127.     set $discmd TRUE
  128.