/* CMD: ½Installer                                                      */
/* By Brett Evan Hester      13032 Copenhill Rd. Dallas, Tx. 75240-5302 */
	MacrosName = "Installer"
/* Macro Type:                                                          */
/* SPECIAL                                                              */
/* Description:                                                         */

Info1A = "!Installer ©                   Information 1 of 2"
Info1B = ""
Info1C = "@This macro will install or remove the macros of "
Info1D = '@"Plug-Ins and Go!" in addition to any settings, '
Info1E = "@or configurations it might need for it's use.   "
Info1F = ""
Info1G = "ş EASY INSTALL will install all of the macros   "
Info1H = "  with no assistance needed by the user.        "
Info1I = "ş BASIC INSTALL allows for partial installation "
Info1J = "  and notifying the user of what is being done. "
Info1K = "ş DE-INSTALL will remove everything, except     "
Info1L = "  any modifications done to LightWave's Config.,"
Info1M = "  which only affects lightwave.                 "
Info1N = ""

Info2A = "!Installer ©                   Information 2 of 2"
Info2B = "@               Plug-Ins and Go! ©               "
Info2C = "                           Hester and associates"
Info2D = "                           13032 Copenhill Road "
Info2E = "                           Dallas, Texas 75240  "
Info2F = "@Special Thanks to:                              "
Info2G = "Arnie Cachelin  Henry Ribron    Mark J. Holland "
Info2H = "J. Phil Kelso   Terry Wester    Steven K. Simms "
Info2I = "Kevin DeRita    Greg Glaser     William S. Hawes"
Info2J = "NewTek ©        Commodore ©     INOVAtronics ©  "
Info2K = ""
Info2L = "@This macro represents a lot of time & hard work."
Info2M = "@Encourage people to create new ones and not kill"
Info2N = "@that possibility by stealing those that are out."

/* -------------------------------------------------------------------- */
                                     /* Start Error Detection (See End) */
SIGNAL ON ERROR
SIGNAL ON SYNTAX
                                                   /* Address LightWave */
VT3DLib = ADDLIB("LWModelerARexx.port",0)
ADDRESS "LWModelerARexx.port"
                                               /* Add Support Functions */
SupportLib = "rexxsupport.library"
IF POS(SupportLib , SHOW('L')) = 0 THEN
	IF ~ADDLIB(SupportLib , 0 , -30 , 0) THEN DO
		CALL Notify(1,"!Can't find "SupportLib)
		CALL Exiting
	END

/* ******************************************************************** */
                                                   /* Main Body Of Code */
Mac.1 = "AutoMove"         ; Mac.28 = "LoadScene"
Mac.2 = "AutoSize"         ; Mac.29 = "MacroMaker"
Mac.3 = "BarChart"         ; Mac.30 = "ModifyAlign"
Mac.4 = "CalcDistance"     ; Mac.31 = "ModifyObject"
Mac.5 = "CalcPosition"     ; Mac.32 = "ModifyOrient"
Mac.6 = "CalcRenderTime"   ; Mac.33 = "ModifyRefMove"
Mac.7 = "CalcRoll"         ; Mac.34 = "ModifyToCubic"
Mac.8 = "CalcSpeed"        ; Mac.35 = "ModifyToSphere"
Mac.9 = "CalcTime"         ; Mac.36 = "MotionEditor"
Mac.10 = "Calculator"      ; Mac.37 = "MotionToCurve"
Mac.11 = "CalcUnits"       ; Mac.38 = "MultiLight"
Mac.12 = "ConfigPlugIns"   ; Mac.39 = "QuickBox"
Mac.13 = "ConfigVT3D"      ; Mac.40 = "QuickCone"
Mac.14 = "CreateArcText"   ; Mac.41 = "QuickConvert"
Mac.15 = "CreateCone"      ; Mac.42 = "QuickDisc"
Mac.16 = "CreateLightning" ; Mac.43 = "QuickFix"
Mac.17 = "CreateSphere"    ; Mac.44 = "QuickMacro"
Mac.18 = "CreateStar"      ; Mac.45 = "QuickMove"
Mac.19 = "CreateXPoints"   ; Mac.46 = "QuickRotation"
Mac.20 = "CurveToMotion"   ; Mac.47 = "QuickSelect"
Mac.21 = "InfoOnDevices"   ; Mac.48 = "QuickSize"
Mac.22 = "InfoOnError"     ; Mac.49 = "ReadText"
Mac.23 = "InfoOnFile"      ; Mac.50 = "RenderBackdrops"
Mac.24 = "InfoOnTime"      ; Mac.51 = "RenderMacro"
Mac.25 = "Information"     ; Mac.52 = "SolarPosition"
Mac.26 = "LoadFonts"       ; Mac.53 = "TargetingMacro"
Mac.27 = "LoadMacros"

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
                                            /* Main Menu User Interface */
OKtoContinue = 0
DO UNTIL OKtoContinue = 1

	Easy = "EASY INSTALL  Installs with no interaction."
	Basic = "BASIC INSTALL Interactive installation.    "
	Remove = "DE-INSTALL    Removes Plug-Ins and Go!     "

	CALL Req_Begin("Installer ©                  by Brett Hester")

	CALL Req_AddControl("",'T',"                WELCOME!                       ")
	CALL Req_AddControl("",'T'," Thank you for purchasing Plug-Ins and Go!")
	CALL Req_AddControl("",'T',"")
	ReqA = Req_AddControl("",'CV',Easy Basic Remove)
	ReqB = Req_AddControl("",'CH', "Information")

	CALL Req_SetVal(ReqA, 2)
	CALL Req_SetVal(ReqB, 0)

	OKorCancel = Req_Post() ; IF OKorCancel = 0 THEN CALL Exiting

	Option = Req_GetVal(ReqA)
	BEHInfo = Req_GetVal(ReqB)

	CALL Req_End()

	IF BEHInfo = 0 THEN OKtoContinue = 1
	IF BEHInfo = 1 THEN DO
		IF Notify(2, Info1A, Info1B, Info1C, Info1D, Info1E, Info1F, Info1G, Info1H, Info1I, Info1J, Info1K, Info1L, Info1M, Info1N) = 0 THEN BREAK
		CALL Notify(1, Info2A, Info2B, Info2C, Info2D, Info2E, Info2F, Info2G, Info2H, Info2I, Info2J, Info2K, Info2L, Info2M, Info2N)
	END
END

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
                                         /* Scanning for existing files */
DO i=1 TO 53
	Present.i = ABS((EXISTS("/ARexx_Examples/PlugIns/"||Mac.i||".lwm"))-1)
END

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
                                                        /* Easy Install */
IF Option = 1 THEN DO
	DO i=1 TO 53
		Install.i = 1
	END
	CALL Installation
	CALL Exiting
END

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
                                                       /* Basic Install */
IF Option = 2 THEN DO
	CALL SubMenu(1 11 1)
	CALL SubMenu(12 22 2)
	CALL SubMenu(23 33 3)
	CALL SubMenu(34 44 4)
	CALL SubMenu(45 53 5)
	CALL Installation
	CALL Exiting
END

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
                                                          /* De-Install */
IF Option = 3 THEN DO
	CALL DeInstallation
	CALL Exiting
END

/* ******************************************************************** */
                                        /* Basic Install User Interface */
SubMenu:

	PARSE ARG Start Stop Menu

	OKtoContinue = 0
	DO UNTIL OKtoContinue = 1

		CALL Req_Begin("Installer ©   MENU "||Menu||" of 5")

		CALL Req_AddControl("INSTALL:      ",'T',"")
		DO i=Start TO Stop
			Req.i = Req_AddControl(Mac.i,'B')
		END
		ReqInfo = Req_AddControl("",'CH',"Information")

		DO i=Start TO Stop
			CALL Req_SetVal(Req.i, Present.i)
		END
		CALL Req_SetVal ReqInfo, 0

		IF Req_Post() = 0 THEN CALL Exiting

		DO i=Start TO Stop
			Install.i = Req_GetVal(Req.i)
		END
		Info = Req_GetVal(ReqInfo)

		CALL Req_End()

		IF Info = 0 THEN OKtoContinue = 1
		IF Info = 1 THEN DO
			IF Menu = 1 THEN CALL MoreInfo.1
			IF Menu = 2 THEN CALL MoreInfo.2
			IF Menu = 3 THEN CALL MoreInfo.3
			IF Menu = 4 THEN CALL MoreInfo.4
			IF Menu = 5 THEN CALL MoreInfo.5
		END

	END

RETURN

/* -------------------------------------------------------------------- */

MoreInfo.1:

	I01 = "!Auto Move ©                                     "
	I02 = "@This macro moves the currently selected to the  "
	I03 = "@center of the background layer. Using the center"
	I04 = "@of the current layer as a base point.           "
	I05 = ""
	I06 = "!Auto Size ©                                     "
	I07 = "@This macro resizes the current layer's contents,"
	I08 = "@to the size of the background layer.            "
	I09 = ""
	I10 = "!Bar Chart Macro ©                                "
	I11 = "@This macro creates a bar chart object.  Infinite "
	I12 = "@bars can make up the chart. Each bar has its own "
	I13 = "@menu of options in addition to the main menu opts"
	IF Notify(2,I01,I02,I03,I04,I05,I06,I07,I08,I09,I10,I11,I12,I13) = 0 THEN RETURN

	I01 = "!Calculate Distance ©                            "
	I02 = "@This macro will provide the distance between two"
	I03 = "@points. Width, Depth, Height, and True Distance "
	I04 = "@from Point A to Point B.                        "
	I05 = ""
	I06 = "!Calculate Position ©                            "
	I07 = "@This macro will provide a position given an old "
	I08 = "@position OR a direction and distance to head.   "
	I09 = ""
	I10 = "!Calculate Render Time ©                         "
	I11 = "@This macro calculates/converts three main items,"
	I12 = "@ş Anim. Length   ş Render Time   ş Storage Space"
	IF Notify(2,I01,I02,I03,I04,I05,I06,I07,I08,I09,I10,I11,I12) = 0 THEN RETURN

	I01 = "!Calculate Roll ©                                "
	I02 = "@This macro calculates Dist. Rad. and Rotations. "
	I03 = "@Given two of three, the third can and will be   "
	I04 = "@calculated and the menu will return. This macro "
	I05 = "@was meant for calc. the amount of tire spin.    "
	I06 = ""
	I07 = "!Calculate Speed ©                               "
	I08 = "@This macro calculates Distance Speed and Time.  "
	I09 = "@Given two of three, the third can and will be   "
	I10 = "@calculated. Miles and Kilometers are supported. "
	IF Notify(2,I01,I02,I03,I04,I05,I06,I07,I08,I09,I10) = 0 THEN RETURN

	I01 = "!Calculate Time ©                                "
	I02 = "@This macro converts from HrsMinsSecsFrms to     "
	I03 = "@Total Frames, and vica versa. This macro loops  "
	I04 = "@or returns to the main menu after calculations  "
	I05 = "@are completed; select CANCEL to exit.           "
	I06 = "!Calculator ©                                    "
	I07 = "@This macro allows for performing calculations,  "
	I08 = "@even those that involve variables, constants,   "
	I09 = "@and commands.                                   "
	I10 = "!Calculate Units ©                               "
	I11 = "@This macro was created to support any unit type;"
	I12 = "@and, to convert from any unit, to every other   "
	I13 = "@unit, of that type.                             "
	IF Notify(2,I01,I02,I03,I04,I05,I06,I07,I08,I09,I10,I11,I12,I13) = 0 THEN RETURN

RETURN
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
MoreInfo.2:

	I01 = "!Config Plug Ins ©                               "
	I02 = "@This macro changes general settings across all  "
	I03 = '@of the "Plug-Ins and Go!" macros.               '
	I04 = '@ş The "ConfigVT3D" macro may also be of intrest.'
	I05 = ""
	I06 = "!ConfigVT3D ©                                    "
	I07 = "@This macro sets LightWave's default settings.   "
	I08 = "@There are four pages of settings. This page     "
	I09 = "@allows for user definable requester buttons.    "
	I10 = ""
	I11 = "!Create Arc Text ©                               "
	I12 = "@This macro creates an object, out of text, in   "
	I13 = "@shape of an arc, curve, or circle.              "
	IF Notify(2,I01,I02,I03,I04,I05,I06,I07,I08,I09,I10,I11,I12,I13) = 0 THEN RETURN

	I01 = "!Create Cone Angle ©                             "
	I02 = "@This macro creates cones, given a source point, "
	I03 = "@angle, and depth. This is the format used in the"
	I04 = "@layout area when adding and modifing lights.    "
	I05 = ""
	I06 = "!Create Lightning ©                              "
	I07 = "@This macro creates and saves multiple objects.  "
	I08 = "@The objects are meant for adding spark & flare  "
	I09 = "@to rendered scenes.                             "
	I10 = ""
	I11 = "!Create Sphere ©                                 "
	I12 = "@This macro will create a sphere; using defaults "
	I13 = "@based on the currently selected and last used   "
	I14 = "@settings.                                       "
	IF Notify(2,I01,I02,I03,I04,I05,I06,I07,I08,I09,I10,I11,I12,I13,I14) = 0 THEN RETURN

	I01 = "!Create Star ©                                   "
	I02 = "@This macro allows for creation of sybolic stars."
	I03 = "@The standard five-pointed can easily be created."
	I04 = "@A automatic sizing feature adds to the ease.    "
	I05 = ""
	I06 = "!Create X Points ©                               "
	I07 = "@This macro creates multiple points between two  "
	I08 = "@selected points. The new points will be divided "
	I09 = "@evenly from point a to point b.                 "
	I10 = ""
	I11 = "!Curve To Motion ©                               "
	I12 = "@This macro asks the user to create a curve, via "
	I13 = "@the 'Sketch' button. It will then convert, and  "
	I14 = "@save, the given curve into a motion file.       "
	IF Notify(2,I01,I02,I03,I04,I05,I06,I07,I08,I09,I10,I11,I12,I13,I14) = 0 THEN RETURN

	I01 = "!Info On Devices ©                               "
	I02 = "@This macro provides information on all the      "
	I03 = "@devices / drives on this system. This is only   "
	I04 = "@information and it is not possible to alter.    "
	I05 = ""
	I06 = "!Info On Error ©                                 "
	I07 = "@This macro works one of two ways:               "
	I08 = "@ş If an error has occured in any of the PLUG-INS"
	I09 = "@  this macro might help better explain the      "
	I10 = "@  problem.                                      "
	I11 = "@ş If no error has occured or is not a PLUG-IN,  "
	I12 = "@  this macro will describe each error given an  "
	I13 = "@  ARexx error number ranging from 1-48.         "
	IF Notify(2,I01,I02,I03,I04,I05,I06,I07,I08,I09,I10,I11,I12,I13) = 0 THEN RETURN

RETURN
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
MoreInfo.3:

	I01 = "!Info On File ©                                  "
	I02 = "@This macro displays information about a file and"
	I03 = "@can: MOVE, COPY, DELETE, UN-ARCHIVE, RENAME,    "
	I04 = "@COMMENT, PROTECT, and DATE any one file.        "
	I05 = ""
	I06 = "!Info On Time ©                                  "
	I07 = "@This macro displays / sets the current time.    "
	I08 = "@OK will reset the time to that of the selected. "
	I09 = "@CANCEL will do nothing but display the date/time"
	I10 = ""
	I11 = "!Information ©                                   "
	I12 = "@This macro will provide information about the   "
	I13 = "@currently selected points, in the form of,      "
	I14 = "@measurements and distances.                     "
	IF Notify(2,I01,I02,I03,I04,I05,I06,I07,I08,I09,I10,I11,I12,I13,I14) = 0 THEN RETURN

	I01 = "!Load Fonts ©                                    "
	I02 = "@This macro allows for easier adding of fonts.   "
	I03 = "@After options are chosen a file requester will  "
	I04 = "@appear; for ONLY a path OR a path and one file. "
	I05 = ""
	I06 = "!Load Macros ©                                   "
	I07 = "@This macro allows for easier adding of macros.  "
	I08 = "@After options are chosen a file requester will  "
	I09 = "@appear; for ONLY a path OR a path and one file. "
	I10 = ""
	I11 = "!Load Scene ©                                    "
	I12 = "@This macro converts an entire scene into one    "
	I13 = "@object. The new object is based off frame zero. "
	IF Notify(2,I01,I02,I03,I04,I05,I06,I07,I08,I09,I10,I11,I12,I13) = 0 THEN RETURN

	I01 = "!Macro Maker ©                                   "
	I02 = "@This macro allows for easier creation of NEW    "
	I03 = "@macros. The macros are created in the form of   "
	I04 = "@modular blocks of text or code.                 "
	I05 = ""
	I06 = "!Modify Alignment ©                              "
	I07 = "@This macro moves the current layer, in reference"
	I08 = "@to a background layer.  If a background is not  "
	I09 = "@available, coords. 0, 0, 0 are used as a base.  "
	I10 = ""
	I11 = "!Modify Object ©                                 "
	I12 = "@This macro will modify the currently selected,  "
	I13 = "@given formulas for the position of each point.  "
	IF Notify(2,I01,I02,I03,I04,I05,I06,I07,I08,I09,I10,I11,I12,I13) = 0 THEN RETURN

	I01 = "!Modify Orientation ©                            "
	I02 = "@This macro rotates selected layers in accordance"
	I03 = '@with the "Fill in the Blank" questions.  All    '
	I04 = "@rotation is based around the objs. center point."
	I05 = ""
	I06 = "!Modify Reference Move ©                         "
	I07 = "@This macro moves the ENTIRE layer. Based upon a "
	I08 = "@single point. The point can be positioned in    "
	I09 = "@relationship to the Current or Bkg. Layer.      "
	IF Notify(2,I01,I02,I03,I04,I05,I06,I07,I08,I09) = 0 THEN RETURN

RETURN
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
MoreInfo.4:

	I01 = "!Modify To Cubic ©                               "
	I02 = "@This macro reshapes the current object into that"
	I03 = "@of a cube or cubic based object.                "
	I04 = ""
	I05 = "!Modify To Sphere ©                              "
	I06 = "@This macro reshapes the current object into that"
	I07 = "@of a sphere, spheriod, or circular based object."
	I08 = ""
	I09 = "!Motion Editor ©                                 "
	I10 = "@This macro creates a new motion file based off a"
	I11 = "@given motion file, modifing position & rotation."
	I12 = "@This version uses equations for calculating the "
	I13 = "@new motion path. Each key will be calculated    "
	I14 = "@independantly. Advancing from one key to another"
	IF Notify(2,I01,I02,I03,I04,I05,I06,I07,I08,I09,I10,I11,I12,I13,I14) = 0 THEN RETURN

	I01 = "!Motion To Curve ©                               "
	I02 = "@This macro loads a motion file and makes a curve"
	I03 = "@in modeler.                                     "
	I04 = ""
	I05 = "!Multi Light ©                                   "
	I06 = "@This macro is built around layout's light menu. "
	I07 = "@This macro will convert all the selected points "
	I08 = "@into lights then create and save a scene file.  "
	I09 = ""
	I10 = "!Quick Box ©                                     "
	I11 = "@This macro will create a box; using defaults    "
	I12 = "@based on the currently selected and last used   "
	I13 = "@settings.                                       "
	IF Notify(2,I01,I02,I03,I04,I05,I06,I07,I08,I09,I10,I11,I12,I13) = 0 THEN RETURN

	I01 = "!Quick Cone ©                                    "
	I02 = "@This macro will create a cone; using defaults   "
	I03 = "@based on the currently selected and last used   "
	I04 = "@settings.                                       "
	I05 = ""
	I06 = "!Quick Convert ©                                 "
	I07 = "@This macro will resize the entire layer,        "
	I08 = "@from one unit of measurement to another.        "
	I09 = ""
	I10 = "!Quick Disc ©                                    "
	I11 = "@This macro will create a disc; using defaults   "
	I12 = "@based on the currently selected and last used   "
	I13 = "@settings.                                       "
	IF Notify(2,I01,I02,I03,I04,I05,I06,I07,I08,I09,I10,I11,I12,I13) = 0 THEN RETURN

	I01 = "!Quick Fix ©                                     "
	I02 = "@This macro may be useful in solving basic object"
	I03 = "@contruction. However, it may be unnessary or    "
	I04 = "@harmful to certain objs. in the way they render."
	I05 = ""
	I06 = "!Quick Macro Maker ©                             "
	I07 = "@This macro records all mouse movements and keys "
	I08 = "@pressed, for playback later via a new macro.    "
	I09 = "!½½½ Records until: CTRL-LAMIGA-E is pressed. ¼¼¼"
	IF Notify(2,I01,I02,I03,I04,I05,I06,I07,I08,I09) = 0 THEN RETURN

RETURN
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
MoreInfo.5:

	I01 = "!Quick Move ©                                    "
	I02 = "@This macro moves all the contents of this layer "
	I03 = "@to a specified center point. The position is    "
	I04 = "@remembered by this macro, for future use.       "
	I05 = ""
	I06 = "!Quick Rotation ©                                "
	I07 = "@This macro rotates the currently selected on all"
	I08 = "@three axises.                                   "
	I09 = ""
	I10 = "!Quick Select ©                                  "
	I11 = "@This macro selects or deselects points or       "
	I12 = "@polygons on the current layer.  The background  "
	I13 = "@layer is used as a reference layer.             "
	IF Notify(2,I01,I02,I03,I04,I05,I06,I07,I08,I09,I10,I11,I12,I13) = 0 THEN RETURN

	I01 = "!Quick Size ©                                    "
	I02 = "@This macro resizes the entire layer, not by an  "
	I03 = "@interval or multiple, but to a set size.        "
	I04 = ""
	I05 = "!Read Text ©                                     "
	I06 = "@This macro allows for the reading of text files."
	I07 = "@It was initally and still is meant for viewing  "
	I08 = "@macros or ARexx scripts.                        "
	I09 = ""
	I10 = "!Render Backdrops ©                              "
	I11 = "@This macro allow for rendering a scene with each"
	I12 = "@frame having a different background gradient.   "
	I13 = "@This is perefect for rendering a sunrise or set."
	IF Notify(2,I01,I02,I03,I04,I05,I06,I07,I08,I09,I10,I11,I12,I13) = 0 THEN RETURN

	I01 = "!Render Macro ©                                  "
	I02 = "@This macro allows for rendering multiple scenes."
	I03 = "@Infinite scenes can be rendered and each saved  "
	I04 = "@to a different path, drive, or directory.       "
	I05 = ""
	I06 = "!Solar Position ©                                "
	I07 = "@This macro allows for acurately positioning and "
	I08 = "@aiming a light based off the sun's position.    "
	I09 = ""
	I10 = "!Targeting Macro ©                               "
	I11 = "@This macro was created to duplicate the results "
	I12 = "@of the TARGET command in layout. With one main  "
	I13 = "@addition, targeting can be set for a set range  "
	I14 = "@of frames, instead of always on or targeting.   "
	IF Notify(2,I01,I02,I03,I04,I05,I06,I07,I08,I09,I10,I11,I12,I13,I14) = 0 THEN RETURN

RETURN

/* -------------------------------------------------------------------- */

Installation:

	CALL ReadModConfig

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
                                      /* Procedure when a list is found */
	IF Listing ~= "" THEN DO

		CALL ProgressMeter("Backing up the Original Macro List")

		InstallType = "APPEND"

		IF EXISTS(Listing) = 1 THEN DO
			ADDRESS COMMAND 'COPY "'||Listing||'" TO "'||Listing||.Orig||'" QUIET CLONE NOREQ'
		END

		CALL ReadModList

	END

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
                                     /* Procedure when no list is found */
	IF Listing = "" THEN DO

		CALL ProgressMeter("Creating a Macro List")

		InstallType = "NEWLIST"

		Line.ListingLine = "MacroList PlugIns"
		Listing = "PlugIns"
		List.1 = "MDML 0"
		List.2 = ""
		ListLength = 2

	END

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
                                              /* The Installation Phase */
	OpenList = OPEN(MacroList, Listing, 'W')

	IF OpenList = 0 THEN CALL Sorry("Modeler's List of Macros.")

	IF OpenList = 1 THEN DO
		DO i=1 TO ListLength
			CALL WRITELN(MacroList, List.i)
		END

		CALL MAKEDIR("/ARexx_Examples/PlugIns")

		Prefix = "PlugIns:Toaster/ARexx_Examples/PlugIns/"
		Suffix = ".lwm"
		Destination = "/ARexx_Examples/PlugIns/"

		CALL Meter_Begin(53, "Installing Plug-Ins and Go!","   Please Wait...")

		DO i=1 TO 53
			CALL Meter_Step()
			IF Install.i = 1 THEN DO
				IF Present.i = 0 THEN DO
					ReqA = "!--- OVERWRITE EXISTING FILE? ---"
					ReqB = ""
					ReqC = '":Toaster/ARexx_Examples/PlugIns/...'
					ReqD = @""||Mac.i||Suffix||""
					ReqE = ""
					Install.i = Notify(3,ReqA,ReqB,ReqC,ReqD,ReqE)
				END
				IF Install.i = 1 THEN DO

					ADDRESS COMMAND 'COPY '||Prefix||Mac.i||Suffix||' TO '||Destination||' QUIET CLONE NOREQ'

					CALL RxCmd_Add("½"||Mac.i, Destination||Mac.i||Suffix)

					IF i=12 THEN CALL AddSupportFile("PlugIns:S/PlugInPrefs" "S:PlugInPrefs")
					IF i=16 THEN CALL AddSupportFile("PlugIns:Toaster/3D/Objects/PlugInLightning" "Objects/PlugInLightning")
					IF i=29 THEN CALL AddSupportFile("PlugIns:Toaster/ARexx_Examples/MacroMakerHelp.Doc" "/ARexx_Examples/MacroMakerHelp.Doc")
					IF i=38 THEN CALL AddSupportFile("PlugIns:Toaster/3D/Objects/PlugInLights" "Objects/PlugInLights")
					IF i=44 THEN CALL AddSupportFile("PlugIns:C/Record" "C:Record")
					IF i=44 THEN CALL AddSupportFile("PlugIns:C/Recall" "C:Recall")
					IF i=52 THEN CALL AddSupportFile("PlugIns:Toaster/ARexx_Examples/Locations.Doc" "/ARexx_Examples/Locations.Doc")

					CALL WRITELN MacroList,"# ½"||Mac.i
					CALL WRITELN MacroList,"* /Arexx_Examples/PlugIns/"||Mac.i||".lwm"
					CALL WRITELN MacroList,""

				END
			END
		END

		CALL Meter_End()

		CALL CLOSE(MacroList)
	END

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
                                               /* Installation Complete */
	ReqI = "!-- SPECIAL CASE ERROR --"
	ReqJ = "@Unknown if Macro List was"
	ReqK = "@Created or Appended"

	IF InstallType = "APPEND" THEN DO
		ReqI = "NOTE:                             "
		ReqJ = "Plug-Ins and Go! has been appended"
		ReqK = "to your current list of macros.   "
	END

	IF InstallType = "NEWLIST" THEN DO
		ReqI = "!NOTE:                         "
		ReqJ = "!Important final installation  "
		ReqK = "!instructions to follow....    "
	END

	ReqA = "!--- Installation Complete! ---"
	ReqB = ""
	ReqC = "@Hester & Associates appreciates"
	ReqD = "@your business; and hopes that"
	ReqE = "@Plug-Ins and Go! will help."
	ReqF = ""
	ReqG = "@                   Thank You,  "
	ReqH = "@                   Brett Hester"
	CALL Notify(1,ReqA,ReqB,ReqC,ReqD,ReqE,ReqF,ReqG,ReqH,ReqI,ReqJ,ReqK)

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */

	IF InstallType = "NEWLIST" THEN DO

		ReqA = "!F I N A L   I N S T A L L A T I O N   I N S T R U C T I O N S"
		ReqB = ""
		ReqC = "@Since no list of macros is currently saved and selected,  "
		ReqD = "@The selected macros for installation are in the Macro List"
		ReqE = "@only temporaraly.   To have them listed in the future:    "
		ReqF = ""
		ReqG = '@1 Select "OK" below         - which will exit this macro.'
		ReqH = '@2 Select "«Configure List»" - which will display a menu. '
		ReqI = '@3 Select "Save"             - to save the list of macros.'
		ReqJ = ""
		CALL Notify(1,ReqA,ReqB,ReqC,ReqD,ReqE,ReqF,ReqG,ReqH,ReqI,ReqJ)

	END

RETURN

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
                                         /* Special Support Files Added */
AddSupportFile:

	PARSE ARG FromX ToX

	ADDRESS COMMAND 'COPY '||FromX||' TO '||ToX||' QUIET CLONE NOREQ'

RETURN

/* -------------------------------------------------------------------- */

DeInstallation:
                                                    /* Deleting Macros */
	Prefix = "/ARexx_Examples/PlugIns/" ; Suffix = ".lwm"

	IF EXISTS(Prefix) = 1 THEN DO
		CALL ProgressMeter("Deleting Plug-Ins and Go! Macros")
		DO i = 1 TO 53
			IF EXISTS(Prefix||Mac.i||Suffix) THEN CALL DELETE(Prefix||Mac.i||Suffix)
		END
		IF SHOWDIR(Prefix) = "" THEN DO
			ADDRESS COMMAND 'DELETE "/ARexx_Examples/PlugIns" ALL'
		END
	END

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
                                              /* Deleting Support Files */
	CALL ProgressMeter("Deleting Support Files")

	IF EXISTS("C:Record") = 1 THEN CALL DELETE("C:Record")
	IF EXISTS("C:Recall") = 1 THEN CALL DELETE("C:Recall")

	IF EXISTS("/ARexx_Examples/Locations.Doc") = 1 THEN CALL DELETE("/ARexx_Examples/Locations.Doc")
	IF EXISTS("/ARexx_Examples/MacroMakerHelp.Doc") = 1 THEN CALL DELETE("/ARexx_Examples/MacroMakerHelp.Doc")

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
                                                 /* Deleting Pref Files */
	Suffix = ".Plug"

	IF EXISTS("S:PlugInPrefs") = 0 THEN Prefix = "T:"

	IF EXISTS("S:PlugInPrefs") = 1 THEN DO
		OpenPref = OPEN(PlugInPrefs, "S:PlugInPrefs", 'R')
		IF OpenPref = 0 THEN CALL Sorry("S:PlugInPrefs")
		IF OpenPref = 1 THEN DO
			CALL READLN(PlugInPrefs)
			CALL READLN(PlugInPrefs)
			Prefix = READLN(PlugInPrefs)
			CALL CLOSE(PlugInPrefs)
		END
	END

	IF EXISTS(Prefix) = 1 THEN DO
		CALL ProgressMeter("Deleting Plug-Ins and Go! Settings")
		DO i = 1 TO 53
			IF EXISTS(Prefix||Mac.i||Suffix) THEN CALL DELETE(Prefix||Mac.i||Suffix)
		END
	END

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
                                                /* Stripping Macro List */
	CALL ReadModConfig

	IF Listing ~= "" THEN DO
		CALL ReadModList

		OpenList = OPEN(MacroList, Listing, 'W')
		IF OpenList = 0 THEN CALL Sorry("Modeler's List of Macros.")
		IF OpenList = 1 THEN DO
			CALL ProgressMeter("Editing the List of Macros")
			DO i = 1 TO ListLength
				Before = i-1 ; After = i+1
				TextBlock = List.Before List.i List.After
				IF POS("/PlugIns/",TextBlock) = 0 THEN CALL WRITELN(MacroList, List.i)
			END
			CALL CLOSE(MacroList)
		END
	END

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
                                            /* De-Installation Complete */
	ReqA = "!--- De-Installation Complete! ---"
	ReqB = ""
	ReqC = "@Hester & Associates appreciates"
	ReqD = "@your business; and hopes that"
	ReqE = "@Plug-Ins and Go! has helped."
	ReqF = ""
	ReqG = "                      Thank You,  "
	ReqH = "                      Brett Hester"
	CALL Notify(1,ReqA,ReqB,ReqC,ReqD,ReqE,ReqF,ReqG,ReqH)

RETURN

/* -------------------------------------------------------------------- */
                                       /* Reading Modeler's Config File */
ReadModConfig:

	CALL ProgressMeter("Reading the Current Configuration")

	OpenConfig = OPEN(ModConfig, "MOD-config", 'R')

	IF OpenConfig = 0 THEN DO
		CALL Sorry("Modeler's Configuration File.")
		Listing = ""
	END

	IF OpenConfig = 1 THEN DO
		DO i=1 UNTIL EOF(ModConfig)
			Line.i = READLN(ModConfig)
			PARSE VAR Line.i FirstWord SecondWord
			IF FirstWord = "MacroList" THEN DO
				ListingLine = i
				Listing = STRIP(SecondWord)
			END
			ConfigLength = i
		END
		CALL CLOSE(ModConfig)
	END

RETURN

/* -------------------------------------------------------------------- */
                                        /* Reading Modeler's Macro List */
ReadModList:

	CALL ProgressMeter("Reading the Current Macro List")

	OpenList = OPEN(MacroList, Listing, 'R')

	IF OpenList = 0 THEN DO
		CALL Sorry("Modeler's List of Macros.")
		Listing = ""
	END

	IF OpenList = 1 THEN DO
		DO i=1 UNTIL EOF(MacroList)
			List.i = READLN(MacroList)
			ListLength = i
		END
		CALL CLOSE(MacroList)
	END

RETURN

/* -------------------------------------------------------------------- */
                                                   /* "Sorry" Requester */
Sorry:

	PARSE ARG TheError

	ReqA = "!Sorry,"
	ReqB = ""
	ReqC = "Unable to open"
	ReqD = TheError
	ReqE = ""
	ReqF = "@CONTINUE?"
	IF Notify(3,ReqA,ReqB,ReqC,ReqD,ReqE,ReqF) = 0 THEN CALL Exiting

RETURN

/* -------------------------------------------------------------------- */
                                                      /* Progress Meter */
ProgressMeter:

PARSE ARG Phase

CALL Meter_Begin(200,Phase,"   Please Wait...")
DO i=1 TO 200
	CALL DELAY(1)
	CALL Meter_Step()
END
CALL Meter_End()

RETURN

/* -------------------------------------------------------------------- */
                                                              /* Ending */
Exiting:

	IF (VT3DLib) THEN CALL REMLIB("LWModelerARexx.port")
	EXIT

RETURN

/* -------------------------------------------------------------------- */
                                                      /* Error Handling */
SYNTAX:
ERROR:

	ErrCode = RC
	ErrLine = SIGL
	ErrInfo = ERRORTEXT(ErrCode)

	Err1 = "!Sorry!"
	Err2 = "An Error has been detected"
	Err3 = "@ş Macro -            "
	Err4 = "@ş Line Number -      "
	Err5 = "@ş Error Code -       "
	Err6 = "@ş Error Description -"
	Err7 = "@¤ Please Inform -    "
	Err8 = '  "Error Notice"     '
	Err9 = "  13032 Copenhill Rd."
	Err10 = "  Dallas, TX. 75240  "

	Call Notify(1,Err1,Err2,Err3,MacrosName,Err4,ErrLine,Err5,ErrCode,Err6,ErrInfo,Err7,Err8,Err9,Err10)

/* -------------------------------------------------------------------- */
                                             /* Advanced Error Handling */
	CALL SETCLIP("ErrorMacro",MacrosName)
	CALL SETCLIP("ErrorLine",ErrLine)
	CALL SETCLIP("ErrorCode",ErrCode)
	CALL SETCLIP("ErrorDesc",ErrInfo)

	PARSE SOURCE TempA TempB FileName TempC TempD TempE

	CALL SETCLIP("ErrorFile",FileName)

/* -------------------------------------------------------------------- */

	IF (VT3DLib) THEN CALL REMLIB("LWModelerARexx.port")
	EXIT
