
(welcome)

(set copyprefs 0)

(set dest2 (tackon (askdir  (prompt "Select the location to install the AMIS directory")
		      (default @default-dest)
                      (help "Choose a destination partition or directory " 
                            "to contain AMIS.  The install program will "
                            "create a directory called 'AMIS' in the "
                            "location you choose and copy the AMIS files "
                            "to it."
                      )
                   ) "AMIS")
)

(set @default-dest dest2)

(makedir dest2 (infos))

(copyfiles
  (prompt "Copying...\n")
  (source "")
  (choices "AMIS" "AMIS.guide" "AMIS_Startup.rexx")
  (dest dest2)
  (infos)
  (files)
  (confirm)
  (help @copyfiles-help)
)

(complete 30)

(makedir (tackon dest2 "Scripts"))

(copyfiles
  (prompt "Copying...\n")
  (source "Scripts/")
  (dest (tackon dest2 "Scripts"))
  (infos)
  (files)
  (all)
  (help @copyfiles-help)
)

(complete 40)

(makedir (tackon dest2 "Viewers"))

(copyfiles
  (prompt "Copying...\n")
  (source "Viewers/")
  (dest (tackon dest2 "Viewers"))
  (infos)
  (files)
  (all)
  (confirm)
  (help @copyfiles-help)
)

(makedir (tackon dest2 "Viewers/Sources"))

(copyfiles
  (prompt "Copying...\n")
  (source "Viewers/Sources/")
  (dest (tackon dest2 "Viewers/Sources"))
  (infos)
  (files)
  (all)
  (help @copyfiles-help)
)

(complete 50)

(makedir "ENVARC:AMIS")

(if (= (exists ("ENVARC:AMIS/AMIS.prefs")) 1)
  (
  (if (askbool
		(prompt "\nDo you want to overwrite the old AMIS\n"
				"preferences ?\n\n"
			"(Old versions of AMIS won't work with\n"
			"the new preferences!)")
		(help "")
	)
	(set copyprefs 1)
  )
  )
  (set copyprefs 1)
)

(if (= copyprefs 1)
  (
(copyfiles
  (prompt "Copying preferences...\n")
  (source "ENV/")
  (choices "AMIS.prefs" "def_text.info")
  (dest "ENVARC:AMIS")
  (files)
  (help @copyfiles-help)
)

(makedir "ENV:AMIS")

(copyfiles
  (prompt "Copying preferences...\n")
  (source "ENV/")
  (choices "AMIS.prefs" "def_text.info")
  (dest "ENV:AMIS")
  (files)
  (help @copyfiles-help)
)
)
)

(complete 60)

(if (askbool
		(prompt "\nWould you like to install the\n"
				"(GoldED compatible) findfunctions ?")
		(help "")
	)
	((makedir (tackon dest2 "Findfunctions") (infos))
	(copyfiles
	  (prompt "Select the findfunctions you want\nto install")
	  (source "Findfunctions/")
	  (dest (tackon dest2 "Findfunctions"))
	  (all)
	  (files)
	  (confirm)
	  (help @copyfiles-help)
	)
	)
)

(complete 70)

(copylib
	(prompt "Copying amis.library...")
	(help @copylib-help)
	(source "Libs/amis.library")
	(dest "Libs:")
	(confirm)
)

(complete 80)

(set cats (askoptions
	(prompt "Which catalog files do\nyou want to install ?")
	(choices "Nederlands")
	(help "Select the catalog files you want to copy.")
	(default 0))
)

(if (AND cats 1)
	(
		(makedir "LOCALE:Catalogs/Nederlands")
		(copyfiles
			(prompt "Copying AMIS.catalog (Nederlands)...")
			(source "Catalogs/Nederlands/AMIS.catalog")
			(dest "LOCALE:Catalogs/Nederlands")
			(help @copyfiles-help)
		)
	)
)

(complete 90)

(if (<> (exists (tackon dest2 "AMIS_KeyFile")) 1)
(if (askbool
	(prompt "\nDo you have a keyfile ?")
	(help ""))
	(
		(set keyfile (askfile
			(prompt "Please select your keyfile.")
			(default "")
			(help   "Please select your keyfile.")))
		(if (= 84 (getsize keyfile))
			(if (<> (expandpath (pathonly keyfile)) (expandpath dest2))
				(copyfiles
					(prompt "Copying your keyfile...")
					(source keyfile)
					(dest dest2)
					(newname "AMIS_KeyFile"))
			)
			(message "No keyfile selected!\n")
		)
	)
)
)

(complete 100)
(exit)

