home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 28 / amigaformatcd28.iso / -seriously_amiga- / archivers / lha2lzx / lha2lzx_v1.2 < prev    next >
Text File  |  1998-04-27  |  4KB  |  205 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.2 (21.5.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.         cd $drw1
  133.         delete l2z ALL QUIET FORCE
  134. endif
  135.  
  136. RequestChoice >env:ano "Other archives?" "Do you want to convert another archive?" "Yes" "No"
  137. if $ano EQ 0
  138.         skip end
  139. else
  140.         skip beg back
  141. endif
  142.  
  143. lab end
  144. echo "*e[1;1H*e[J"
  145. echo ""
  146. echo ""
  147. echo ""
  148. echo "                       *e[1;32m  Thank you for using"
  149. echo "                              *e[33m LhA*e[0m*e[3;1m2*e[0m*e[2mLZX"
  150. if EXISTS env:old
  151.         delete env:old QUIET
  152. endif
  153.  
  154. if EXISTS env:diff
  155.         delete env:diff QUIET
  156. endif
  157.  
  158. if EXISTS env:diff1
  159.         delete env:diff1 QUIET
  160. endif
  161.  
  162. if EXISTS env:new
  163.         delete env:new QUIET
  164. endif
  165.  
  166. if EXISTS env:ano
  167.         delete env:ano QUIET
  168. endif
  169.  
  170. if EXISTS env:wlha
  171.         delete env:wlha QUIET
  172. endif
  173.  
  174. if EXISTS env:wlzx
  175.         delete env:wlzx QUIET
  176. endif
  177.  
  178. if EXISTS env:bnm1
  179.         delete env:bnm1 QUIET
  180. endif
  181.  
  182. if EXISTS env:bnm
  183.         delete env:bnm QUIET
  184. endif
  185.  
  186. if EXISTS env:orig
  187.         delete env:orig QUIET
  188. endif
  189.  
  190. if EXISTS env:ldfl
  191.         delete env:ldfl QUIET
  192. endif
  193.  
  194. if EXISTS env:drw1
  195.         cd $drw1
  196.         if EXISTS l2z
  197.                 delete l2z ALL QUIET FORCE
  198.         endif
  199.         delete env:drw1 QUIET
  200. endif
  201.  
  202. if EXISTS env:drw
  203.         delete env:drw QUIET
  204. endif
  205. quit