;
; English installation
;
(set #choosedest "Select the location to install the AMIS directory")
(set #choosedesthelp "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.")
(set #copy "Copying...\n")
(set #copyacd "Copying AMIS.catalog (German)...")
(set #copyaci "Copying AMIS.catalog (Italian)...")
(set #copyacn "Copying AMIS.catalog (Dutch)...")
(set #copyal "Copying amis.library...")
(set #installca "Which catalog files do\nyou want to install ?")
(set #installff "\nWould you like to install the\n(GoldED compatible) findfunctions ?")
(set #keyfile "\nDo you have a keyfile ?")
(set #keyfilecop "Copying your keyfile...")
(set #keyfileno "No keyfile selected!\n")
(set #keyfilesel "Please select your keyfile.")
(set #overpref "\nDo you want to overwrite the old AMIS\npreferences ?\n\n(Old versions of AMIS won't work with\nthe new preferences, but you'll need\nthem for version 1.03)")
(set #prefscopy "Copying preferences...\n")
(set #selectff "Select the findfunctions you want\nto install")
(set #viewers "The viewers are not included in this archive.\nPlease download them from the Aminet:\n\ncomm/www/amis_html.lha and dev/c/amis_c.lha")
(set #whichpref "Which menu-preference file should be installed ?")

(if (= @language "nederlands")
;
; Nederlandse installatie
;
(
(set #choosedest "Selecteer de lokatie waar AMIS moet worden geinstalleerd")
(set #choosedesthelp "Kies een partitie of directory waar AMIS kan worden geplaatst. Er zal een directory genaamd AMIS worden aangemaakt op deze lokatie en de AMIS bestanden worden hiernaartoe gekopieerd.")
(set #copy "Aan het kopieren...\n")
(set #copyacd "AMIS.catalog (Duits) aan het kopieren...")
(set #copyaci "AMIS.catalog (Italiaans) aan het kopieren...")
(set #copyacn "AMIS.catalog (Nederlands) aan het kopieren...")
(set #copyal "amis.library aan het kopieren...")
(set #installca "Welke catalogus bestanden\nwilt u installeren ?")
(set #installff "\nWilt u de (GoldED compatibele)\nfindfunctions installeren ?")
(set #keyfile "\nHeeft u een keyfile (sleutelbestand) ?")
(set #keyfilecop "Uw keyfile (sleutelbestand) aan het kopieren...")
(set #keyfileno "Geen keyfile (sleutelbestand) geselecteerd!\n")
(set #keyfilesel "Selecteert u a.u.b. uw keyfile (sleutelbestand).")
(set #overpref "\nWilt u de oude AMIS voorkeursinstellingen\noverschrijven ?\n\n(Oudere versies van AMIS zullen niet\nmet de nieuwe instellingen werken maar\nzijn wel nodig voor versie 1.03)")
(set #prefscopy "Voorkeursinstellingen aan het kopieren...\n")
(set #selectff "Selecteer de findfunctions die u wilt\ninstalleren")
(set #viewers "De viewers zijn niet in dit archief meegeleverd.\nU kunt ze van het Aminet afhalen:\n\ncomm/www/amis_html.lha en dev/c/amis_c.lha")
(set #whichpref "Welke menu-voorkeursinstellingen moeten worden geinstalleerd ?")
)
)

(if (= @language "deutsch")
;
; Deutsche Installation
;
(
(set #choosedest "Wo soll das AMIS-Verzeichnis angelegt werden ?")
(set #choosedesthelp "Wählen Sie ein Verzeichnis in dem AMIS installiert werden soll. Das Install-Program wird ein Verzeichnis 'AMIS' anlegen und die AMIS Dateien hineinkopieren.")
(set #copy "Kopiere...\n")
(set #copyacd "Kopiere AMIS.catalog (Deutsch)...")
(set #copyaci "Kopiere AMIS.catalog (Italienisch)...")
(set #copyacn "Kopiere AMIS.catalog (Niederländisch)...")
(set #copyal "Kopiere amis.library...")
(set #installca "Welche Katalog-Dateien\nsollen installiert werden ?")
(set #installff "\nMöchten Sie die (GoldED kompatible)\n findfunctions Erweiterung installieren?")
(set #keyfile "\nHaben Sie eine Schlüsseldatei ?")
(set #keyfilecop "Kopiere die Schlüsseldatei...")
(set #keyfileno "Keine Schlüsseldatei ausgewählt!\n")
(set #keyfilesel "Bitte wählen Sie ihre Schlüsseldatei aus.")
(set #overpref "\nSollen die alten AMIS Einstellungen\ngelöscht werden ?\n\n(Ältere AMIS Versionen sind nicht kompatibel\nmit dem neuen Dateiformat, sie werden aber \nfür Version 1.03 benötigt)")
(set #prefscopy "Kopiere Einstellungen...\n")
(set #selectff "Wählen Sie die findfunktions-Erweiterung,\n die Sie installieren möchten")
(set #viewers "Die Anzeiger sind nicht in diesem Archiv.\nBitte schauen Sie im Aminet unter:\n\ncomm/www/amis_html.lha und dev/c/amis_c.lha")
(set #whichpref "Welche Menu-Einstellungen sollen installiert werden ?")
)
)

(if (= @language "italiano")
;
; Italiano Installatione
;
(
(set #choosedest "Seleziona la locazione dove installare la directory di AMIS")
(set #choosedesthelp "Scegli la partizione destinazione o la directory che contiene AMIS.  Il programma di installazione creerà una directory chiamata 'AMIS' nella locazione scelta e vi copierà i files di AMIS .")
(set #copy "sto copiando...\n")
(set #copyacd "Copio AMIS.catalog (German)...")
(set #copyaci "Copio AMIS.catalog (Italiano)...")
(set #copyacn "Copio AMIS.catalog (Dutch)...")
(set #copyal "sto copiando amis.library...")
(set #installca "Quale file catalogo\nvuoi installare ?")
(set #installff "\nVorresti installare le\n(compatibili GoldED) funzioni di ricerca ?")
(set #keyfile "\nHai il keyfile ?")
(set #keyfilecop "sto copiando il tuo keyfile...")
(set #keyfileno "Nessun keyfile selezionato!\n")
(set #keyfilesel "Prego, seleziona il tuo keyfile.")
(set #overpref "\nVuoi sovrascrivere le vecchie\n preferenze di AMIS?\n\n(Le precedenti versioni di AMIS non funzionano\ncon le nuove preferenze, ma ti servono\nper la versione 1.03)")
(set #prefscopy "sto copiando le preferenze...\n")
(set #selectff "Seleziona le funzioni di ricerca che vuoi\n installare")
(set #viewers "I visualizzatori non sono inclusi in questo archivio.\nPrego, download loro da Aminet:\n\ncomm/www/amis_html.lha e dev/c/amis_c.lha")
(set #whichpref "Which menu-preference file should be installed ?")
)
)

(welcome)

(set copyprefs 0)

(set dest2 (tackon
    (askdir
        (prompt #choosedest)
        (help #choosedesthelp)
        (default @default-dest)
    )"AMIS")
)

(set @default-dest dest2)

(makedir dest2 (infos))

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

(complete 30)

(makedir (tackon dest2 "Scripts"))

(copyfiles
  (prompt #copy)
  (source "Scripts/")
  (dest (tackon dest2 "Scripts"))
  (infos)
  (files)
  (all)
  (help @copyfiles-help)
)

(copyfiles
  (source "Viewers/")
  (dest (tackon dest2 "Viewers"))
  (infos)
  (files)
  (all)
  (help "")
)

(message #viewers)

(complete 40)

(makedir "ENVARC:AMIS")

(if (= (exists ("ENVARC:AMIS/AMIS.prefs")) 1)
  (
  (if (askbool
		(prompt #overpref)
		(help "")
	)
	(set copyprefs 1)
  )
  )
  (set copyprefs 1)
)

(if (= copyprefs 1)
  (
    (select
      (askchoice
        (prompt #whichpref)
        (help "")
        (choices "English" "Deutsch" "Nederlands" "Italiano")
        (default 0)
      )
;
; case 0  ---  English
;
      (
          (copyfiles (source "ENV/AMIS.prefs") (dest "ENVARC:AMIS/"))
          (copyfiles (source "ENV/AMIS.prefs") (dest "ENV:AMIS/"))
      )
;
; case 1  ---  German
;
      (
          (copyfiles (source "ENV/Deutsch/AMIS.prefs") (dest "ENVARC:AMIS/"))
          (copyfiles (source "ENV/Deutsch/AMIS.prefs") (dest "ENV:AMIS/"))
      )
;
; case 2  ---  Dutch
;
      (
          (copyfiles (source "ENV/Nederlands/AMIS.prefs") (dest "ENVARC:AMIS/"))
          (copyfiles (source "ENV/Nederlands/AMIS.prefs") (dest "ENV:AMIS/"))
      )
;
; case 3  ---  Italiano
;
      (
          (copyfiles (source "ENV/Italiano/AMIS.prefs") (dest "ENVARC:AMIS/"))
          (copyfiles (source "ENV/Italiano/AMIS.prefs") (dest "ENV:AMIS/"))
      )
    )
   )
)

(complete 60)

(set cats (askoptions
	(prompt #installca)
	(choices "Deutsch" "Italiano" "Nederlands")
	(help "")
	(default 0))
)

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

(if (AND cats 2)
	(
		(makedir "LOCALE:Catalogs/Italiano")
		(copyfiles
			(prompt #copyaci)
			(source "Catalogs/Italiano/AMIS.catalog")
			(dest "LOCALE:Catalogs/Italiano")
			(help @copyfiles-help)
		)
	)
)

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

(if (askbool
		(prompt #installff)
		(help "")
	)
	((makedir (tackon dest2 "Findfunctions") (infos))
	(copyfiles
	  (prompt #selectff)
	  (source "Findfunctions/")
	  (dest (tackon dest2 "Findfunctions"))
	  (all)
	  (files)
	  (confirm)
	  (help @copyfiles-help)
	)
	)
)

(complete 80)

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

(complete 90)

(if (<> (exists (tackon dest2 "AMIS_KeyFile")) 1)
(if (askbool
	(prompt #keyfile)
	(help ""))
	(
		(set keyfile (askfile
			(prompt #keyfilesel)
			(default "")
			(help   "")))
		(if (= 84 (getsize keyfile))
			(if (<> (expandpath (pathonly keyfile)) (expandpath dest2))
				(copyfiles
					(prompt #keyfilecop)
					(source keyfile)
					(dest dest2)
					(newname "AMIS_KeyFile"))
			)
			(message #keyfileno)
		)
	)
)
)

(complete 100)
(exit)
