c:copy c:copy t:copy
t:copy >nil: c:delete T:del
echo "c*N"
Requestfile >env:MPname DRAWER RAM: PATTERN #?.(mpeg|mpg) TITLE="Choose MPEG to convert"
if warn
   echo >env:msg "Operation canceled....!"
   skip end
endif
if not exists $MPname
   echo >env:msg "File does not exist....!"
   skip end
endif
Requestfile >env:MPdest DRAWER SYS: FILE Default.anim5 TITLE="Choose destination path."
if warn
   echo >env:msg "Operation canceled....!"
   skip end
endif
Requestchoice >env:mode "" "Choose output mode" EHB Ham6 Ham8 EHB_scale Ham6_scale Ham8_scale Abort
if $mode eq 0
   echo >env:msg "Operation canceled....!"
   skip end
endif
if val $mode GT 3
   Requestchoice >nil: "" "Once the mpeg is split you will be asked to enter your scale." OK
endif
assign MPT: MPtemp
t:copy >nil: convertMPimage T:cmi
T:del >nil: MPtemp/#?
ripley $MPname save MPtemp/pic%d
ECHO "*N MPEG is split, now converting pics."

if val $mode GT 3
   t:CMI noprogress format ILBM24 MPT:pic0.ppm to t:iff
   SmartScale ask t:iff
endif

ConPix $mode

echo ""
t:del >nil: t:ppm t:iff t:cmi env:FT env:din
list sort name >T:ConPics MPtemp lformat "0 %s%s"
mkanim using T:conpics to $MPdest
T:del >nil: t:conpics MPtemp/#? env:xin env:yin env:xout env:yout
echo >env:msg "Mpeg2anim successfully completed."
lab end
Requestchoice >nil: "" "$msg" OK
t:del >nil: env:msg env:mode env:MP#? t:copy t:del
assign MPT: REMOVE
endcli
