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

  1. /* 
  2.  
  3.    $VER: PrintDir.filer 2.0 (22.11.93)
  4.  
  5.    Author:
  6.     Matthias Scheler (tron@lyssa.pb.owl.de)
  7.  
  8.    Function:
  9.     Opens a string requester, asks for a output file and writes a listing of
  10.     the selected directory listview to the output file.
  11.  
  12.    Call:
  13.     PrintDir
  14.  
  15.    Example for "Filer.RC":
  16.     BUTTON ...,...,"Print Dir","PrintDir"
  17.  
  18. */
  19.  
  20. ADDRESS 'FilerRexx'
  21. OPTIONS RESULTS
  22.  
  23. GETSOURCEPATH
  24. IF RESULT="RESULT" THEN EXIT 5
  25. SourceDir=RESULT
  26.  
  27. LOCKFILER
  28. IF RESULT="RESULT" THEN EXIT 5
  29. Key=Result
  30.  
  31. PANEL OFF
  32.  
  33. 'STATUS Print directory'
  34.  
  35. 'SETSTRING PRT:'
  36. GETSTRING 'Choose file, or printer:'
  37. IF RESULT="RESULT" THEN
  38.  DO
  39.   PANEL ON
  40.   UNLOCKFILER Key
  41.  
  42.   EXIT 5
  43.  END
  44. TargetName=RESULT
  45.  
  46. IF OPEN('Prt',TargetName,'WRITE')=0 THEN
  47.  DO
  48.   PANEL ON
  49.   UNLOCKFILER Key
  50.  
  51.   ALERTBOX "Couldn't open output file !"
  52.   EXIT 5
  53.  END
  54.  
  55. 'STATUS Printing directory "'||SourceDir||'" to "'||TargetName||'" ...'
  56.  
  57. CALL WRITELN('Prt','Directory "'||SourceDir||'":')
  58.  
  59. GETNUMENTRIES
  60. Num=RESULT
  61. DO Index=1 TO Num
  62.  GETNAME Index
  63.  Name=RESULT
  64.  GETINFO Index
  65.  Info=RESULT
  66.  
  67.  IF UPPER(LEFT(Name,1))='F' THEN Line=LEFT(SUBSTR(Name,2)||'                              ',31)
  68.  ELSE Line=X2C(1B)||'[1m'||LEFT(SUBSTR(Name,2)||'                              ',31)||X2C(1B)||'[0m'
  69.  
  70.  CALL WRITELN('Prt',Line||Info)
  71. END
  72.  
  73. CALL WRITECH('Prt',X2C(C)||X2C(1B)||'[0m')
  74. CALL CLOSE('Prt')
  75.  
  76. 'HISTORY Printed directory "'||SourceDir||'" to "'||TargetName||'".'
  77.  
  78. PANEL ON
  79. UNLOCKFILER Key
  80.