; This is the CamControl install script
; $VER: install_script 1.0 (24.10.97) © by Andreas Günther


(transcript "CamControl installation:")

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

(if deutsch
  (set t_welche_op "\n\n\n\nBitte wählen Sie, welche Aktion durchgeführt werden soll:")
  (set t_welche_op "\n\n\n\nWhat Operation do you want to perform ?")
)
(if deutsch
  (set t_welcheop_help "\"CamControl installieren\" installiert die komplette CamControl Software.\n\"Installation entfernen\" löscht die gesamte CamControl-Installation von Ihrer Festplatte.")
  (set t_welcheop_help "By choosing \"Install CamControl\", you can install CamControl on your computer.\nWith the choice \"Remove Installation\", an existing installation of CamControl will be entirely removed from your system.")
)
(if deutsch
  (set t_welcheop_1 "CamControl installieren")
  (set t_welcheop_1 "Install CamControl")
)
(if deutsch
  (set t_welcheop_0 "Installation entfernen")
  (set t_welcheop_0 "Remove installation")
)
(if deutsch
  (set t_woanlegen "Wo soll die CamControl Schublade eingerichtet werden ?")
  (set t_woanlegen "Where do you want the \"CamControl\" drawer to be created ?")
)
(if deutsch
  (set t_copying_qv "\n\n\nCamControl wird kopiert...")
  (set t_copying_qv "\n\n\nCopying CamControl...")
)
(if deutsch
  (set t_copying_gtlib "\n\n\nDie gtlayout.library wird kopiert...")
  (set t_copying_gtlib "\n\n\nCopying gtlayout.library...")
)
(if deutsch
  (set t_askloader "Für welche Programme sollen ARexx-Skripten installiert werden ?\nDadurch können Sie Fotos aus der Kamera direkt in diese Programme einlesen.")
  (set t_askloader "For which programs do you want to install ARexx scripts ?\nThis enables you to transfer photos from the camera directly into these programs.")
)
(if deutsch
  (set t_copying_photogenics_script "\n\n\nDas ARexx-Skript für Photogenics wird kopiert...")
  (set t_copying_photogenics_script "\n\n\nCopying ARexx script for Photogenics...")
)
(if deutsch
  (set t_copying_ADPRO "\n\n\nDas Lademodul (ARexx-Skript) für ADPro  wird kopiert...")
  (set t_copying_ADPRO "\n\n\nCopying ADPro loader module (ARexx script)...")
)
(if deutsch
  (set t_copying_PGS "\n\n\nDas ARexx-Makro für PageStream 3 wird kopiert...")
  (set t_copying_PGS "\n\n\nCopying PageStream 3 ARexx macro script...")
)
(if deutsch
  (set t_copying_DPV "\n\n\nDas ARexx-Skript für Deluxe Paint V wird kopiert...")
  (set t_copying_DPV "\n\n\nCopying ARexx script for Deluxe Paint V...")
)
(if deutsch
  (set t_copying_PPaint "\n\n\nDas ARexx-Skript für PersonalPaint wird kopiert...")
  (set t_copying_PPaint "\n\n\nCopying ARexx script for PersonalPaint...")
)
(if deutsch
  (set t_wirklich_loeschen "\n\n\n\nMöchten Sie wirklich die gesamte CamControl Installation\nentfernen ?\n\nAlle Einstellungen werden dabei gelöscht !\nALLE BILDER im CamControl Archiv-Verzeichnis WERDEN UNWIEDERBRINGLICH GELÖSCHT !")
  (set t_wirklich_loeschen "\n\n\n\nDo you really want to remove your CamControl installation ?\n\nAll settings will be lost !\nALL IMAGES in the CamControl archive drawer ARE DELETED !")
)
(if deutsch
  (set t_loeschen_help "Sie können CamControl jederzeit neu installieren, allerdings sind die Einstellungen verloren !")
  (set t_loeschen_help "You can reinstall CamControl, but you will loose the current settings !")
)
(if deutsch
  (set t_loesche_qv "Die CamControl Installation wird gelöscht.")
  (set t_loesche_qv "Deleting the CamControl installation.")
)
(if deutsch
  (set t_makedir "Verzeichnis wird erstellt...")
  (set t_makedir "Creating directory...")
)
(if deutsch
  (set t_save_dest "Pfad des CamControl-Verzeichnisses wird gespeichert...")
  (set t_save_dest "Saving path of CamControl drawer...")
)
(if deutsch
  (set t_savedesthelp "Der Pfad wird im ENV: Verzeichnis gespeichert, um die Programme von ARexx-Skripten aus zu finden und um ggf. die CamControl-Installation vollständig entfernen zu können.")
  (set t_savedesthelp "The Path is saved to the ENV: directory. This is important to find and start the programs from ARexx scripts and to uninstall the CamControl software.")
)
;(if deutsch
;  (set t_ "")
;  (set t_ "")
;)


(set install_qv
  (askbool
    (prompt t_welche_op)
    (help t_welcheop_help)
    (choices t_welcheop_1 t_welcheop_0)
    (default 1)
  )
)

(if install_qv
 (
  (set qv_path
    (askdir
      (prompt t_woanlegen)
      (help @askdir-help)
      (default @default-dest)
    )
  )

  (set @default-dest qv_path)

  (set qv_path (tackon qv_path "CamControl"))

  (copyfiles
    (prompt t_copying_qv)
    (help @copyfiles-help)
    (source "CamControl")
    (dest qv_path)
    (all)
    (infos)
    (confirm)
  )

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

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

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

  (textfile
    (prompt t_save_dest)
    (help t_savedesthelp)
    (dest "ENVARC:CamControl/PATHMAIN")
    (append qv_path)
  )

  (textfile
    (prompt t_save_dest)
    (help t_savedesthelp)
    (dest "ENV:CamControl/PATHMAIN")
    (append qv_path)
  )


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

  (if (in loader 0)
    (if (exists "Photogenics:data/scripts" (noreq))
      (copyfiles
	      (prompt t_copying_photogenics_script)
        (help @copyfiles-help)
        (source "Support/Photogenics2/Camedia.rx")
        (dest "Photogenics:data/scripts")
        (confirm)
      )
    )
  )

  (if (in loader 1)
    (if (exists "ADPRO:Loaders2" (noreq))
      (copyfiles
        (prompt t_copying_ADPRO)
        (help @copyfiles-help)
        (source "Support/AdPro2.5/Camedia")
        (dest "ADPRO:Loaders2")
        (confirm)
      )
    )
  )

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

  (if (in loader 3)
    (if (exists "DPaintV:Macros" (noreq))
      (copyfiles
        (prompt t_copying_DPV)
        (help @copyfiles-help)
        (source "Support/DPaintV/Camedia.dprx")
        (dest "DPaintV:Macros")
        (confirm)
      )
    )
  )

  (if (in loader 4)
    (if (exists "PPaint:Rexx" (noreq))
      (copyfiles
        (prompt t_copying_PPaint)
        (help @copyfiles-help)
        (source "Support/PPaint7/Camedia.pprx")
        (dest "PPaint:Rexx")
        (confirm)
      )
    )
  )


 )
 (  ; else uninstall

  (set @default-dest "")

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

    (
     ; uninstall procedure

      (if (exists "ENV:CamControl/PATHMAIN")
        (
          (run (cat "delete \"" (getenv "CamControl/PATHMAIN") "\" all")
            (prompt t_loesche_qv)
            (help t_loeschen_help)
            (confirm)
          )

          (run (cat "delete \"" (getenv "CamControl/PATHMAIN") ".info\"")
            (prompt t_loesche_qv)
            (help t_loeschen_help)
            (confirm)
          )
        )
      )

      (if (exists "Photogenics:Data/scripts" (noreq))
        (delete "Photogenics:Data/scripts/Camedia.rx"
          (prompt t_loesche_qv)
          (help t_loeschen_help)
          (confirm)
        )
      )

      (if (exists "ADPRO:Loaders2" (noreq))
        (delete "ADPRO:Loaders2/Camedia"
          (prompt t_loesche_qv)
          (help t_loeschen_help)
          (confirm)
        )
      )

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

      (if (exists "DPaintV:Macros" (noreq))
        (delete "DPaintV:Macros/Camedia.dprx"
          (prompt t_loesche_qv)
          (help t_loeschen_help)
          (confirm)
        )
      )

      (if (exists "PPaint:Rexx" (noreq))
        (delete "PPaint:Rexx/Camedia.pprx"
          (prompt t_loesche_qv)
          (help t_loeschen_help)
          (confirm)
        )
      )

      (run "delete ENVARC:CamControl all"
        (prompt t_loesche_qv)
        (help t_loeschen_help)
        (confirm)
      )

      (run "delete ENV:CamControl all"
        (prompt t_loesche_qv)
        (help t_loeschen_help)
        (confirm)
      )
    )
  )
 )
)
