home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Amiga / Workbench / Archivers / LhA2LZX2.lha / lha2lzx / LhA2LZX_v1.1 next >
Text File  |  1997-03-16  |  4KB  |  204 lines

  1. Resident > NIL: C:RequestChoice PURE
  2. Resident > NIL: C:RequestFile PURE
  3. Resident > NIL: C:BaseName PURE
  4. Resident > NIL: C:Eval PURE
  5. Resident > NIL: C:List PURE
  6.  
  7. ; $VER: LhA2LZX v1.1 (9.3.97) Richard Burke
  8.  
  9. lab beg
  10. if EXISTS env:wlha
  11.         delete env:wlha QUIET
  12. endif
  13.  
  14. if EXISTS env:wlzx
  15.         delete env:wlzx QUIET
  16. endif
  17.  
  18. if EXISTS env:diff
  19.         delete env:diff QUIET
  20. endif
  21.  
  22. if EXISTS env:diff1
  23.         delete env:diff1 QUIET
  24. endif
  25.  
  26. if EXISTS env:ano
  27.         delete env:ano QUIET
  28. endif
  29.  
  30. if EXISTS env:old
  31.         delete env:old QUIET
  32. endif
  33.  
  34. if EXISTS env:new
  35.         delete env:new QUIET
  36. endif
  37.  
  38. if EXISTS env:bnm1
  39.         delete env:bnm1 QUIET
  40. endif
  41.  
  42. if EXISTS env:bnm
  43.         delete env:bnm QUIET
  44. endif
  45.  
  46. if EXISTS env:orig
  47.         delete env:orig QUIET
  48. endif
  49.  
  50. if EXISTS env:ldfl
  51.         delete env:ldfl QUIET
  52. endif
  53.  
  54. if EXISTS env:drw1
  55.         cd $drw1
  56.         if EXISTS l2z
  57.                 delete l2z ALL QUIET FORCE
  58.         endif
  59.         delete env:drw1 QUIET
  60. endif
  61.  
  62. if EXISTS env:drw
  63.         delete env:drw QUIET
  64. endif
  65.  
  66. which lha all >env:wlha
  67. if WARN
  68.         requestchoice "LhA2LZX Error Message" "Can't find 'LhA' tool! *nSee docs for details!" "Quit"
  69.         quit
  70. endif
  71.  
  72. which lzx all >env:wlzx
  73. if WARN
  74.         requestchoice "LhA2LZX Error Message" "Can't find 'LZX' tool! *nSee docs for details!" "Quit"
  75.         quit
  76. endif
  77.  
  78. RequestFile >env:orig TITLE "Drawer of archive?" DRAWERSONLY NOICONS
  79. if WARN
  80.         quit
  81. endif
  82.  
  83. RequestFile >env:ldfl TITLE "Chose file to convert" POSITIVE Convert ACCEPTPATTERN #?.(lha|lzx) DRAWER $orig
  84. if WARN
  85.         quit
  86. endif
  87.  
  88. basename >env:bnm1 $ldfl
  89.  
  90. RequestChoice >env:drw "Default directory" "Where should I store temporary files? *nRAM: is fastest but not advisable if you *nhaven't got much. A temporary drawer called 'L2Z' *nwill be created in your selected destination" "RAM:" "Other"
  91. if $drw EQ 1
  92.         echo RAM: >env:drw1
  93. endif
  94.  
  95. if $drw EQ 0
  96.         RequestFile >env:drw1 TITLE "Where should 'L2Z' be made?" DRAWERSONLY NOICONS POSITIVE Create
  97. endif
  98.  
  99. cd $drw1
  100. if NOT EXISTS l2z
  101.         makedir > NIL: l2z
  102. else 
  103.         delete l2z/#? FORCE QUIET
  104. endif
  105.  
  106. basename >env:bnm $bnm1 .lzx
  107. if $bnm1 EQ $bnm
  108.         delete env:bnm QUIET
  109.         basename >env:bnm $bnm1 .lha
  110.         cd $drw1
  111.         cd l2z
  112.         $wlha x -a $ldfl
  113.         $wlzx -r -e -3 a $bnm #?
  114. else
  115.         cd $drw1
  116.         cd l2z
  117.         $wlzx x -a $ldfl
  118.         $wlha -2ar a $bnm #?
  119. endif
  120.  
  121. list >env:old $ldfl LFORMAT=%L
  122. list >env:new $bnm.(lzx|lha) LFORMAT=%L
  123. eval >env:diff $old - $new
  124. eval >env:diff1 $new - $old
  125.  
  126. if $old GT $new VAL
  127.         delete $ldfl QUIET
  128.         echo "*e[1;1H*e[J*n Using new archive because it's *e[2m$diff *e[0mbytes smaller!"
  129.         copy $bnm.(lzx|lha) TO $orig QUIET
  130. else
  131.         echo "*e[1;1H*e[J*n Using old archive because it's *e[2m$diff1 *e[0mbytes smaller!"
  132.         delete l2z ALL QUIET FORCE
  133. endif
  134.  
  135. RequestChoice >env:ano "Other archives?" "Do you want to convert another archive?" "Yes" "No"
  136. if $ano EQ 0
  137.         skip end
  138. else
  139.         skip beg back
  140. endif
  141.  
  142. lab end
  143. echo "*e[1;1H*e[J"
  144. echo ""
  145. echo ""
  146. echo ""
  147. echo "                       *e[1;32m  Thank you for using"
  148. echo "                              *e[33m LhA*e[0m*e[3;1m2*e[0m*e[2mLZX"
  149. if EXISTS env:old
  150.         delete env:old QUIET
  151. endif
  152.  
  153. if EXISTS env:diff
  154.         delete env:diff QUIET
  155. endif
  156.  
  157. if EXISTS env:diff1
  158.         delete env:diff1 QUIET
  159. endif
  160.  
  161. if EXISTS env:new
  162.         delete env:new QUIET
  163. endif
  164.  
  165. if EXISTS env:ano
  166.         delete env:ano QUIET
  167. endif
  168.  
  169. if EXISTS env:wlha
  170.         delete env:wlha QUIET
  171. endif
  172.  
  173. if EXISTS env:wlzx
  174.         delete env:wlzx QUIET
  175. endif
  176.  
  177. if EXISTS env:bnm1
  178.         delete env:bnm1 QUIET
  179. endif
  180.  
  181. if EXISTS env:bnm
  182.         delete env:bnm QUIET
  183. endif
  184.  
  185. if EXISTS env:orig
  186.         delete env:orig QUIET
  187. endif
  188.  
  189. if EXISTS env:ldfl
  190.         delete env:ldfl QUIET
  191. endif
  192.  
  193. if EXISTS env:drw1
  194.         cd $drw1
  195.         if EXISTS l2z
  196.                 delete l2z ALL QUIET FORCE
  197.         endif
  198.         delete env:drw1 QUIET
  199. endif
  200.  
  201. if EXISTS env:drw
  202.         delete env:drw QUIET
  203. endif
  204. quit