; This is the ScanQuix3 install script
; $VER: install_script 1.6 (05.03.97) © by Andreas Günther
; italian translation: 01.03.97 © a cura di Marco Kohler - FRACTAL MINDS - ROMA

; 1.0 -> 1.1 : - Installation von AdPro- und PageStream Lademodulen hinzugefügt
; 1.1 -> 1.2 : - Installation von DPaintV Lademodul hizugefügt
;              - Bei AdPro und Pagestream copylib durch copyfiles ersetzt
; 1.2 -> 1.3 : - Bei Photogenics wird der GIO-Catalog nur noch kopiert, wenn
;                "Photogenics:" existiert.
; 1.3 -> 1.4 : - Installation von ArtEffect Plugin hinzugefügt
;              - Photogenics: GIO-Catalog wird bei deinstallation jetzt auch gelöscht.
; 1.4 -> 1.5 : - Installation von PersonalPaint Loader hinzugefügt
; 1.5 -> 1.6 : - Italienische Texte hizugefügt
;              - Wenn keine Treiber auf ScanQuix-Diskette vorhanden sind, werden die
;                Treiber (und dazugehörige Catalogs) von einer Diskette mit dem Namen
;                "ScanQuix3 Drivers" installiert.


(transcript "ScanQuix installation:")

(if (patmatch @language "deutsch")
  (set deutsch 1)
  (set deutsch 0)
)

(if (patmatch @language "italiano")
  (set italiano 1)
  (set italiano 0)
)

(if deutsch   (set t_welche_op "\n\n\n\nBitte wählen Sie, welche Aktion durchgeführt werden soll:")
(if italiano  (set t_welche_op "\n\n\n\nChe operazione volete fare?")
              (set t_welche_op "\n\n\n\nWhat Operation do you want to perform ?")
))
(if deutsch   (set t_welcheop_help "\"ScanQuix installieren\" installiert die komplette ScanQuix Software.\n\"Installation entfernen\" löscht die gesamte ScanQuix-Installation von Ihrer Festplatte.")
(if italiano  (set t_welcheop_help "Scegliendo \"Installare ScanQuix3\", installerete ScanQuix3 e i(l) driver per gli(lo) scanner sul vostro computer.\nScegliendo \"Rimuovere Scanquix3\", potrete rimuovere dal vostro computer, una precedente installazione di ScanQuix, insieme con i relativi driver.")
              (set t_welcheop_help "By choosing \"Install ScanQuix\", you can install ScanQuix and the scanner driver(s) on your computer.\nWith the choice \"Remove Installation\", an existing installation of ScanQuix and the scanner drivers can be entirely removed from your System.")
))
(if deutsch   (set t_welheop_1 "ScanQuix installieren")
(if italiano  (set t_welheop_1 "Installare ScanQuix3")
              (set t_welheop_1 "Install ScanQuix")
))
(if deutsch   (set t_welheop_0 "Installation entfernen")
(if italiano  (set t_welheop_0 "Rimuovere ScanQuix3")
              (set t_welheop_0 "Remove ScanQuix")
))
(if deutsch   (set t_woanlegen "Wo soll die ScanQuix Schublade eingerichtet werden ?")
(if italiano  (set t_woanlegen "In quale cassetto volete creare la directory di ScanQuix3?")
              (set t_woanlegen "Where do you want the \"ScanQuix\" drawer to be created ?")
))
(if deutsch   (set t_copying_sq "\n\n\nScanQuix wird kopiert...")
(if italiano  (set t_copying_sq "\n\n\nQuali componenti di ScanQuix3 volete installare?")
              (set t_copying_sq "\n\n\nCopying ScanQuix...")
))
(if deutsch   (set t_copying_gtlib "\n\n\nDie gtlayout.library wird kopiert...")
(if italiano  (set t_copying_gtlib "\n\n\nSto copiando la gtlayout.library...")
              (set t_copying_gtlib "\n\n\nCopying gtlayout.library...")
))
(if deutsch   (set t_copying_device "\n\n\nDas scanner.device wird kopiert...")
(if italiano  (set t_copying_device "\n\n\nSto copiando lo scanner.device...")
              (set t_copying_device "\n\n\nCopying scanner.device...")
))
(if deutsch   (set t_copying_driver "\n\n\nDer Scanner-Treiber wird kopiert...")
(if italiano  (set t_copying_driver "\n\n\nCopia dei driver per lo scanner...")
              (set t_copying_driver "\n\n\nCopying scanner driver...")
))
(if deutsch   (set t_copying_cat_d "\n\n\nDie deutschen Programmtexte werden kopiert...")
(if italiano  (set t_copying_cat_d "\n\n\nCopia dei file del catalogo tedesco...")
              (set t_copying_cat_d "\n\n\nCopying german catalog files...")
))
(if deutsch   (set t_copying_cat_i "\n\n\nDie italienischen Programmtexte werden kopiert...")
(if italiano  (set t_copying_cat_i "\n\n\nCopia dei file del catalogo italiano...")
              (set t_copying_cat_i "\n\n\nCopying italian catalog files...")
))
(if deutsch   (set t_askloader "Welche Lademodule sollen installiert werden ?")
(if italiano  (set t_askloader "Quali moduli per programmi esterni volete installare?")
              (set t_askloader "Which loaders do you want to be installed ?")
))
(if deutsch   (set t_copying_GIO "\n\n\nDas Lademodul für Photogenics wird kopiert...")
(if italiano  (set t_copying_GIO "\n\n\nConferma la copia del modulo per Photogenics...")
              (set t_copying_GIO "\n\n\nCopying Photogenics loader...")
))
(if deutsch   (set t_copying_IFX "\n\n\nDas Scannermodule für ImageFX  wird kopiert...")
(if italiano  (set t_copying_IFX "\n\n\nConferma la copia del modulo per ImageFX...")
              (set t_copying_IFX "\n\n\nCopying ImageFX scanner module...")
))
(if deutsch   (set t_copying_ADPRO "\n\n\nDas Scannermodule für ADPro  wird kopiert...")
(if italiano  (set t_copying_ADPRO "\n\n\nConferma la copia del modulo per ADPro...")
              (set t_copying_ADPRO "\n\n\nCopying ADPro scanner module...")
))
(if deutsch   (set t_copying_PGS "\n\n\nDas Scannermodule für PageStream 3 wird kopiert...")
(if italiano  (set t_copying_PGS "\n\n\nConferma la copia del modulo per PageStream 3...")
              (set t_copying_PGS "\n\n\nCopying PageStream 3 scanner module...")
))
(if deutsch   (set t_copying_DPV "\n\n\nDas Scannermodule für Deluxe Paint V wird kopiert...")
(if italiano  (set t_copying_DPV "\n\n\nConferma la copia del modulo per Deluxe Paint V...")
              (set t_copying_DPV "\n\n\nCopying Deluxe Paint V scanner module...")
))
(if deutsch   (set t_copying_PSS "\n\n\nDas Plugin für ArtEffect wird kopiert...")
(if italiano  (set t_copying_PSS "\n\n\nConferma la copia dei plug-in per ArtEffect...")
              (set t_copying_PSS "\n\n\nCopying plugin for ArtEffect...")
))
(if deutsch   (set t_copying_PPaint "\n\n\nDas Eingabemodul für PersonalPaint wird kopiert...")
(if italiano  (set t_copying_PPaint "\n\n\nConferma la copia del modulo per PersonalPaint...")
              (set t_copying_PPaint "\n\n\nCopying loader for PersonalPaint...")
))
(if deutsch   (set t_wirklich_loeschen "\n\n\n\nMöchten Sie wirklich die gesamte ScanQuix Installation\nentfernen ?\n\nAlle Einstellungen werden dabei gelöscht !\nALLE BILDER im ScanQuix-Verzeichnis WERDEN UNWIEDERBRINGLICH GELÖSCHT !")
(if italiano  (set t_wirklich_loeschen "\n\n\n\nVolete veramente rimuovere l'installazione di ScanQuix3?\n\nTutte le impostazioni saranno cancellate!\nTUTTE LE IMMAGINI nella directory di ScanQuix SARANNO CANCELLATE!")
              (set t_wirklich_loeschen "\n\n\n\nDo you really want to remove your ScanQuix installation ?\n\nAll settings will be lost !\nALL IMAGES in the ScanQuix drawer ARE DELETED !")
))
(if deutsch   (set t_loeschen_help "Sie könenn die Scannertreiber jederzeit neu installieren, allerdings sind die Einstellungen verloren !")
(if italiano  (set t_loeschen_help "Potete reinstallare i vostri driver in qualsiasi momento, ma perderete le vostre attuali impostazioni!")
              (set t_loeschen_help "You can reinstall your scanner drivers at any time, but you will loose the current settings !")
))
(if deutsch   (set t_loesche_sq "Die ScanQuix Installation wird gelöscht.")
(if italiano  (set t_loesche_sq "Sto cancellando l'installazione di ScanQuix3.")
              (set t_loesche_sq "Deleting the ScanQuix installation.")
))
(if deutsch   (set t_makedir "Verzeichnis wird erstellt...")
(if italiano  (set t_makedir "Sto creando la directory...")
              (set t_makedir "Creating directory...")
))
(if deutsch   (set t_save_dest "Pfad des ScanQuix-Verzeichnisses wird gespeichert...")
(if italiano  (set t_save_dest "Sto salvando il path del cassetto di ScanQuix3...")
              (set t_save_dest "Saving path of ScanQuix drawer...")
))
(if deutsch   (set t_savedesthelp "Der Pfad wird im ENV: Verzeichnis gespeichert, um die ScanQuix-Installation ggf. vollständig entfernen zu können.")
(if italiano  (set t_savedesthelp "Il Path è memorizzato nella directory ENV:. Questa informazione è utile in caso di rimozione del programma.")
              (set t_savedesthelp "The Path is saved to the ENV: directory. This is important to uninstall the ScanQuix software.")
))
;(if deutsch   (set t_ "")
;(if italiano  (set t_ "")
;              (set t_ "")
;))


(set install_sq
  (askbool
    (prompt t_welche_op)
    (help t_welcheop_help)
    (choices t_welheop_1 t_welheop_0)
    (default 1)
  )
)

(if install_sq
 (
  (set sq_path
    (askdir
      (prompt t_woanlegen)
      (help @askdir-help)
      (default @default-dest)
    )
  )

  (set @default-dest sq_path)

  (copyfiles
    (prompt t_copying_sq)
    (help @copyfiles-help)
    (source "ScanQuix3:ScanQuix3")
    (dest (tackon sq_path "ScanQuix3"))
    (all)
    (infos)
    (confirm)
  )

  (if deutsch
    (makedir (tackon sq_path "ScanQuix3/Bilder") 
      (prompt t_makedir)
      (help @makedir-help)
      (infos)
    )
    (makedir (tackon sq_path "ScanQuix3/Pictures")
      (prompt t_makedir)
      (help @makedir-help)
      (infos)
    )
  )

  (copylib
    (prompt t_copying_gtlib)
    (help @copylib-help)
    (source "ScanQuix3:Libs/gtlayout.library")
    (dest "LIBS:")
    (confirm)
  )

  (copylib
    (prompt t_copying_device)
    (help @copylib-help)
    (source "ScanQuix3:Devs/scanner.device")
    (dest "DEVS:")
    (confirm)
  )

  (if (exists "LOCALE:" (noreq))
    (
     ; locale is installed, so copy the catalog stuff
      (if (exists "LOCALE:Catalogs/deutsch" (noreq))
        (copyfiles
    	    (prompt t_copying_cat_d)
          (help @copyfiles-help)
          (source "ScanQuix3:Catalogs/deutsch/")
          (dest "LOCALE:Catalogs/deutsch/ScanQuix")
          (confirm)
          (all)
        )
      )

      (if (exists "LOCALE:Catalogs/italiano" (noreq))
        (copyfiles
    	    (prompt t_copying_cat_i)
          (help @copyfiles-help)
          (source "ScanQuix3:Catalogs/italiano")
          (dest "LOCALE:Catalogs/italiano/ScanQuix")
          (confirm)
          (all)
        )
      )
    )
  )

  (if (exists "ScanQuix3:Devs/Scanners" (noreq))
    (
      (copyfiles
        (prompt t_copying_driver)
        (help @copyfiles-help)
        (source "ScanQuix3:Devs/Scanners")
        (dest "DEVS:Scanners")
        (all)
        (infos)
        (confirm)
      )
    )
    ( ; else
      (copyfiles
        (prompt t_copying_driver)
        (help @copyfiles-help)
        (source "ScanQuix3 Drivers:Scanners")
        (dest "DEVS:Scanners")
        (all)
        (infos)
        (confirm)
      )

      (if (exists "LOCALE:" (noreq))
        (
         ; locale is installed, so copy the catalog stuff
          (if (exists "LOCALE:Catalogs/deutsch" (noreq))
            (copyfiles
        	    (prompt t_copying_cat_d)
              (help @copyfiles-help)
              (source "ScanQuix3 Drivers:Catalogs/deutsch/")
              (dest "LOCALE:Catalogs/deutsch/ScanQuix")
              (confirm)
              (all)
            ) 
          )

          (if (exists "LOCALE:Catalogs/italiano" (noreq))
            (copyfiles
        	    (prompt t_copying_cat_i)
              (help @copyfiles-help)
              (source "ScanQuix3 Drivers:Catalogs/italiano")
              (dest "LOCALE:Catalogs/italiano/ScanQuix")
              (confirm)
              (all)
            )
          )
        )
      )
    )
  )

  (makedir "ENVARC:ScanQuix"
    (prompt t_makedir)
    (help @makedir-help)
    (infos)
  )

  (makedir "ENVARC:ScanQuix/Scanners"
    (prompt t_makedir)
    (help @makedir-help)
    (infos)
  )

  (makedir "ENV:ScanQuix"
    (prompt t_makedir)
    (help @makedir-help)
    (infos)
  )

  (makedir "ENV:ScanQuix/Scanners"
    (prompt t_makedir)
    (help @makedir-help)
    (infos)
  )

  (textfile
    (prompt t_save_dest)
    (help t_savedesthelp)
    (dest "ENVARC:ScanQuix/Path")
    (append sq_path)
  )

  (textfile
    (prompt t_save_dest)
    (help t_savedesthelp)
    (dest "ENV:ScanQuix/Path")
    (append sq_path)
  )


  (set loader (askoptions
    (prompt t_askloader)
    (help @askoptions-help)
    (choices "Photogenics" "ImageFX" "Art Department Prof." "PageStream 3" "Deluxe Paint V" "ArtEffect" "Personal Paint")
    (default -1)
  ))

  (if (in loader 0)
    (if (exists "Photogenics:" (noreq))
      (
        (copylib
          (prompt t_copying_GIO)
          (help @copylib-help)
          (source "ScanQuix3:Support/Photogenics/ScanQuix.gio")
          (dest "Photogenics:Data/GIO")
          (confirm)
        )

        (if (exists "LOCALE:Catalogs/deutsch" (noreq))
          (copyfiles
    	      (prompt t_copying_cat_d)
            (help @copyfiles-help)
            (source "ScanQuix3:Support/Photogenics/deutsch/ScanQuix_GIO.catalog")
            (dest "LOCALE:Catalogs/deutsch")
            (confirm)
          )
        )

        (if (exists "LOCALE:Catalogs/italiano" (noreq))
          (copyfiles
    	      (prompt t_copying_cat_i)
            (help @copyfiles-help)
            (source "ScanQuix3:Support/Photogenics/italiano/ScanQuix_GIO.catalog")
            (dest "LOCALE:Catalogs/italiano")
            (confirm)
          )
        )
      )
    )
  )

  (if (in loader 1)
    (if (exists "ImageFX:" (noreq))
      (copylib
        (prompt t_copying_IFX)
        (help @copylib-help)
        (source "ScanQuix3:Support/ImageFX/ScanQuix")
        (dest "ImageFX:Modules/Scanner")
        (confirm)
      )
    )
  )

  (if (in loader 2)
    (if (exists "ADPRO:" (noreq))
      (copyfiles
        (prompt t_copying_ADPRO)
        (help @copyfiles-help)
        (source "ScanQuix3:Support/ADPro/SCANQUIX")
        (dest "ADPRO:Loaders2")
        (confirm)
      )
    )
  )

  (if (in loader 3)
    (if (exists "PageStream3:" (noreq))
      (copyfiles
        (prompt t_copying_PGS)
        (help @copyfiles-help)
        (source "ScanQuix3:Support/PageStream/ScanImage.rexx")
        (dest "PageStream3:Macros")
        (confirm)
      )
    )
  )

  (if (in loader 4)
    (if (exists "DPaintV:" (noreq))
      (copyfiles
        (prompt t_copying_DPV)
        (help @copyfiles-help)
        (source "ScanQuix3:Support/DPaintV")
        (dest "DPaintV:Macros")
        (confirm)
        (all)
      )
    )
  )

  (if (in loader 5)
    (if (exists "ArtEffect:" (noreq))
      (
        (copyfiles
          (prompt t_copying_PSS)
          (help @copyfiles-help)
          (source "ScanQuix3:Support/ArtEffect/ScanQuix.pss")
          (dest "ArtEffect:plugins")
          (confirm)
        )

        (if (exists "LOCALE:Catalogs/deutsch" (noreq))
          (copyfiles
    	      (prompt t_copying_cat_d)
            (help @copyfiles-help)
            (source "ScanQuix3:Support/ArtEffect/deutsch/ScanQuix_PSS.catalog")
            (dest "LOCALE:Catalogs/deutsch")
            (confirm)
          )
        )
      )
    )
  )

  (if (in loader 6)
    (if (exists "PPaint:libs" (noreq))
      (copylib
        (prompt t_copying_PPaint)
        (help @copylib-help)
        (source "ScanQuix3:Support/PPaint/personal_scanquix_io.library")
        (dest "PPaint:libs")
        (confirm)
      )
    )
  )


;  (set old_user (user 1))   ; always ask
;  (user old_user)

 )
 (  ; else uninstall

  (set @default-dest "")

  (if (askbool
        (prompt t_wirklich_loeschen)
        (help t_loeschen_help)
        (default 0)
      )

    (
     ; uninstall procedure

      (if (exists "ENV:ScanQuix/Path")
        (
          (run (cat "delete \"" (tackon (getenv "ScanQuix/Path") "ScanQuix3\"") "all")
            (prompt t_loesche_sq)
            (help t_loeschen_help)
            (confirm)
          )

          (run (cat "delete \"" (tackon (getenv "ScanQuix/Path") "ScanQuix3.info\""))
            (prompt t_loesche_sq)
            (help t_loeschen_help)
            (confirm)
          )
        )
      )

      (run "delete DEVS:Scanners all"
        (prompt t_loesche_sq)
        (help t_loeschen_help)
        (confirm)
      )

      (delete "DEVS:Scanners.info"
        (prompt t_loesche_sq)
        (help t_loeschen_help)
        (confirm)
      )

      (delete "DEVS:scanner.device"
        (prompt t_loesche_sq)
        (help t_loeschen_help)
        (confirm)
      )

      (if (exists "Photogenics:" (noreq))
        (
          (delete "Photogenics:Data/GIO/ScanQuix.gio"
            (prompt t_loesche_sq)
            (help t_loeschen_help)
            (confirm)
          )
          (delete "LOCALE:Catalogs/deutsch/ScanQuix_GIO.catalog"
            (prompt t_loesche_sq)
            (help t_loeschen_help)
            (confirm)
          )
        )
      )

      (if (exists "ImageFX:" (noreq))
        (delete "ImageFX:Modules/Scanner/ScanQuix"
          (prompt t_loesche_sq)
          (help t_loeschen_help)
          (confirm)
        )
      )

      (if (exists "ADPRO:" (noreq))
        (delete "ADPRO:Loaders2/SCANQUIX"
          (prompt t_loesche_sq)
          (help t_loeschen_help)
          (confirm)
        )
      )

      (if (exists "PageStream3:" (noreq))
        (delete "PageStream3:Macros/ScanImage.rexx"
          (prompt t_loesche_sq)
          (help t_loeschen_help)
          (confirm)
        )
      )

      (if (exists "DPaintV:" (noreq))
        (delete "DPaintV:Macros/Scan(Image|Brush).dprx"
          (prompt t_loesche_sq)
          (help t_loeschen_help)
          (confirm)
        )
      )

      (if (exists "ArtEffect:" (noreq))
        (
          (delete "ArtEffect:plugins/ScanQuix.pss"
            (prompt t_loesche_sq)
            (help t_loeschen_help)
            (confirm)
          )
          (delete "LOCALE:Catalogs/deutsch/ScanQuix_PSS.catalog"
            (prompt t_loesche_sq)
            (help t_loeschen_help)
            (confirm)
          )
        )
      )

      (if (exists "PPaint:libs" (noreq))
        (delete "PPaint:libs/personal_scanquix_io.library"
          (prompt t_loesche_sq)
          (help t_loeschen_help)
          (confirm)
        )
      )

      (delete "DEVS:scanner.device"
        (prompt t_loesche_sq)
        (help t_loeschen_help)
        (confirm)
      )

      (run "delete LOCALE:Catalogs/deutsch/ScanQuix all"
        (prompt t_loesche_sq)
        (help t_loeschen_help)
        (confirm)
      )

      (run "delete ENVARC:ScanQuix all"
        (prompt t_loesche_sq)
        (help t_loeschen_help)
        (confirm)
      )

      (run "delete ENV:ScanQuix all"
        (prompt t_loesche_sq)
        (help t_loeschen_help)
        (confirm)
      )

    )
  )
 )
)
