RequestFile >env:orig TITLE "Drawer of archive?" DRAWERSONLY NOICONS
if WARN
quit
endif
RequestFile >env:ldfl TITLE "Chose file to convert" POSITIVE Convert ACCEPTPATTERN #?.(lha|lzx) DRAWER $orig
if WARN
quit
endif
basename >env:bnm1 $ldfl
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"
if $drw EQ 1
echo RAM: >env:drw1
endif
if $drw EQ 0
RequestFile >env:drw1 TITLE "Where should 'L2Z' be made?" DRAWERSONLY NOICONS POSITIVE Create
endif
cd $drw1
if NOT EXISTS l2z
makedir > NIL: l2z
else
delete l2z/#? FORCE QUIET
endif
basename >env:bnm $bnm1 .lzx
if $bnm1 EQ $bnm
delete env:bnm QUIET
basename >env:bnm $bnm1 .lha
cd $drw1
cd l2z
$wlha x -a $ldfl
$wlzx -r -e -3 a $bnm #?
else
cd $drw1
cd l2z
$wlzx x -a $ldfl
$wlha -2ar a $bnm #?
endif
list >env:old $ldfl LFORMAT=%L
list >env:new $bnm.(lzx|lha) LFORMAT=%L
eval >env:diff $old - $new
eval >env:diff1 $new - $old
if $old GT $new VAL
delete $ldfl QUIET
echo "*e[1;1H*e[J*n Using new archive because it's *e[2m$diff *e[0mbytes smaller!"
copy $bnm.(lzx|lha) TO $orig QUIET
else
echo "*e[1;1H*e[J*n Using old archive because it's *e[2m$diff1 *e[0mbytes smaller!"
delete l2z ALL QUIET FORCE
endif
RequestChoice >env:ano "Other archives?" "Do you want to convert another archive?" "Yes" "No"