home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga Shareware Floppies / ma23.dms / ma23.adf / Filer / Rexx / XPK.filer < prev    next >
Text File  |  1993-11-27  |  2KB  |  100 lines

  1. /* 
  2.  
  3.    $VER: XPK.filer 2.1 (22.11.93)
  4.  
  5.    Author:
  6.     Matthias Scheler (tron@lyssa.pb.owl.de)
  7.  
  8.    Function:
  9.     All selected files and directories in the active directory listview will
  10.     be packed with XPK. If a compression method is supplied it will be used.
  11.     Else a string requester will appear and ask for the method.
  12.  
  13.    Requires:
  14.     XPK 2.x or newer
  15.     xPack 1.x or newer
  16.  
  17.    Call:
  18.     XPK [METHOD]
  19.  
  20.    Example for "Filer.RC":
  21.     BUTTON ...,...,"Pack","RX XPK"
  22.    or:
  23.     BUTTON ...,...,"Nuke'em","RX XPK NUKE"
  24.  
  25. */
  26.  
  27. PARSE ARG Compressor
  28.  
  29. ADDRESS 'FilerRexx'
  30. OPTIONS RESULTS
  31.  
  32. LOCKFILER
  33. IF RESULT="RESULT" THEN EXIT 5
  34. Key=Result
  35.  
  36. PANEL OFF
  37.  
  38. 'STATUS XPK compression'
  39.  
  40. IF Compressor="" THEN
  41.  DO
  42.   'SETSTRING NUKE'
  43.   'GETSTRING Enter XPK compression method:'
  44.  
  45.   IF RESULT="RESULT" THEN
  46.    DO
  47.     PANEL ON
  48.     UNLOCKFILER Key
  49.  
  50.     'STATUS XPK compression aborted'
  51.     EXIT 5
  52.    END
  53.  
  54.   Compressor=RESULT
  55.  END
  56.  
  57. GETSOURCEPATH
  58. IF RESULT="RESULT" THEN
  59.  DO
  60.   PANEL ON
  61.   UNLOCKFILER Key
  62.  
  63.   EXIT 5
  64.  END
  65. SourceDir=RESULT
  66.  
  67. GETNUMENTRIES
  68. Num=RESULT
  69. DO Index=1 TO Num
  70.  GETNAME Index
  71.  Data=RESULT
  72.  Name=SUBSTR(Data,2)
  73.  
  74.  IF RIGHT(SourceDir,1)=":" THEN SourceName=SourceDir||Name
  75.  ELSE SourceName=SourceDir||"/"||Name
  76.  
  77.  IF LEFT(Data,1)="f" THEN
  78.   DO
  79.    ADDRESS 'COMMAND' 'xPack "'||SourceName||'" METHOD' Compressor 'ALL'
  80.    TOGGLEENTRY Index
  81.  
  82.    'HISTORY "'||SourceName||'" compressed with metmod "'||Compressor||'".'
  83.   END
  84.  
  85.  IF LEFT(Data,1)="d" THEN
  86.   DO
  87.    ADDRESS 'COMMAND' 'xPack "'||SourceName||'" METHOD' Compressor 'ALL'
  88.    TOGGLEENTRY Index
  89.  
  90.    'HISTORY Files in directory "'||SourceName||'" compressed with metmod "'||Compressor||'".'
  91.   END
  92. END
  93. UPDATESOURCEDIR
  94.  
  95.  
  96. 'STATUS Operation finished !' 
  97.  
  98. PANEL ON
  99. UNLOCKFILER Key
  100.