; This is the UserInfo v1.25 installer script
;
; by Kasper B. Graversen 2.1.97
;

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


(message (cat
    "                                               \n"
    "UserInfo 1.25                                  \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"
    "This is an upgrade-version! ONLY v1.25         \n"
    "configuration-files has been included!         \n"
    "Find the older configfiles in the v1.20 archive\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... "
                        )
                  )
                )
)


(copyfiles (source "History.txt") (dest UI-dest) (infos))
(copyfiles (source "HowToRegister.txt") (dest UI-dest) (infos))
(copyfiles (source "UI125") (dest UI-dest))


; Install v1.25 cfg file
(set language
    (askchoice (prompt "Choose a language of the v1.25 cfg file to be installed")
               (choices "Dansk" "English" "Francais" "Deutch" "Italiano" "Nederlandish")
               (default 1)
               (help (cat "    If you want to be able to decode UserInfo v1.25 strings, "
                          "you must install the v1.25 cfg file."
                     )
               )
    )
)
(if (< 99 language)
    (message "Error...")
;else
    (
        (set copyname (select language "UI125_DK.cfg"
                                       "UI125.cfg"
                                       "UI125_F.cfg"
                                       "UI125_D.cfg"
                                       "UI125_I.cfg"
                                       "UI125_NL.cfg"
                      )
        )
        (copyfiles
            (source copyname)
            (newname "UI125.cfg")
            (dest UI-dest)
        )
    )
)










; Install DOC file
(set language
    (askchoice (prompt "Choose a language of the documentation to be installed")
               (choices "No doc. file!" "English" "Francais" "Deutch" "Italiano" "Nederlandish")
               (default 1)
               (help (cat "Documentation for UserInfo. Don't complain till AFTER you've read the doc! "
                     )
               )
    )
)


; only copy if language is selected
(if (= 0 language)
    (message "It is always a good idea to have the doc file!")
;else
    (
        (set copyname (select language "not-in-use"
                                       "UI125_UK.doc"
                                       "UI125_F.doc"
                                       "UI125_D.doc"
                                       "UI125_I.doc"
                                       "UI125_NL.doc"
                      )
        )
        (copyfiles
            (source copyname)
            (newname "UI125.doc")
            (dest UI-dest)
            (infos)
        )
    )
)




; Install UserInfoMaker

    (if (askbool (prompt (cat "Install UserInfoMaker v1.11?\n"))
            (help (cat
                "UserInfoMaker is a GUI program which can configure/edit the"
                "UserInfo string via two listviews..\nIt's really worth using!"
                "\nIt needs KS2.04 or better to operate..."
                  )
            )
        )
        ; then

       (
        (copyfiles (source "UserInfoMaker111.doc")
	        (dest UI-dest)
    	   (infos)
        )
        (copyfiles (source "UserInfoMaker111")
	        (dest UI-dest)
    	   (infos)
        )
      )
    )



; Install ARexx script
(set script
    (askchoice (prompt "Which mailreader should UserInfo be used with?")
               (choices "AmigaDOS script" "April" "IntuiPoint" "IntuiNews" "MailManager" "MicroDot" "Pread" "Spot" "Thor" "YAM" "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 IntuiNews/Thor (as they use internal view'ers)
(if (OR (= 3 script) (= 8 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:")
          )
      )


        ; Shall textviewer use public screen
        (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.. "
                     )
               )
            )
        )
    )
)



; Which output mode
(set output
    (askchoice (prompt "Which output mode should UserInfo make?")
               (choices "ANSI" "NOANSI" "MAIL" "USENET")
               (help (cat "    UserInfo is capable of making 4 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"
                          "USENET  - As MAIL, just with \":\" instead...\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, "
                          "NOANSI, or USENET outputmode instead..."
                     )
               )
    )
)


; 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 mailing me a postcard...        \n"
            "\n\n"
            "Kasper B. Graversen"
         )
)


(exit (quiet))

