home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 274.lha / NazCron_v1.0 / remind.rexx < prev   
Encoding:
OS/2 REXX Batch file  |  1989-08-07  |  2.8 KB  |  105 lines

  1. /***********************/
  2. /* Remind.rexx         */
  3. /* 8/3/89 - Don Nafis  */
  4. /***********************/
  5.  
  6. /*
  7.   This script beeps then displays and speaks a message (reminder).
  8.    If the speak: handler is not mounted, it attempts to mount it,
  9.    bypassing the spoken message if the mount fails.
  10.  
  11.   Usage:
  12.     rx remind This is the message.
  13.  
  14.   While I've written this Rexx script to be used with NazCron, it
  15.   will work just fine from any ARexx or Execute script.
  16.  
  17.  */
  18.  
  19. /* Remove the comments below to trace this script. */
  20. /*--->trace results<---*/
  21.  
  22. options failat 20
  23.  
  24.  
  25. /*
  26.  * Make sure there is a reminder to be given.
  27.  */
  28. arg saywhat
  29. if (saywhat == '') then
  30.   exit 20
  31.  
  32.  
  33. /*
  34.  * "wakeupcall" will be displayed as the window title and spoken
  35.  *   just before the message is spoken.  Have it say whatever you
  36.  *   want.  If your screen width is other than 640, change the value
  37.  *   below. Screenwidth is used to determine if the message will fit
  38.  *   on the screen as well as to center the message.
  39.  */
  40. wakeupcall = "Just a Reminder"
  41. screenwidth = 640
  42.  
  43.  
  44. /*
  45.  * Compute the width in pixels that we will need to fit onto the screen.
  46.  *  If it is greater than the screenwidth, just abort.  Someone who needs
  47.  *  longer messages and has more time to spare is welcome to change
  48.  *  this to handle multiple line messages.
  49.  */
  50. width = (max((length(wakeupcall)+7),(length(saywhat)+8)) * 8);
  51. if ((screenwidth-width) < 3) then
  52.   exit 20
  53.  
  54.  
  55. address command
  56.  
  57.  
  58. /*
  59.  * DisplayBeep and put the message into a little window.
  60.  */
  61. call open('shell', 'con:'||(screenwidth-width)/2||'/50/'||width'/38/'||wakeupcall);
  62. call writeln('shell', '07'x);
  63. call writeln('shell','   '||saywhat);
  64.  
  65.  
  66. /*
  67.  * If speak: has been mounted, go speak the message.  If not,
  68.  *  attempt to mount speak:, speaking the message if successful.
  69.  */
  70. handlers = showlist('h')
  71. if (index(handlers, "SPEAK") == 0) then
  72. do
  73.   'mount speak:'
  74.   if (rc == 0) then
  75.     call speakit();
  76. end
  77. else
  78.   call speakit();
  79.  
  80.  
  81. /*
  82.  * Give the user 2 seconds to read the message, then close the window.
  83.  */
  84. call delay(100);
  85. call close('shell');
  86.  
  87. exit 0
  88.  
  89.  
  90. /*
  91.  * Speak the message in AmigaVoice.  I've done it this way since it
  92.  *  is much more likely that your mountlist will have an entry for
  93.  *  the speak: handler and that the mount and echo commands will be available
  94.  *  in the current path than that the "say" command will still be in the
  95.  *  utilities drawer or that the utilities drawer will be designated in the
  96.  *  your path.  You may prefer to change this procedure to use the say
  97.  *  command, since the say command gives you more control over all aspects
  98.  *  of the AmigaVoice.  If you change this to use "say", you can remove the
  99.  *  speak: handler mount logic as well.
  100.  */
  101. speakit: procedure expose wakeupcall saywhat
  102. 'echo >speak: "'||wakeupcall'"'
  103. 'echo >speak: "'||saywhat||'"'
  104. return 0
  105.