; This is the UserInfo v1.20 installer script
;
; by Kasper B. Graversen 12.6.95
;

(set @default-dest "")
(set UI-dest "SYS:")


(message (cat
    "                                               \n"
    "UserInfo 1.20                                  \n"
    "By Kasper B. Graversen                         \n"
    "                                               \n"
    "\"The program for all netters...\"             \n"
    "Please refer to the manual for more information\n"
    "about UserInfo and UserInfoMaker.              \n"
    "                                               \n"
    "                                               \n"
    "Please make sure, that you delete ALL the old  \n"
    "UserInfo files... Do ONLY use the files you    \n"
    "install now!                                   \n"
))


(welcome)
; Where to Install UserInfo (default: SYS:)
(set UI-dest    (askdir (prompt "Select drawer to place UserInfo into\nA directory will NOT be created.")
        	      (default "Work:")
          		  (newpath)
;                 (default UI-dest)
                  (help (cat "    UserInfo can be installed anywhere you like. "
                             "The ARexx script creator I've made will adjust "
                             "the script, so you won't have to change anything "
                             "no matter where you install UserInfo... "
                        )
                  )
                )
)


; Install which files?
(copyfiles
	(prompt "Install which files.")
    (help (cat "Have no worries! Just copy all the files..."))
	(source "Amiga/")
	(dest UI-dest)
	(pattern "#?")
	(files)
    (infos)
	(confirm)
)


; Install v1.00 cfg file
(set language
    (askchoice (prompt "Choose a language of the v1.00 cfg file to be installed")
               (choices "I don't want the v1.00 cfg file" "Dansk" "Deutch" "English" "Nederlands")
               (default 3)
               (help (cat "    If you want to be able to decode UserInfo v1.00 strings, "
                          "you must install the v1.00 cfg file. It is a good idea "
                          "to install it, as many still are using v1.00 of UserInfo."
                     )
               )
    )
)


; only copy if language is selected
(if (= 0 language)
    (message "Now you can't decode v1.00 datastrings...")
;else
    (
        (set copyname (select language "not-in-use"
                                       "UI_cfg/UI100_DK.cfg"
                                       "UI_cfg/UI100_D.cfg"
                                       "UI_cfg/UI100_UK.cfg"
                                       "UI_cfg/UI100_NL.cfg"
                      )
        )
        (copyfiles
            (source copyname)
            (newname "UI100.cfg")
            (dest UI-dest)
        )
    )
)



; Install v1.10 cfg file
(set language
    (askchoice (prompt "Choose a language of the v1.10 cfg file to be installed")
               (choices "I don't want the v1.10 cfg file" "Dansk" "Deutch" "English")
               (default 3)
               (help (cat "    If you want to be able to decode UserInfo v1.10 strings, "
                          "you must install the v1.10 cfg file. It is a good idea "
                          "to install it, as many still are using v1.10 of UserInfo."
                     )
               )
    )
)

; only copy if language is selected
(if (= 0 language)
    (message "Now you can't decode v1.10 datastrings...")
;else
    (
        (set copyname (select language "not-in-use"
                                       "UI_cfg/UI110_DK.cfg"
                                       "UI_cfg/UI110_D.cfg"
                                       "UI_cfg/UI110_UK.cfg"
                      )
        )
        (copyfiles
            (source copyname)
            (newname "UI110.cfg")
            (dest UI-dest)
        )
    )
)




; Install v1.20 cfg file
(set language
    (askchoice (prompt "Choose a language of the v1.20 cfg file to be installed")
               (choices "I don't want the v1.20 cfg file" "Dansk" "English" "Francais" "Nederlands")
               (default 2)
               (help (cat "    If you want to be able to decode UserInfo v1.20 strings, "
                          "you must install the v1.20 cfg file."
                     )
               )
    )
)

; only copy if language is selected
(if (= 0 language)
    (message "Now you can't decode v1.20 datastrings...")
;else
    (
        (set copyname (select language "not-in-use"
                                       "UI_cfg/UI120_DK.cfg"
                                       "UI_cfg/UI120_UK.cfg"
                                       "UI_cfg/UI120_F.cfg"
                                       "UI_cfg/UI120_NL.cfg"
                      )
        )
        (copyfiles
            (source copyname)
            (newname "UI120.cfg")
            (dest UI-dest)
        )
    )
)




; Install ARexx script
(set script
    (askchoice (prompt "Which mailreader should UserInfo be used with?")
               (choices "AmigaDOS script" "April" "MailManager" "MicroDot" "Pread" "Spot" "Thor" "Zodiac's Point")
               (help (cat "    UserInfo is easiest to use with an ARexx script. If "
                          "your mailreader doesn't support ARexx, or an Arexxscript "
                          "for your mailreader currently isn't supported, then you "
                          "should choose the AmigaDOS script... (and contact me, so "
                          "I can implement support for your mailreader in future "
                          "versions of UserInfo. "
                     )
               )
    )
)



; only if script is not Thor (as it uses internal view'er
(if (= 6 script)
    (set txtviewer "no-use") ;just put anything here
;else
    (
      ; Which txtviewer to use?
      (set textviewer
          (askfile (prompt "Which textviewer should be used with UserInfo?")
              (help (cat "    To make UserInfo as portable as possible, UserInfo "
                         "doesn't show its output itself. It therefore needs a "
                         "textviewer to do the job. Any textviewer can be used, "
                         "but a textviewer which supports ANSI makes the nicest output... "
                    )
              )
              (default "SYS:")
          )
      )
    )
)


; Which output mode
(set output
    (askchoice (prompt "Which output mode should UserInfo make?")
               (choices "ANSI" "NOANSI" "MAIL")
               (help (cat "    UserInfo is capable of making 3 different outputmodes.\n\n"
                          "ANSI    - Two colour output.\n"
                          "NOANSI  - One colour output.\n"
                          "MAIL    - One colour outout, but with a \"> \" in front\n"
                          "          of the questions.\n\n"
                          "     If you don't know wether your textviewer supports ANSI "
                          "or not, then select ANSI. If the output looks fucked up, just "
                          "edit the installed ARexx script, so UserInfo uses MAIL or "
                          "NOANSI outputmode instead..."
                     )
               )
    )
)


; Shall textviewer use public screen
; Which output mode
(set pubscreen
    (askbool (prompt "Open textviewer on a public screen?")
               (help (cat "    If your textviewer can open on public screens, then it's "
                          "a good idea to select Yes, as the UserInfo-output will be displayed "
                          "on the mailreader's screen...(*)\n\n"
                          "    If you don't know wether your textviewer can open on public screens just select No.\n\n"
                          "(*) This, unfortunately, doesn't aply all mailreaders due to lack of information from users.. "
                     )
               )
    )
)

; make Arexx script with my tool
(set execstring (cat ("ScriptCreator \"%s\" \"%s\" %ld %ld %ld" UI-dest textviewer pubscreen script output)))
(run execstring)




; Print final status report
(message (cat
            "All UserInfo files are installed in                   \n"
            ("\"%s\"\n" UI-dest)
            "\n\n"
            "    Please read the manual carefully. Then make your \n"
            "UserInfo datastring with UserInfoMaker.              \n"
            "\n"
            " I really have put a lot of work in UserInfo, so I   \n"
            "hope you enjoy using it, and you will consider       \n"
            "registering and even mail me a postcard...           \n"
            "\n\n"
            "Kasper B. Graversen"
         )
)


(exit (quiet))

