; AutoPEG.Install
; Install AutoPEG and AutoPEG.exe to HardDisk
; Copyright © 1995 John Corigliano
; $VER: AutoPEG.Install 1.55 (05.02.95)

(set vernum (getversion "dos.library" (resident)))
(set ver (/ vernum 65536))
(set rev (- vernum (* ver 65536)))

(if (< ver 37)
    (abort ("\nYou have WorkBench %ld.%ld\nAutoPEG needs v37+" ver rev))
    (welcome "I will now install AutoPEG an your system")
)

(set @dest-dir "Sys:Utilities")

(set new_name
    (askdir
        (prompt "Where do you want to put AutoPEG?")
        (help @askdir-help)
        (default "Sys:Utilities")
    )
)

(set @default-dest new_name)

(copyfiles
    (prompt ("Copying AutoPEG to %s" new_name))
    (help @copyfiles-help)
    (source "AutoPEG")
    (dest new_name)
    (infos)
    (optional "force")
)

(copyfiles
    (prompt ("Copying AutoPEG.guide to %s" new_name))
    (help @copyfiles-help)
    (source "AutoPEG.guide")
    (dest new_name)
    (infos)
    (optional "force")
)

(set this_cpu (database "cpu"))

(if (OR (= "68040" this_cpu) (= "68030" this_cpu))
    (copyfiles
        (prompt "Copying AutoPEG.exe ('030) to C:")
        (help @copyfiles-help)
        (files)
        (source "AutoPEG.exe.030")
        (dest "C:")
        (newname "AutoPEG.exe")
    )
    (copyfiles
        (prompt "Copying AutoPEG.exe to C:")
        (help @copyfiles-help)
        (files)
        (source "AutoPEG.exe")
        (dest "C:")
        (optional "force")
    )
)

(set icon_name (cat new_name "/AutoPEG"))

(set jpegdir_help
"\n\n Select the drawer that\n \
you want the JPEG files to be\n \
decompressed to.\n \
These files are temporary, so it\n \
is advised you use RAM:"
)

(set jpegdir
    (askdir
        (prompt "Where do you want decompressed files to go?")
        (help jpegdirhelp)
        (default "RAM:T")
    )
)

(tooltype
    (prompt "Setting tooltype")
    (help "Setting AutoPEG destination dir")
    (dest icon_name)
    (settooltype "JPEGDIR" jpegdir)
)

(set quiet_help
"\n\n If you select 'Yes - notify on', a\n \
requester will appear evertime you\n \
start or stop AutoPEG. \n \
 If you select 'No - notify off', \n \
no requesters will appear."
)

(if (askbool
        (prompt "\n\n\n\nDo you want AutoPEG to\nstart in non-QUIET mode?")
        (help quiet_help)
        (choices "Yes - notify on" "No - notify off"))
            (set null 0)
            (tooltype
                (prompt "Setting tooltype")
                (help "Setting AutoPEG tooltype to USEMEM")
                (dest icon_name)
                (settooltype "QUIET" "TRUE")
            )
)


(set ram_help
"\n\n If you select 'Yes - use RAM:', \n \
AutoPEG will decompress files to RAM:, \n \
then copy those file to disk. \n \
 If you select 'No - use direct', \n \
AutoPEG will decompress files \n \
directly to disk."
)

(if (askbool
        (prompt "\n\n\n\nDo you want AutoPEG to\nuse RAM:?")
        (help ram_help)
        (choices "Yes - use RAM:" "No - use direct"))
            (tooltype
                (prompt "Setting tooltype")
                (help "Setting AutoPEG tooltype to USEMEM")
                (dest icon_name)
                (settooltype "USEMEM" "TRUE")
            )
            (set null 0)
)

