(welcome "AVM Suite Installation")
(transcript "Installing the AVM Suite...")

; **************************************************************************
; **************************************************************************
; **************************************************************************

(complete 20)

(set @default-dest "Work:AVMSuite")

(set avmdest
	(askdir
		(prompt "Where do you want to put the AVM Suite?")
		(help @askdir-help)
		(default @default-dest)
		(newpath)
	)
)

(set @default-dest avmdest)

(makedir avmdest (infos))

(copyfiles
	(prompt "Copying executables, scripts, icons, and documentation...")
	(help @copyfiles-help)
        (source (expandpath ""))
	(dest avmdest)
	(all)
)

(makeassign "AVM" avmdest)
(makeassign "AVMREXX" "avm:rexx")
(makeassign "AVMTEMP" "t:")

(delete "avm:installer")
(delete "avm:avm-install")
(delete "avm:avm-install.info")

(makedir "avm:voices")

(complete 75)

(set modemtype
	(askchoice
		(prompt "What modem and ROM version do you have?")
		(help @askchoice-help)
		(choices
			"LineLink 144e"
			"MTD Dolphin"
			"ZyXEL 6.01"
			"ZyXEL 6.10"
			"ZyXEL 6.11"
			"ZyXEL 6.11a"
                        "Rockwell based"
                )
		(default 0)
	)
)

(debug modemtype)

(if (= modemtype 0)
  (execute "avm:defaultscripts/useLineLink144e")
  (if (= modemtype 1)
    (execute "avm:defaultscripts/useDolphin")
    (if (= modemtype 2)
      (execute "avm:defaultscripts/useZyXEL6.01")
      (if (= modemtype 3)
        (execute "avm:defaultscripts/useZyXEL6.10")
        (if (= modemtype 4)
          (execute "avm:defaultscripts/useZyXEL6.11")
          (if (= modemtype 5)
            (execute "avm:defaultscripts/useZyXEL6.11a")
            (if (= modemtype 6)
              (execute "avm:defaultscripts/useRockwell")
            )
          )
        )
      )
    )
  )
)

(complete 80)

(set digitizertype
	(askchoice
		(prompt "What type of digitizer do you have?")
		(help @askchoice-help)
		(choices
			"Generic/None"
			"Perfect Sound"
		)
		(default 0)
	)
)

(debug digitizertype)

(if (= digitizertype 0)
	(execute "avm:defaultscripts/useGenericDigitizer")
	(if (= digitizertype 1)
		(execute "avm:defaultscripts/usePerfectSound")
		(message "Bad Stuff")
	)
)

(complete 85)

(set alerttype
	(askchoice
		(prompt "How do you want to be informed of new messages?")
		(help @askchoice-help)
		(choices
			"Flashing LED"
			"AmigaDOS Say Command"
                        "Prerecorded Voice"
		)
		(default 0)
	)
)

(debug alerttype)

(if (= alerttype 0)
	(execute "avm:defaultscripts/useFlashAlert")
	(if (= alerttype 1)
		(execute "avm:defaultscripts/useSayAlert")
                (if (= alerttype 2)
                     (execute "avm:defaultscripts/useSayAlertPreRec")
  		     (message "Bad Stuff")
                )
	)
)

(set mybool
  (askbool
    (help @askchoice-help)
    (prompt "Rename old voice files? (highly recommended/harmless)")
    (default 1)
  )
)

(if (= mybool 1)
  (execute "avm:renamevoicefiles")
)

(set mybool
  (askbool
    (help @askchoice-help)
    (prompt "Delete obsolete voice files?")
    (default 1)
  )
)

(if (= mybool 1)
  (execute "avm:deletevoicefiles")
)

(complete 90)


; **************************************************************************
; **************************************************************************
; **************************************************************************


(startup "AVM Suite"
  (prompt "Adding the required ASSIGNS to your user-startup.")
	(help @startup-help)
	(command "assign avm: \"" avmdest "\"\n")
	(command "assign avmrexx: \"avm:rexx\"\n")
	(command "assign avmtemp: \"t:\"\n")
)

(complete 100)


; **************************************************************************
; **************************************************************************
; **************************************************************************

(exit)
