home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / UE311CMD.ZIP / CAL1.CMD < prev    next >
OS/2 REXX Batch file  |  1990-06-19  |  2KB  |  100 lines

  1. ;    CAL1.CMD:    Interactive Calendar Macro
  2. ;            Asterics "**" replace the current date
  3. ;            in the current month.
  4. ;            Inspired by m.cs.uiuc.edu!reingold who
  5. ;            did a calendar for GNUmacs
  6. ;            (C)opyright 1989 by Ian Ornstein
  7. ;            Last Update Fri Feb 17 1989
  8. ;    Permission is granted to copy, distribute and use this software
  9. ;    wherever Daniel M Lawrence's MicroEMACS is used.
  10. ;
  11. execute-file calutil.cmd
  12. ;
  13. run save-ctx
  14. run get-window
  15. set %calcol 27
  16. *today
  17.     run get-date
  18.     run month-number
  19.     set %ynum  %curyear
  20.     select-buffer "*Calendar*" 
  21.     run disp1mon
  22.     beginning-of-file
  23.     search-forward %curday
  24.     2 backward-character
  25.     overwrite-string "**"
  26.     beginning-of-file
  27.     unmark-buffer
  28.     !goto question
  29. ;
  30. *displayit
  31.     run disp1mon
  32.     beginning-of-file
  33.     unmark-buffer
  34.     !goto question
  35. ;
  36. *getmonth
  37.     set %mnum @"Enter month number (1-12): "
  38.     !if &and &gre %mnum 0 &les %mnum 13
  39.         !goto getyear
  40.     !else
  41.      set %ans @"Month must be an number from 1 to 12   Press RETURN to Continue"
  42.         !goto getmonth
  43.     !endif
  44. *getyear
  45.     set %ynum @"Enter year number (yyyy): "
  46.     !if &and &gre %ynum 1988 &les %ynum 2000
  47.         !goto displayit
  48.     !else
  49.  set %ans @"Year must be an number from 1989 to 1999   Press RETURN to Continue"
  50.         !goto getyear
  51.     !endif
  52. ;
  53. *help
  54. set %helpmsg @"n-next, b-back, c-current, o-other, e-exit  Press RETURN to Continue"
  55.     !goto question
  56. ;
  57. *question
  58.     update-screen
  59.     set %calopt @"Enter Calendar Option (or ? for help): "
  60.     !if &seq %calopt "e"
  61.         !goto finish
  62.     !else
  63.         !if &seq %calopt "b"                       ;backward
  64.             set %mnum &sub %mnum 1
  65.             !if &equ %mnum 0
  66.                 set %mnum 12
  67.                 set %ynum &sub %ynum 1
  68.             !endif
  69.             !goto displayit
  70.         !else
  71.             !if &seq %calopt "n"                ;forward
  72.                 set %mnum &add %mnum 1
  73.                 !if &equ %mnum 13
  74.                     set %mnum 1
  75.                     set %ynum &add %ynum 1
  76.                 !endif
  77.                 !goto displayit
  78.             !else
  79.                 !if &seq %calopt "c"            ;current
  80.                     !goto today
  81.                 !else
  82.                     !if &seq %calopt "o"        ;other
  83.                         !goto getmonth
  84.                     !else
  85.                         !if &seq %calopt "?"    ;help
  86.                             !goto help
  87.                         !endif
  88.                     !endif
  89.                 !endif
  90.             !endif
  91.         !endif
  92.     !endif
  93. ;
  94. *finish
  95.     next-window
  96.     run restore-ctx
  97. clear-message-line
  98. ;
  99.  
  100.