;;
;; Installation script for Stringer v2.1
;;
;; Usage: Execute Install
;;

; This script needs V39+ to function

VERSION >NIL: graphics.library 39
IF WARN
  VERSION >NIL: graphics.library 40
  IF WARN
    ECHO "Sorry, this script needs AmigaOS 3.0 (V39)."
    ECHO "See document section 1.3 for manual installation."
    QUIT
  ENDIF
ENDIF

; Print out the intro text in XEN font point size 11

IF EXISTS FONTS:XEN/11 
  SETFONT XEN 11
ENDIF

ECHO "*N*E[43m                                                               "
ECHO "   This script will install *E[32mStringer V2.1*E[31m into your system.    "
ECHO "                                                               "
ECHO "*E[0m*N1. The executable Stringer is copied to your C: assign"
ECHO "2. The preference file you choose is copied to ENV: and ENVARC:"
ECHO "3. Options 3 and 4 below copy an AREXX script to REXX:*N"

; Ask if the user wants to install or not

REQUESTCHOICE TITLE "Stringer Installation" BODY "Do you want to install Stringer now ?" GADGETS Install Quit >env:strch1

IF $strch1 NOT EQ 1
  UNSETENV strch1
  QUIT
ENDIF

; Print out the install choices

ECHO "*N*E[32mSelect one of the following default preferences:*E[0m*N"
ECHO "1. Plain ASCII, uses More for a pager"
ECHO "2. ANSI colors, uses More for a pager"
ECHO "3. ANSI colors, uses Most for a pager"
ECHO "4. ANSI colors, uses Vinci for a pager*N"

; Request a choice from the user

REQUESTCHOICE TITLE "Stringer Installation" BODY "Choose your preferred selection" GADGETS " Plain More " " ANSI More " " ANSI Most " " ANSI Vinci " >env:strch1

; Print out the option user chose (4 = 0)

IF $strch1 EQ 0
  ECHO "Installing option 4.  Please wait ...*N"
ELSE
  ECHO "Installing option $strch1.  Please wait ...*N"
ENDIF

; Set env variables according to users choice

SETENV strch2 "Stringer.prefs"
UNSETENV strch3

IF $strch1 EQ 1
  SETENV strch2 "Prefs/Stringer_plain.prefs"
ENDIF

IF $strch1 EQ 2
  SETENV strch2 "Prefs/Stringer_ANSI.prefs"
ENDIF

IF $strch1 EQ 3
  SETENV strch2 "Prefs/Stringer_Most.prefs"
  SETENV strch3 "start_most.rexx"
ENDIF

IF $strch1 EQ 0
  SETENV strch2 "Prefs/Stringer_Vinci.prefs"
  SETENV strch3 "start_vinci.rexx"
ENDIF

; Copy the program files to their places

COPY Stringer C:
COPY $strch2 ENV:Stringer.prefs
COPY $strch2 ENVARC:Stringer.prefs

IF EXISTS env:strch3
  COPY $strch3 REXX:
ENDIF

; Clean up after installation

UNSETENV strch1
UNSETENV strch2
UNSETENV strch3

ECHO "*E[32mStringer*E[0m is now installed to your C: directory.*N"
WAIT 2
QUIT
