home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / lanxcopy.zip / LANX.CMD < prev    next >
OS/2 REXX Batch file  |  1996-08-09  |  2KB  |  51 lines

  1. /* Rexx */
  2. /* │----------------------------------------------------------------| */
  3. /* │ LanXCopy receiver program by Craig Park                        | */
  4. /* │----------------------------------------------------------------| */
  5. /* │ YY/MM/DD │ USER │                    COMMENTS                  | */
  6. /* │----------------------------------------------------------------| */
  7. /* │ 96/01/01 │ CP   │ Creation date                                | */
  8. /* │   /  /   │      │                                              | */
  9. /* │----------------------------------------------------------------| */
  10.  
  11. /* Initialize the REXXUTIL functions */
  12. CALL RXFUNCADD 'SYSLOADFUNCS','REXXUTIL','SYSLOADFUNCS'
  13. CALL SYSLOADFUNCS
  14.  
  15. /* Set up the locations of the log file and receive directory */
  16. Log_File    = "E:\USER\UTILITY\LANXCOPY.LOG"
  17. Receive_Dir = "E:\LANXCOPY.RCV"
  18.  
  19. /* Main loop keeps going forever until the session is killed */
  20. DO FOREVER
  21.  rc = SysFileDelete(Log_File)     /* Delete the log before starting */
  22.  Who = ''
  23.  /* This is the actual LANXCOPY command (rexx program waits for it to
  24.     finish executing then continues with next instruction           */
  25.  ADDRESS "CMD" "LANXCopy From:* "||Receive_Dir||" /r /c /x"
  26.  CALL SysSleep 3      /* Give the system time to close the log file */
  27.  a = 0
  28.  /* Process the log file to extract user name and file names */
  29.  DO UNTIL LINES(Log_File) = 0
  30.   l = LINEIN(Log_File)
  31.   IF TRANSLATE(LEFT(l,28)) = 'FILE TRANSFER BEGINNING FROM' THEN
  32.    Who = WORD(l,WORDS(l))
  33.   IF TRANSLATE(LEFT(l,3)) = 'RCV' THEN DO
  34.    a = a + 1
  35.    PARSE VAR l . File.a .
  36.   END
  37.  END
  38.  /* Close the file so that it can be deleted and reallocated */
  39.  rc = STREAM(Log_File,'c','Close')
  40.  /* Build the message string for the notify program */
  41.  Msg = "New files From "||Who||" -"
  42.  DO b = 1 TO a
  43.   IF b = 11 THEN Msg = Msg||'...'
  44.   IF b < 11 THEN Msg = Msg||' '||File.b
  45.  END
  46.  /* Use the NOTIFY program to tell the user the files came in */
  47.  ADDRESS "CMD" "START Notify BEEP=YES TITLE=LANXCopy MESSAGE="Msg
  48.  /* Immediately clear screen and start the LANXCOPY again */
  49.  ADDRESS "CMD" "Cls"
  50. END
  51.