home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / zow311.exe / INSTALL.FIL / SCRIPT / ZOCXFER.DOC < prev    next >
Text File  |  1996-08-26  |  4KB  |  115 lines

  1.  
  2. ---------------------------------------------------------------------------
  3. 1) HOW TO USE ZOCXFER.ZRX
  4. ---------------------------------------------------------------------------
  5.  
  6.    The ZOCXFER.ZRX file is called before and after every file transfer.
  7.    Parameters identify the type of event (see table below) at which 
  8.    ZOCXFER.ZRX is called.  This lets you do things before and after file
  9.    transfers according to your needs (see examples below).
  10.  
  11.  
  12. ---------------------------------------------------------------------------
  13. 2) CALL PARAMETERS
  14. ---------------------------------------------------------------------------
  15.  
  16.    ----------------------------  ------------------------------------------
  17.    EVENT                         PARAMETER(S)
  18.    ----------------------------  ------------------------------------------
  19.    Before upload                 'PRE' 'UPLOAD' '<full filename>'
  20.    Before download               'PRE' 'DOWNLOAD' '<full filename>'
  21.    After upload                  'POST' 'UPLOAD' '<full filename>'
  22.    After download                'POST' 'DOWNLOAD' '<full filename>' 
  23.    ----------------------------  ------------------------------------------
  24.  
  25.    You can split the call argument into its parts with a simple PARSE 
  26.    command: 
  27.  
  28.       PARSE ARG WITH "'"prepost"' '"updownload"' '"file"'"
  29.  
  30.    The file name is fully qualified and can be split into its parts 
  31.    (filepath, filename, filestem, fileext) by the following sequence 
  32.    of commands:
  33.  
  34.       filepath= FILESPEC("Path", file);
  35.       filename= FILESPEC("Name", file);
  36.       PARSE VALUE filename WITH filestem"."fileext
  37.  
  38.  
  39.  
  40. ---------------------------------------------------------------------------
  41. 2) RETURN VALUE
  42. ---------------------------------------------------------------------------
  43.  
  44.    In case of uploads, ZOCXFER.ZRX has to return the name of the file
  45.    that should be uploaded.  This can be either the name provided as a 
  46.    parameter, or a changed name (in case ZOCXFER.ZRX decided to upload
  47.    another file instead).
  48.  
  49.  
  50.  
  51. ---------------------------------------------------------------------------
  52. 3) EXAMPLES
  53. ---------------------------------------------------------------------------
  54.  
  55.    Here are a few ideas of things that could be done in ZOCXFER.ZRX
  56.  
  57.  
  58.    3.1) BEFORE UPLOADS 
  59.  
  60.         * Write your own up/download log with date, type and filename:
  61.  
  62.             CALL LINEOUT "mylog.dat", DATE("S")||" "||updownload||" "||filename
  63.  
  64.         * Automatically archive fido ".REP" files, in a special directory
  65.           with <YYYYMMDD>.REP as the file name:
  66.  
  67.             ADDRESS CMD "COPY "||filename||" C:\REPILES\"||DATE("S")||".REP"
  68.  
  69.         * if it is a ".TXT" file, use ZIP (or PGP) and upload the ZIP file
  70.           instead:
  71.  
  72.             IF fileext=".TXT" THEN DO
  73.                  /* newfile will be uploaded instead (see "return newfile") */
  74.                  newfile= filestem||".ZIP" 
  75.  
  76.                  /* run ZIP <newfile> <filename> */
  77.                  ADDRESS CMD "ZIP "||newfile||" "||filename
  78.             END
  79.  
  80.  
  81.    3.2) BEFORE DOWNLOADS 
  82.         
  83.         * Write your own up/download log with date, type and filename:
  84.  
  85.             CALL LINEOUT "log.dat", DATE("S")||" "||updownload||" "||filename
  86.  
  87.         * Redirect files to other directories using your own scheme by 
  88.           setting "newfile" to another directory and file name:
  89.  
  90.             IF fileext=".ZIP" THEN DO
  91.                  /* download to directory C:\DOWNLOAD\ZIPFILES
  92.                  newfile= "C:\DOWNLOAD\ZIPFILES\"||filename
  93.             END
  94.             IF fileext=".QWK" THEN DO
  95.                  /* download to directory C:\DOWNLOAD\QWKFILES
  96.                  newfile= "C:\DOWNLOAD\QWKFILES\"||filename
  97.             END
  98.  
  99.  
  100.    3.3) AFTER UPLOADS 
  101.  
  102.         * Automatically delete temporary files
  103.  
  104.  
  105.    3.4) AFTER DOWNLOADS 
  106.  
  107.         * Automatically unzip files:
  108.  
  109.             IF fileext=".ZIP" THEN DO
  110.                  zippath= "C:\DOWNLOAD\NEWFILES\"||filestem
  111.                  ADDRESS CMD "MD "||zippath
  112.                  ADDRESS CMD "UNZIP "||file||" "||zippath
  113.             END
  114.  
  115.