home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 213a.lha / LogRexx / logoff.rexx < prev    next >
OS/2 REXX Batch file  |  1996-02-14  |  2KB  |  49 lines

  1. /* ARexx logoff program */
  2. cuFILE='T:CurrentUser'
  3. if open('cu',cuFILE)
  4. then
  5.   do
  6.     CurrentUser=readln('cu')
  7.     etFILE='T:et'||CurrentUser
  8.     atFILE='log:at'||CurrentUser
  9.     logFILE='log:log'||CurrentUser
  10. if open('etime',etFILE,'r') 
  11.     then  
  12.       do
  13.         et=(time('e')-readln('etime'))/60
  14.         outline = "Elapsed Time = "||et||" Minutes" 
  15.         say CurrentUser||" logged off"
  16.         say outline
  17.         if  open('mylog',logFILE,'A')
  18.         then 
  19.             do
  20.               dummy=writeln('mylog',CurrentUser||" logged off")
  21.               dummy=writeln('mylog',outline)
  22.               if open('atime',atFILE,'r')
  23.                  then
  24.                    do
  25.                      at=readln('atime')
  26.                      if at=''
  27.                      then at=et 
  28.                      else at=at+et
  29.                      outline = "Total Accumulated Time = "||at||" minutes"
  30.                      say outline||'0A'x
  31.                      dummy=close('atime')
  32.                      dummy=open('atime',atFILE,'w')
  33.                      dummy=writeln('atime',at)
  34.                      dummy=writeln('mylog',outline||'0A'x)
  35.                    end
  36.               else 
  37.                 do
  38.                   if open('atime',atFILE,'w')
  39.                      then dummy=writeln('atime',et)
  40.                   else say "failed to open "||atFILE
  41.                 end
  42.             end
  43.         else say "failed to open "||logFILE
  44.         dummy=close('cu')
  45.         'delete T:CurrentUser'
  46.       end
  47.     else  say "oops! Better logon again"
  48.   end
  49. else say "No CurrentUser file found; You must logon first"