; This is the Installationscript for the HP_DeskJet600 Printerdriver.
; The HP_DeskJet600 Printerdriver is (C) by Dieter Sabathi,
; the Installerscript was done by Bernd Gollesch.
; Everybody can use and modify this script on his own risc.
;
; $VER: Install-HP_DeskJet600 1.0 (8.9.96)Installerscript for the HP_DeskJet600 Printerdriver (C) 1996 by Dieter Sabathi
;

; set variables that are for all languages the same one

(set #destdir-driver "DEVS:Printers")
(set #destdir-guide  "HELP:")
(set #destname-guide "HP_DJ600.guide")

;because of the last installer-message
(set @default-dest "")

(set #source-driver "HP_DeskJet600")
(set #source-icons "%s/%s.info")

(set #icon-choice-1 "Standard")
(set #icon-choice-2 "MagicWB")
(set #icon-choice-3 "NewIcons")

;get the Versionnumber of the Driver to be installed

(set #vernum1 (getversion #source-driver))
(set #ver1 (/ #vernum1 65536)) 
(set #rev1 (- #vernum1 (* #ver1 65536)))
(set #driver-version ("%ld.%ld" #ver1 #rev1))

(debug "Versionsnummern " #driver-version)

; Only german or english text.

(if (= @language "deutsch")
 ; then
  (
    (set #about-text ("\n\nWillkommen zur Installation des\n\nHP_DeskJet600 Druckertreiber\n\nVersion %s\n\nCopyright © 1996 by Dieter Sabathi" #driver-version))
    (set #source-guide "HP_DJ600.de.guide")
    (set #noguidecopy "NICHT INSTALLIERT :-(")

    ;HELP Texte

    (set #icons-help "Das ist natürlich reine Geschmackssache.\nIch hoffe Deine bevorzugten Piktogramme sind dabei.")
    (set #driver-help "Es wird kein eigenes Verzeichnis angelegt. Du solltest den Treiber nach DEVS:Printers oder SYS:Storage/Printers kopieren.")
    (set #guide-help "Einmal durchlesen wäre sehr nett. Wir haben uns nämlich viel Mühe gegeben :-)")
    (set #run-printerprefs-help "Du kannst jetzt gleich den Druckertreiber auswählen, wenn Du es möchtest. Ansonsten mußt Du es eben später machen :-)")

    ;normale Texte

    (set #askdir-driver-text "ACHTUNG: Es wird kein eigenes Verzeichnis angelegt. Ich würde Dir DEVS:Printers empfehlen. Ansonsten kannst Du den Druckertreiber nämlich nicht über die Prefs auswählen!")
    (set #ask-guide-text "Willst Du die Guide-Datei installieren?")
    (set #askdir-guide-text "ACHTUNG: Es wird kein eigenes Verzeichnis angelegt. Ich schlage halt mal HELP: vor.")
    (set #ask-icon-text "Welche Piktogramme möchtest Du installiert bekommen?")
    (set #copy-driver-text "Kopieren von HP_DeskJet600")
    (set #copy-guide-text "Kopieren von HP_600.guide")
    (set #copy-icon-text "Kopieren von %s.info")
    (set #run-printerprefs "Willst Du das Printer-Preference Programm starten?")
    (set #goodbye "Installation von HP Deskjet 600 fertig.\n\nDas Programm ist Freeware.\n\nWenn Du willst, kannst Du aber 20 DM oder 140 ATS an den Author senden.\n(Adresse siehe Guide-Datei)\n\n Treiber kopiert nach \"%s\"\nGuide kopiert nach \"%s\"")
  )
 ; else
  (
    (set #about-text ("\n\nWelcome to the installation of the\n\nHP_DeskJet600 Printerdriver\n\nVersion %s\n\nCopyright © 1996 by Dieter Sabathi" #driver-version))
    (set #source-guide "HP_DJ600.eng.guide")
    (set #noguidecopy "NOT INSTALLED :-(")

    ; HELP Texte

    (set #icons-help "Each to his own taste.\nI hope that i have included your prefered icon.")
    (set #driver-help "No Drawer will be created. You should copy the Driver to DEVS:Printers or SYS:Storage/Printers.")
    (set #guide-help "Please read it once. It was a hard work to do :-)")
    (set #run-printerprefs-help "You can start the printer preferences now, if you want. Otherwise you have to do it later :-)")

    ;normal text

    (set #askdir-driver-text "ATTENTION: No Drawer will be created. I would copy it to DEVS:Printers. If you do not, you can't select the Printer with the Prefs-Program!")
    (set #ask-guide-text "Should I install the Guide?")
    (set #askdir-guide-text "ATTENTION: No Drawer will be created. How about HELP:")
    (set #ask-icon-text "Wich Icons do you want?")
    (set #copy-driver-text "Copy HP_DeskJet600")
    (set #copy-guide-text "Copy HP_600.guide")
    (set #copy-icon-text "Copy %s.info")
    (set #run-printerprefs "Do you wanna start the Printer-Preference program?")
    (set #goodbye "Installation of HP DeskJet 600 completed.\n\nThis is a Freeware program.\n\nIf you want, you can send 20 DM or 140 ATS to the author.\n(For the address have a look in the Guide)\n\nDriver copied to \"%s\"\nGuide copied to \"%s\"")
  )
) ; end if

; start the installation

(message #about-text)
(welcome)

(set #destdir-driver
    (askdir
        (prompt #askdir-driver-text)
        (help   (cat #driver-help "\n\n" @askdir-help))
        (default #destdir-driver)
    )
)

(complete 13)
(debug "Destination dir for driver is " #destdir-driver)

; ask for installing guide

(set #copy-guide
    (askbool
        (prompt #ask-guide-text)
        (help #guide-help)
        (default 1)
    )
)

(complete 25)
(debug "Copy Guide answer " #copy-guide)

; ask vor the dir in wich the guide should be installed

(if #copy-guide
 ; then
 (
    (set #destdir-guide
        (askdir
            (prompt #askdir-guide-text)
            (help (cat #guide-help "\n\n" @askdir-help))
            (default #destdir-guide)
        )
    )
 )
 ;else
 (
    (set #destdir-guide (cat #noguidecopy))
 )
) ; end if

(complete 38)
(debug "Dir for Guide is " #destdir-guide)

; ask wich icons should be installed

(set #copy-icons
    (askchoice
        (prompt #ask-icon-text)
        (help (cat #icons-help "\n\n" @askchoice-help))
        (choices #icon-choice-1 #icon-choice-2 #icon-choice-3)
        (default 0)
    )
)

(complete 50)
(debug "Icon selected was " #copy-icons)

; now start the real installation of the files

; Printerdriver

(copylib
    (prompt #copy-driver-text)
    (help @copylib-help)
    (source #source-driver)
    (dest #destdir-driver)
    (confirm)
)

(complete 63)
; selected icons for driver

(copyfiles
    (prompt (#copy-icon-text #source-driver))
    (help @copyfiles-help)
    (source (#source-icons
                (select #copy-icons
                    (cat #icon-choice-1)
                    (cat #icon-choice-2)
                    (cat #icon-choice-3)
                )
                #source-driver
            )
    )
    (dest #destdir-driver)
    (files)
    (confirm)
)

(complete 75)
; Guide if selected

(if #copy-guide
 ; then
 (
    (copylib
        (prompt #copy-guide-text)
        (help @copylib-help)
        (source #source-guide)
        (dest #destdir-guide)
        (newname #destname-guide)
        (confirm)
    )

    (complete 88)
    ; icon for Guide
    (copyfiles
        (prompt (#copy-icon-text #destname-guide))
        (help @copyfiles-help)
        (source (#source-icons
                    (select #copy-icons
                        (cat #icon-choice-1)
                        (cat #icon-choice-2)
                        (cat #icon-choice-3)
                    )
                    #destname-guide
                )
        )
        (dest #destdir-guide)
        (files)
        (confirm)
    )
 )
) ; end if

(complete 100)

; The next command should be the same for all languages because
; it's a system default.

(run "Sys:Prefs/Printer"
    (prompt #run-printerprefs)
    (help #run-printerprefs-help)
    (confirm)
)

(exit
    (#goodbye #destdir-driver #destdir-guide)
    (quiet)
)
