home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / arexx / misc_arexx / reminder.rexx < prev    next >
OS/2 REXX Batch file  |  1996-09-22  |  3KB  |  154 lines

  1. /* 
  2.     GiGA Time Reminder ©96 by Fini 'Warp' Alring of GiGA Productions...
  3. */
  4.  
  5.  
  6. Xver = 'v1.2'
  7.  
  8. Parse arg ARGS
  9. Argnum=Arghandler(ARGS)
  10. OPT = arg.1 
  11. TIMO = arg.2
  12.  
  13. Call initlibs
  14.  
  15. if Argnum=0  | length(TIMO) ~= 5 | substr(TIMO,3,1) ~= ':' then do
  16.     say ''
  17.     say centre(' GiGA Time Reminder ' || Xver,80)
  18.     say centre('Created by Fini "Warp" Alring of GiGA Prod. ©1996',80)
  19.     say ''
  20.     say centre('This util Sleeps in the back, and pops up a message requester!',80)
  21.     say ''
  22.     say centre('Usage: Run >NIL: Rx Reminder -Option [Optional Message in alert]',80)
  23.     say '        Options:'
  24.     say '        -a 01:24  -> Alert after 1 hour, and 24 minutes.'
  25.     say '        -t 22:35  -> Alert at 22:35 today!'
  26.     say ''
  27.     exit(0)
  28. end
  29.  
  30. Message = ''
  31. i=3
  32.  
  33. do i=3 to Argnum      
  34.     Message = Message || ' ' || arg.i
  35. end
  36.  
  37. /* Options Begin here! */
  38.  
  39. if upper(OPT) = '-A' then do
  40.     
  41.     Call Snooze(left(TIMO,2),right(TIMO,2))     
  42.  
  43.     if argnum=2 then arg.3 = 'You called, master...?'
  44.     if length(message)<17 then message = centre(message,18)        
  45.  
  46.     Call Popreq(message)
  47. end
  48.  
  49.  
  50. if upper(OPT) = '-T' then do
  51.  
  52.     ok=0
  53.     req_hour = substr(TIMO,1,2)
  54.     req_minu = substr(TIMO,4,2)
  55.  
  56.     do while TIMO ~= Substr(Time('Normal'),1,5)     
  57.         Call delay(30 * 50)     
  58.     end
  59.  
  60.     if argnum=2 then arg.3 = 'You called, master...?'
  61.     if length(message)<17 then message = centre(message,18)        
  62.  
  63.     Call Popreq(message)
  64. end
  65.     
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. exit(0)
  74.  
  75. /* Functions - Begin */
  76.  
  77.  
  78.  
  79.  
  80. Arghandler: Procedure Expose arg.
  81.  
  82.     ARGS = arg(1)
  83.     l=words(ARGS)
  84.     do a=1 to l
  85.         arg.a = word(ARGS,a)
  86.     end a
  87. return l
  88.  
  89. /*        ^- Argument handler. */
  90.  
  91.  
  92.  
  93. Initlibs: Procedure
  94.  
  95.     a=0
  96.  
  97.     If exists('LIBS:rexxreqtools.library') ~= 1 then do
  98.             Say 'Unable to open rexxreqtools.library'
  99.             a=1
  100.     end
  101.     
  102.     If exists('LIBS:reqtools.library') ~= 1 then do
  103.             Say 'Unable to open reqtools.library'
  104.             a=1
  105.     end
  106.  
  107.     If exists('LIBS:rexxsupport.library') ~= 1 then do
  108.             Say 'Unable to open rexxsupport.library'
  109.             a=1
  110.     end
  111.     
  112.     if a=1 then do
  113.         say 'Unable to run:'
  114.         say Title
  115.         say 'Get the libraries listed above, you will need them/it...'
  116.         exit(20)
  117.     end
  118.     
  119.     call addlib("rexxsupport.library", 0, -30, 0)
  120.     call addlib("rexxreqtools.library", 0, -30, 0)
  121. /*  ^- Libs R found, now we link the reqtools.lib via rexxreqtools.lib */
  122.  
  123. Return 0
  124. /*
  125. **           ^- Check for needed libraries, and react upon...   
  126. */
  127.  
  128.  
  129.  
  130. Snooze: Procedure
  131.     arg Hours, Minutes
  132.  
  133.     Tsec = ( ( Hours * 60 ) + Minutes ) * 60
  134.  
  135.     Call Delay( Tsec * 50  )
  136. return 0
  137. /*
  138. **           ^- Delay(H,M)    
  139. */
  140.  
  141.  
  142.  
  143. PopReq: Parse arg MESS
  144.     say d2c(7)
  145.     call delay(10)
  146.     say d2c(7)
  147.     s = 'Reminder ' || Xver || '©96 GiGA Prod. '
  148.     Call RTezrequest(MESS,'Done!',s,"rt_reqpos =reqpos_centerscr")
  149. return 0
  150. /*
  151. **           ^- Pop a requester, with a message...   
  152. */
  153.  
  154.