//  This script file is copyright 1999 Henter-Joyce, Inc.
//
//  All Rights Reserved
//
//  Henter-Joyce software is distributed and licensed "as is", all
//  warranties, either express or implied, are disclaimed as to the
//  software and its quality, performance, or fitness for any
//  particular purpose.  You, the consumer, bear the entire risk
//  relating to the quality of the software and if the software
//  proves to have any defects, you assume the cost of any necessary
//  servicing or repairs.

//  Description: Installation script for JAWS for Windows

// Install Scripts for JFW 3.31
// Original Author: J. David Boyd
// Maintained by Mike Pedersen and Ralph (Ernie) Ocampo
// Last Modified: 08/3/99 reo


@DefineProject

    @Name                                        = "JFW"
    @Version                                     = "3.31"
    @OutDrive                                    = C
    @SubDir                                      = "\\JFW331"
    @Immediate                                   = @True
    @InDiskBell                                  = 1
    @Requires @HardDisk
    @AssumeHardDisk                              = 1

@EndProject

@DefineVars

    @Dir @InstallDir                             = "\\"
    @Dir @JFWDir                                 = "\\JFW331"
    @Dir @JFWTempDir                             = "\\JFW331\\INSTTMP"
    @Dir @LangDir                                = ""
    @Dir @LastLangDir                            =  ""
    @Dir @TempDir                                = ""
    @QString @TTempDir                           = ""
    @QString @TTTempDir                           = ""
    @Dir @WinHomeDir                             = "\\WINDOWS\\"

    @Drive @AltInDrive                           = A
    @Drive @InstallDrive                         = C
    @Drive @JFWDrive                             = C
    @Drive @WinHomeDrive                         = C
    @Drive @TempDrive                            = C
    @Drive @zDrive                               = A

    @Integer @AddStartup                         = @False
    @Integer @AuthorizationExists                = @False
    @Integer @Counter                            = 0                 // Counter for @GetFromFile
    @Integer @DataSize
    @Integer @Disposition
    @Integer @ErrorLineNumber                    = 0
    @Integer @ErrorWritingRegistry               = @FALSE
    @Integer @EverlockExists                     = @False
    @Integer @Found                              = @False        // Used by @GetFromFile to verify option picked
    @Integer @FoundJFWPath                       = @False
    @Integer @HighestInstalledSynth              = 1
    @Integer @InstallFromHard                    = @False
    @Integer @IsEqualValue                       = @False        // Used by @IsEqual
    @Integer @IsGreaterValue                     = @False    // Used by @IsGreater
    @Integer @LocalStatus                        = 0
    @Integer @MaxItems                           = 20                // MaxItems supported by @GetFromFile
    @Integer @NewHandle                          = 0
    @Integer @No                                 = @False
    @Integer @NumBraille                         = 0
    @Integer @NumItems                           = 0                 // NumItems from file for @GetFromFile
    @Integer @NumSynths                          = 0
    @Integer @NumberOfFilesRenamed               = 0
    @Integer @Offset                             = 0
    @Integer @RefDebugLevel                      = 0
    @Integer @RunMSAA                            = @False
    @Integer @SQCPS                              = @False
    @Integer @ShowDebug                          = @False
    @Integer @ShowDebugLevel                     = 0
    @Integer @SizeofHJCR                         = 0
    @Integer @SoundOn                            = @False  // used in @PlayWAV function
    @Integer @SoundCardInstalled                 = @False
    @Integer @StartBraille                       = 400
    @Integer @StartSynth                         = 300       //GetSynth uses options 300-350 (based on MaxItems = 50)
    @Integer @Status                             = @False
    @Integer @WEResult                           = @False
    @Integer @WinNT                              = @False
    @Integer @Yes                                = @True
    @Integer @YesNoValue                         = @False        //GetYesNo uses options 125-126
    @Integer @RunJMerge                          = @False
    @Integer @JFWPathFound                       = @False
    @integer @ReplacementIndex                   = 0

    @Integer @BrailleFileCounter                 = 0
    @Integer @SynthFileCounter                   = 0
    @Integer @TempSynthFileCounter               = 0
    @Integer @Verify1LoopCounter                 = 0
    @Integer @Verify2LoopCounter                 = 0

    @Integer @NoDrJaws                           = 0
    @Integer @NoEloquence                        = 0
    @Integer @NoRuntime                          = 0


    @QString @InxPath                            = ""
    @QString @AuthorizationPath                  = "UNKNOWN"
    @QString @BrailleFilename                    = "braille.ini"
    @QString @BraillePrefix                      = "Braille"
    @QString @Build                              = "115"
    @QString @Data
    @QString @DebugString                        = ""
    @QString @DefaultPortString                  = ""
    @QString @DoubleBSlash                       = "\\"
    @QString @EverlockPath                       = "UNKNOWN"
    @QString @HJCRPath                           = "C:\\JFW"
    @QString @InstallType                        = "UNKNOWN"     //GetInstallType uses options 100-104
    @QString @JDrive                             = ""
    @QString @JFWLink
    @QString @JFWPath                            = ""
    @QString @KeyboardType                       = "DESKTOP" //GetKeyboardType uses options 200-201
    @QString @Picked                             = ""  // Used by @GetFromFile to figure out which device was picked
    @QString @PrimaryBraille                     = "UNKNOWN"
    @QString @PrimaryBrailleDriver               = "UNKNOWN"
    @QString @PrimaryBrailleExtra                = "UNKNOWN"
    @QString @PrimaryBraillePort                 = "UNKNOWN"
    @QString @PrimaryBraillePortInfo             = "UNKNOWN"
    @QString @PrimaryBraillePortString           = "UNKNOWN"
    @QString @PrimaryBrailleShort                = "UNKNOWN"
    @QString @PrimaryBrailleType                 = "UNKNOWN"
    @QString @PrimarySynth                       = "UNKNOWN"
    @QString @PrimarySynthDefaultPortString      = "UNKNOWN"
    @QString @PrimarySynthDriver                 = "UNKNOWN"
    @QString @PrimarySynthExtra                  = "UNKNOWN"
    @QString @PrimarySynthPort                   = "UNKNOWN"
    @QString @PrimarySynthPortInfo               = "UNKNOWN"
    @QString @PrimarySynthShort                  = "UNKNOWN"
    @QString @PrimarySynthType                   = "UNKNOWN"
    @QString @SecondaryBraille                   = "UNKNOWN"
    @QString @SecondaryBrailleDriver             = "UNKNOWN"
    @QString @SecondaryBrailleExtra              = "UNKNOWN"
    @QString @SecondaryBraillePort               = "UNKNOWN"
    @QString @SecondaryBraillePortInfo           = "UNKNOWN"
    @QString @SecondaryBraillePortString         = "UNKNOWN"
    @QString @SecondaryBrailleShort              = "UNKNOWN"
    @QString @SecondaryBrailleType               = "UNKNOWN"
    @QString @SecondarySynth                     = "UNKNOWN"
    @QString @SecondarySynthDefaultPortString    = "UNKNOWN"
    @QString @SecondarySynthDriver               = "UNKNOWN"
    @QString @SecondarySynthExtra                = "UNKNOWN"
    @QString @SecondarySynthPort                 = "UNKNOWN"
    @QString @SecondarySynthPortInfo             = "UNKNOWN"
    @QString @SecondarySynthShort                = "UNKNOWN"
    @QString @SecondarySynthType                 = "UNKNOWN"
    @QString @Slash                              = "/"
    @QString @SynthFilename                      = "synth.ini"
    @QString @SynthPrefix                        = "Synth"
    @QString @SysDir                             = ""
    @QString @TempDriveLetter                    = "X"
    @QString @TempPath                           = ""
    @QString @TempString
    @QString @TertiarySynth                      = "UNKNOWN"
    @QString @TertiarySynthDefaultPortString     = "UNKNOWN"
    @QString @TertiarySynthDriver                = "UNKNOWN"
    @QString @TertiarySynthExtra                 = "UNKNOWN"
    @QString @TertiarySynthPort                  = "UNKNOWN"
    @QString @TertiarySynthPortInfo              = "UNKNOWN"
    @QString @TertiarySynthShort                 = "UNKNOWN"
    @QString @TertiarySynthType                  = "UNKNOWN"
    @Qstring @PrimaryBrailleFull                 = "UNKNOWN"
    @Qstring @PrimarySynthFull                   = "UNKNOWN"
    @Qstring @SecondaryBrailleFull               = "UNKNOWN"
    @Qstring @SecondarySynthFull                 = "UNKNOWN"
    @Qstring @TertiarySynthFull                  = "UNKNOWN"
    @Qstring @zTemp                              = ""



@EndVars



@DefineProto


    @Integer @FindJFWPath( @Void )

	@Integer @WriteRegistryKey(@In @Integer @RootKey, @In @Qstring @KeyName, @In @Qstring @ValueName, @In @QString @Value)

    @Void @Debug(@In @QString @DebugString, @In @Integer @RefDebugLevel)

    @Void @UnInst(@In @QString @UninstString)

    @Void @ConfigureEloquence(@Void)

    @Void @ConfigureIESettings(@Void)

    @Void @StartJFW(@Void)

    @Void @StartDrJaws(@Void)

    @Void @StartJMerge(@Void)

    @Integer @IsWaveDeviceInstalledX(@Void)

    @Void @ReadInstallKeys(@Void)

@EndProto





@includeScript("@StartUpDrive:\\@StartupDir\\commproc.inc")





/////////////////
// FindJFWPath //
/////////////////

@DefineFunc @Integer @FindJFWPath( @Void )

	@JFWLink = "@GetSpecialFolderPath(2)\\jfw331\\jaws.lnk"
	@TempPath = @getShellLinkPath(@JFWLink)
	@Debug("TempPath = @TempPath", 10)

	@If ( (@StrCmp( "@JFWLink", "\\jfw331\\jaws.lnk" ) == 0)  || (@StrCmp( "@TempPath", "" ) == 0) )

		@JFWLink = "@GetSpecialFolderPath(23)\\jfw331\\jaws.lnk"
		@TempPath = @getShellLinkPath(@JFWLink)
		@Debug("TempPath = @TempPath", 10)

		@If ( (@StrCmp( "@JFWLink", "\\jfw331\\jaws.lnk" ) == 0)  || (@StrCmp( "@TempPath", "" ) == 0) )

			@JFWLink = "@GetSpecialFolderPath(2)\\jfw33\\jaws.lnk"
			@TempPath = @getShellLinkPath(@JFWLink)
			@Debug("TempPath = @TempPath", 10)

			@If ( (@StrCmp( "@JFWLink", "\\jfw33\\jaws.lnk" ) == 0)  || (@StrCmp( "@TempPath", "" ) == 0) )

				@JFWLink = "@GetSpecialFolderPath(23)\\jfw33\\jaws.lnk"
				@TempPath = @getShellLinkPath(@JFWLink)
				@Debug("TempPath = @TempPath", 10)

				@If ( (@StrCmp( "@JFWLink", "\\jfw33\\jaws.lnk" ) == 0)  || (@StrCmp( "@TempPath", "" ) == 0) )

			        	@JFWLink = "@GetSpecialFolderPath(2)\\jfw32\\jaws.lnk"
        				@TempPath = @getShellLinkPath(@JFWLink)
					@Debug("TempPath = @TempPath", 10)

					@If ( (@StrCmp( "@JFWLink", "\\jfw32\\jaws.lnk" ) == 0)  || (@StrCmp( "@TempPath", "" ) == 0) )

						@JFWLink = "@GetSpecialFolderPath(23)\\jfw32\\jaws.lnk"
						@TempPath = @getShellLinkPath(@JFWLink)
						@Debug("TempPath = @TempPath", 10)

						@If ( (@StrCmp( "@JFWLink", "\\jfw32\\jaws.lnk" ) == 0)  || (@StrCmp( "@TempPath", "" ) == 0) )

					        	@JFWLink = "@GetSpecialFolderPath(2)\\jfw30\\jaws.lnk"
        						@TempPath = @getShellLinkPath(@JFWLink)
							@Debug("TempPath = @TempPath", 10)

							@If ( (@StrCmp( "@JFWLink", "\\jfw30\\jaws.lnk" ) == 0)  || (@StrCmp( "@TempPath", "" ) == 0) )

								@JFWLink = "@GetSpecialFolderPath(23)\\jfw30\\jaws.lnk"
								@TempPath = @getShellLinkPath(@JFWLink)
								@Debug("TempPath = @TempPath", 10)

								@If ( (@StrCmp( "@JFWLink", "\\jfw30\\jaws.lnk" ) == 0)  || (@StrCmp( "@TempPath", "" ) == 0) )
									@Return (@False)
								@Endif
							@Endif
						@Endif
					@Endif
	        		@Endif
			@Endif
	        @Endif
	@Endif

	@Offset = @StrFind("@TempPath", "JFW.EXE")

	@JFWPath = @StrHead("@TempPath", ( @StrLen("@TempPath") - 8)   )
    @Debug("JFWPath = @JFWPath", 2)
    @JDrive = @StrHead("@TempPath" , 1)
    @Debug("JDrive = @JDrive", 2)

    @If(@strcmpnos(@JDrive, "C") == 0 ) @JFWDrive = C  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "D") == 0 ) @JFWDrive = D  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "E") == 0 ) @JFWDrive = E  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "F") == 0 ) @JFWDrive = F  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "G") == 0 ) @JFWDrive = G  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "H") == 0 ) @JFWDrive = H  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "I") == 0 ) @JFWDrive = I  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "J") == 0 ) @JFWDrive = J  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "K") == 0 ) @JFWDrive = K  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "L") == 0 ) @JFWDrive = L  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "M") == 0 ) @JFWDrive = M  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "N") == 0 ) @JFWDrive = N  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "O") == 0 ) @JFWDrive = O  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "P") == 0 ) @JFWDrive = P  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "Q") == 0 ) @JFWDrive = Q  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "R") == 0 ) @JFWDrive = R  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "S") == 0 ) @JFWDrive = S  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "T") == 0 ) @JFWDrive = T  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "U") == 0 ) @JFWDrive = U  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "V") == 0 ) @JFWDrive = V  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "W") == 0 ) @JFWDrive = W  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "X") == 0 ) @JFWDrive = X  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "Y") == 0 ) @JFWDrive = Y  @Debug("JFWDrive = @JFWDrive", 2) @Endif
    @If(@strcmpnos(@JDrive, "Z") == 0 ) @JFWDrive = Z  @Debug("JFWDrive = @JFWDrive", 2) @Endif

    @Return (@True)

@EndFunc






//////////////////////
// WriteRegistryKey //
//////////////////////

@DefineFunc @Integer @WriteRegistryKey(@In @Integer @RootKey, @In @Qstring @KeyName,
              			               @In @Qstring @ValueName, @In @QString @Value)

    @ErrorWritingRegistry = @False

    @LocalStatus = @WinRegCreateKeyEx(@RootKey, @KeyName, "", 0, 0xf003f, @Null, @NewHandle, @Disposition)

    @If (@LocalStatus != 0 )
        @LocalStatus = @WinRegOpenKey(@RootKey, @KeyName, 0xf003f, @NewHandle)
    @Endif

    @If(@LocalStatus == 0)
        // It worked properly
        @Data = @Value
        @DataSize = (@StrLen("@Data") + 1)

        @LocalStatus = @WinRegSetValueEx(@NewHandle, @ValueName, 1, @Data, @DataSize)

        @If(@LocalStatus == 0)
        @Else
            @ErrorWritingRegistry = @True
            @ErrorLineNumber = 57
        @EndIf

    @LocalStatus = @WinRegFlushKey(@NewHandle)

    @If(@LocalStatus == 0)
    @Else
        @ErrorWritingRegistry = @True
        @ErrorLineNumber = 64
    @EndIf

    // Now close key (it is dangerous to leave a key open)
    @LocalStatus = @WinRegCloseKey(@NewHandle)

    @If(@LocalStatus == 0)
    @Else
          @ErrorWritingRegistry = @True
      @EndIf
  @Else
      @ErrorWritingRegistry = @True
  @EndIf

@Return (@ErrorWritingRegistry)

@EndFunc




///////////
// Debug //
///////////
@DefineFunc @Void @Debug(@In @QString @DebugString, @In @Integer @RefDebugLevel)

    @If (@ShowDebug == @True  &&  @RefDebugLevel >= @ShowDebugLevel)
        @Display
        @Cls
        @DebugString
        @Pause
        @EndDisplay
    @Endif

    @Return()
@EndFunc





//
// UnInst
//
@DefineFunc  @Void @UnInst(@In @QString @UninstString)
    @Write("@JFWDrive:\\@JFWDir\\UNINST.DAT", "PT", "@UninstString" )
    @Return()
@EndFunc



//
// ConfigureEloquence
//
@DefineFunc  @Void @ConfigureEloquence(@Void)

//    @RenameOnReboot("@TTempDir\\JFWTemp", "" )

    @If (@Exists("@WinDrive:\\@WinDir\\speech\\hjspeech.dll"))
        @If (@CheckFile("@WinDrive:\\@WinDir\\Speech\\HJSpeech.dll" ,"3.30.19.0") == @False)
            @RenameOnReboot("@TTempDir\\JFWTemp\\HJSPEECH.DLL",   "@WinDrive:\\@WinDir\\Speech\\HJSPEECH.DLL" )
            @RenameOnReboot("@TTempDir\\JFWTemp\\Speech20.DLL",   "@WinDrive:\\@WinDir\\Speech\\Speech20.DLL" )
        @Else
            @Delete("@TTempDir\\JFWTemp\\HJSPEECH.DLL")
            @Delete("@TTempDir\\JFWTemp\\Speech20.DLL")
        @Endif
    @Else
         @Copy("@TTempDir\\JFWTemp\\HJSPEECH.DLL",   "@WinDrive:\\@WinDir\\Speech\\HJSPEECH.DLL" )
         @Copy("@TTempDir\\JFWTemp\\Speech20.DLL",   "@WinDrive:\\@WinDir\\Speech\\Speech20.DLL" )
         @Delete("@TTempDir\\JFWTemp\\HJSPEECH.DLL" )
         @Delete("@TTempDir\\JFWTemp\\Speech20.DLL" )
    @Endif


/*
    @If (@Exists("@WinSystemDrive:\\@WinSystemDir\\mfc42.dll"))
        @If (@CheckFile("@WinSystemDrive:\\@WinSystemDir\\mfc42.dll" ,"6.0.8047.3") == @False)
          @RenameOnReboot("@TTempDir\\JFWTemp\\mfc42.dll", "@WinSystemDrive:\\@WinSystemDir\\mfc42.dll")
          @SetDllUsageState( "@WinDrive:\\@WinSystemDir\\MFC42.DLL", @True )
        @Else
          @Delete("@TTempDir\\JFWTemp\\mfc42.DLL")
        @Endif
    @Else
          @Copy("@TTempDir\\JFWTemp\\mfc42.dll", "@WinSystemDrive:\\@WinSystemDir\\mfc42.dll")
          @Delete("@TTempDir\\JFWTemp\\mfc42.dll")
          @SetDllUsageState( "@WinDrive:\\@WinSystemDir\\MFC42.DLL", @True )
    @Endif

    @If (@Exists("@WinSystemDrive:\\@WinSystemDir\\msvcrt.dll"))
        @If (@CheckFile("@WinSystemDrive:\\@WinSystemDir\\msvcrt.dll" ,"6.0.8047.2") == @False)
          @RenameOnReboot("@TTempDir\\JFWTemp\\msvcrt.dll", "@WinSystemDrive:\\@WinSystemDir\\msvcrt.dll")
          @SetDllUsageState( "@WinDrive:\\@WinSystemDir\\MSVCRT.DLL", @True )
        @Else
            @Delete("@TTempDir\\JFWTemp\\msvcrt.DLL")
        @Endif
    @Else
          @Copy("@TTempDir\\JFWTemp\\msvcrt.dll", "@WinSystemDrive:\\@WinSystemDir\\msvcrt.dll")
          @Delete("@TTempDir\\JFWTemp\\msvcrt.dll)
          @SetDllUsageState( "@WinDrive:\\@WinSystemDir\\MSVCRT.DLL", @True )
    @Endif

    @If (@Exists("@WinSystemDrive:\\@WinSystemDir\\msvcirt.dll"))
        @If (@CheckFile("@WinSystemDrive:\\@WinSystemDir\\msvcirt.dll" ,"6.0.8047.2") == @False)
          @RenameOnReboot("@TTempDir\\JFWTemp\\msvcirt.dll", "@WinSystemDrive:\\@WinSystemDir\\msvcirt.dll")
          @SetDllUsageState( "@WinDrive:\\@WinSystemDir\\MSVCIRT.DLL", @True )
        @Else
            @Delete("@TTempDir\\JFWTemp\\msvcirt.DLL")
        @Endif
    @Else
          @Copy("@TTempDir\\JFWTemp\\msvcirt.dll", "@WinSystemDrive:\\@WinSystemDir\\msvcirt.dll")
          @Delete("@TTempDir\\JFWTemp\\msvcirt.dll")
          @SetDllUsageState( "@WinDrive:\\@WinSystemDir\\MSVCIRT.DLL", @True )
    @Endif
*/


    @If (@Exists("@WinSystemDrive:\\@WinSystemDir\\deltree.exe"))
        @Delete("@TTempDir\\JFWTemp\\deltree.exe")
    @Else
        @Copy("@TTempDir\\JFWTemp\\DELTREE.EXE", "@WinDrive:\\@WinSystemDir\\DELTREE.EXE" )
        @Delete("@TTempDir\\JFWTemp\\DELTREE.EXE")
    @Endif


//    @RenameOnReboot("@TTempDir\\JFWTemp", "" )


    @Status =    @WriteRegistryKey(@HKeyClassesRoot,
        							"CLSID\\{51BBF920-F83E-11D2-BBD2-A593AC933DE1}\\InprocServer32",
        							"",
        							"@WinDrive:\\@WinDir\\Speech\\HJSpeech.dll" )

    @Status =     @WriteRegistryKey(@HKeyClassesRoot,
        							"CLSID\\{51BBF920-F83E-11D2-BBD2-A593AC933DE1}\\InprocServer32",
        							"ThreadingModel",
        							"Apartment" )

    @Status =    @WriteRegistryKey(@HKeyClassesRoot,
        							"CLSID\\{51BBF920-F83E-11D2-BBD2-A593AC933DE1}",
        							"",
        							"ECI Audio Destination Object" )


    @Return()
@EndFunc



@DefineFunc @Void @ConfigureIESettings(@Void)

    @Status = @WriteRegistryInt(@HKeyCurrentUser,
        						"SOFTWARE\\Microsoft\\Internet Explorer\\Settings",
        						"Always Use My Colors",
        						1 )

    @Status = @WriteRegistryInt(@HKeyCurrentUser,
        						"SOFTWARE\\Microsoft\\Internet Explorer\\Main",
        						"SmoothScroll",
        						0 )

    @Status = @WriteRegistryInt(@HKeyCurrentUser,
        						"SOFTWARE\\Microsoft\\Internet Explorer\\Main",
        						"Page_Transitions",
        						0 )

    @Status = @WriteRegistryKey(@HKeyCurrentUser,
        						"SOFTWARE\\Microsoft\\Internet Explorer\\Main",
        						"Move System Caret",
        						"yes" )


//    @Status = @WriteRegistryInt(@HKeyCurrentUser,
//                                "Software\\Microsoft\\Internet Explorer\\Desktop\\Components\\0",
//                                "Flags",
//                                0x0003 )


    @Return()
@EndFunc




@DefineFunc @Void @StartJFW(@Void)
    @If (@Exists("@TTempDir\\JFWTemp\\runtime\\jfw.EXE") )
        @WEResult = @WinExec("@TTempDir\\JFWTemp\\runtime\\jfw.EXE /install" ,1,(0))
        // @WEResult = @WinExec("@TTempDir\\JFWTemp\\runtime\\jfw.EXE /g0 /noddihooks /install" ,1,(0))
    @Endif
    @Return()
@EndFunc



@DefineFunc @Void @StartDrJaws(@Void)
@If (@NoDrJaws)
@Else
    @If (@NoRuntime == @True)
        @WEResult = @WinExec("@TTempDir\\JFWTemp\\runtime\\drjaws.EXE /r ",2,(-1))
        @Display
        @Cls
        @EndDisplay
        @WEResult = @WinExec("@TTempDir\\JFWTemp\\runtime\\drjaws.EXE /a  /n /p=@StartupDrive:\\@StartupDir\\setup.exe /t=\"JFW version 3.31\" ",1,(-1))
    @Else
        @If (@Exists("@TTempDir\\JFWTemp\\runtime\\drjaws.EXE") )
            @If (@SoundCardInstalled)
                @WEResult = @WinExec("@TTempDir\\JFWTemp\\runtime\\drjaws.EXE /r ",2,(-1))
                @Display
                @Cls
                @EndDisplay
                @WEResult = @WinExec("@TTempDir\\JFWTemp\\runtime\\drjaws.EXE /a  /p=@StartupDrive:\\@StartupDir\\setup.exe /t=\"JFW version 3.31\"  /j=@TTempDir\\JFWTemp\\runtime\\jfw.exe",1,(-1))
            @Else
                @If( @JFWPathFound == @TRUE )
                    @WEResult = @WinExec("@TTempDir\\JFWTemp\\runtime\\drjaws.EXE /r ",2,(-1))
                    @Display
                    @Cls
                    @EndDisplay
                    @WEResult = @WinExec("@TTempDir\\JFWTemp\\runtime\\drjaws.EXE /a  /p=@StartupDrive:\\@StartupDir\\setup.exe /t=\"JFW version 3.31\"  /j=@TTempDir\\JFWTemp\\runtime\\jfw.exe",1,(-1))
                @Else
                    @WEResult = @WinExec("@TTempDir\\JFWTemp\\runtime\\drjaws.EXE /r ",2,(-1))
                    @Display
                    @Cls
                    @EndDisplay
                    @WEResult = @WinExec("@TTempDir\\JFWTemp\\runtime\\drjaws.EXE /a  /n /p=@StartupDrive:\\@StartupDir\\setup.exe /t=\"JFW version 3.31\" ",1,(-1))
                @Endif
            @Endif
        @EndIf

    @Endif
@Endif
    @Return()
@EndFunc


@DefineFunc @Void @StartJMerge(@Void)
    @If (@Exists("@JFWDrive:\\@JFWDir\\JMerge.EXE") )
        @WEResult = @WinExec("@JFWDrive:\\@JFWDir\\JMerge.EXE /m*.* /d /t@JFWDrive:\\@JFWDir\\SETTINGS\\ENU\\MRGTEMP  /o@JFWPath\\SETTINGS\\ENU",1,(-1))
    @EndIf
    @Return()
@EndFunc


@DefineFunc @Integer @IsWaveDeviceInstalledX(@Void)
    @Return(@False)
@EndFunc


@DefineFunc @Void @ReadInstallKeys(@Void)

        @NoDrJaws=@ReadRegistryInt(@HkeyLocalMachine, "SOFTWARE\\Henter-Joyce, Inc.\\JFW\\Install",
                        "NoDrJaws", 0 )

        @NoEloquence=@ReadRegistryInt(@HkeyLocalMachine, "SOFTWARE\\Henter-Joyce, Inc.\\JFW\\Install",
                        "NoEloquence", 0 )

        @NoRuntime=@ReadRegistryInt(@HkeyLocalMachine, "SOFTWARE\\Henter-Joyce, Inc.\\JFW\\Install",
                        "NoRuntime", 0 )




    @If (@NoDrJaws == 1)
        @NoEloquence = 1
        @NoRuntime = 1
    @Endif

    @If (@NoEloquence == 1)
        @NoDrJaws = 1
        @NoRuntime = 1
    @Endif


    @If (@NoRuntime == 1)
        @NoEloquence = 1
        @NoDrJaws = 1
    @Endif


    @If (@NoDrJaws == 0)
        @NoDrJaws = @False
    @Else
        @NoDrJaws = @True
    @Endif


    @If (@NoEloquence == 0)
        @NoEloquence = @False
    @Else
        @NoEloquence = @True
    @Endif

    @If (@NoRuntime == 0)
        @NoRuntime = @False
    @Else
        @NoRuntime = @True
    @Endif

/*

    @Display
    @Cls
    NoDrJaws        = @NoDrJaws
    NoEloquence     = @NoEloquence
    NoRuntime       = @NoRuntime
    @@False         = @False
    @@True          = @True
    @Pause
    @EndDisplay

*/


    @Return()

@EndFunc




//
//







//
//
//
//
//
//
//
//
// main execution
//
//
//
//
//
//
//
//
//
//


@ReadInstallKeys()


@FlushOptions
@FlushGroups


@OutDrive       = @WinDrive
@InstallDrive   = @WinDrive
@JFWDrive       = C
@WinHomeDrive   = @WinDrive


@OutDrive = @WinDrive


@SoundCardInstalled = @IsWaveDeviceInstalled()

@If (@NoEloquence == @True)
    @SoundCardInstalled = @False
@Endif



@If( (@NoDrJaws == @True)  && (@NoEloquence == @True)  &&  (@NoRuntime == @True) )
@Else
    @If (@Exists("@StartupDrive:\\@StartupDir\\jfwkill.EXE") )
        @WEResult = @WinExec("@StartupDrive:\\@StartupDir\\jfwkill.EXE" ,2,(-1))
    @Endif
    @If (@Exists("@StartupDrive:\\@StartupDir\\jfwkill.EXE") )
        @WEResult = @WinExec("@StartupDrive:\\@StartupDir\\jfwkill.EXE" ,2,(-1))
    @Endif
    @If (@Exists("@StartupDrive:\\@StartupDir\\jfwkill.EXE") )
        @WEResult = @WinExec("@StartupDrive:\\@StartupDir\\jfwkill.EXE" ,2,(-1))
    @Endif
@Endif



@InstallDrive = @StartupDrive
@InstallDir = @GetCWD(@InstallDrive)

@TTempDir = @GetTempPath()

@ChDrive(@WinDrive)
@ChDir("\\")

@MkDir("@TTempDir\\JFWTemp")
@MkDir("@TTempDir\\JFWTemp")
@MkDir("@TTempDir\\JFWTemp\\runtime")

@WinHomeDrive = @WinDrive
@WinHomeDir = "@WinDir"


@ChDrive(@StartupDrive)
@ChDir("@StartupDir")


@If(@DriveCDRom(@InDrive)==@True)
  @InstallFromHard = @True
@ElseIf(@Removable(@InDrive)==@False)
  @FileAttr("@InDrive:\\@StartupDir\\DISK.ID", "r-")
  @Write("@InDrive:\\@StartupDir\\DISK.ID", "wt", "@Name\n")
  @Write(,, "@Version\n")
  @Write(,, "HardDisk\n")
  @InstallFromHard = @True
@Endif


@If ( @DiskFree(@OutDrive) < 10000000 )
    @If(@InstallFromHard)
        @If(@SoundCardInstalled)

            @If( @Exists("@StartupDrive:\\@StartupDir\\freeup.wav") )
                @SoundOn = @True
                @PlayWAV("@StartupDrive:\\@StartupDir\\freeup.wav", @False )
                @SoundOn = @False
            @EndIf

        @Endif

        @Display
        @Cls
        You do not have enough free disk space on @OutDrive:
        to install the runtime module for this installation.
        Please clean up enough space so that at least
        10 Meg of disk space will be available, then
        rerun this program.
        @Pause
        @EndDisplay
        @Exit

    @Endif
@Endif



@SubDir = "@TTempDir\\JFWTemp"

@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "C") == 0 )
    @TempDrive = C
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "D") == 0 )
    @TempDrive = D
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "E") == 0 )
    @TempDrive = E
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "F") == 0 )
    @TempDrive = F
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "G") == 0 )
    @TempDrive = G
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "H") == 0 )
    @TempDrive = H
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "I") == 0 )
    @TempDrive = I
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "J") == 0 )
    @TempDrive = J
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "K") == 0 )
    @TempDrive = K
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "L") == 0 )
    @TempDrive = L
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "M") == 0 )
    @TempDrive = M
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "N") == 0 )
    @TempDrive = N
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "O") == 0 )
    @TempDrive = O
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "P") == 0 )
    @TempDrive = P
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "Q") == 0 )
    @TempDrive = Q
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "R") == 0 )
    @TempDrive = R
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "S") == 0 )
    @TempDrive = S
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "T") == 0 )
    @TempDrive = T
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "U") == 0 )
    @TempDrive = U
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "V") == 0 )
    @TempDrive = V
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "W") == 0 )
    @TempDrive = W
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "X") == 0 )
    @TempDrive = X
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "Y") == 0 )
    @TempDrive = Y
@Endif
@If ( @Strcmpnos(@StrHead("@TTempDir", 1), "Z") == 0 )
    @TempDrive = Z
@Endif





@JFWPathFound = @FindJFWPath()


// if we are running on a hard drive, we need to create our
// own disk.id file

@If(@DriveCDRom(@InDrive)==@True)
  @InstallFromHard = @True
@ElseIf(@Removable(@InDrive)==@False)

  @FileAttr("@InDrive:\\@StartupDir\\DISK.ID", "r-")
  @Write("@InDrive:\\@StartupDir\\DISK.ID", "wt", "@Name\n")
  @Write(,, "@Version\n")
  @Write(,, "HardDisk\n")
  @InstallFromHard = @True
@Endif



@If((@NoRuntime == @True) && (@NoDrJaws == @True))
@Else


    @If( ( @InstallFromHard == @True && @Exists("@StartupDrive:\\@StartupDir\\DEFAULT.INI") ) )

        @MkDir("@TTempDir\\JFWTemp\\runtime")
        @MkDir("@TTempDir\\JFWTemp\\runtime\\settings\\enu")

        @OutDrive = @TempDrive

        @SubDir = "@TTempDir\\JFWTemp\\runtime\\settings\\enu"

        @DefineDisk
            @Label="HardDisk"
            @BeginLib RUNSET.RED
                @File *.*
            @EndLib
        @EndDisk





// @Display @Cls Just extracted runtime SETTINGS @Pause @EndDisplay




        @If(  ( (@SoundCardInstalled == @False) && (@NoEloquence == @True) && (@JFWPathFound == @True) ) ||
              ( (@SoundCardInstalled == @False) && ( @JFWPathFound == @True)) )

            @Copy("@JFWPath\\*.a", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.b", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.c*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.d*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.e*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.f*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.g*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.h*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.i*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.j*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.k*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.l*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.m*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.n*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.o*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.p*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.q*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.r*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.s*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.t*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.u*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.v*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.w*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.x*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.y*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\*.z*", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\jfw.exe", "@TTempDir\\JFWTemp\\runtime\\*.*")
            @Copy("@JFWPath\\jfw.enu", "@TTempDir\\JFWTemp\\runtime\\*.*")

        @Endif

        @SubDir = "@TTempDir\\JFWTemp\\runtime"

            @DefineDisk
              @Label="HardDisk"

            	    @BeginLib ELOQroot.RED
            	    @File enu.syn
                    @File eci32d.dll
                    @File eloq.cfg
                    @File eloq.jls
                    @File eloqmain.dct
            	    @EndLib

                    @If (@SoundCardInstalled == @True)
                        @BeginLib RUNSET.RED
                        @File JFW.INI
                        @EndLib
                    @Endif

                    @If (@SoundCardInstalled == @False  &&  @JFWPathFound == @False)
                        @BeginLib RUNSET.RED
                        @File JFW.INI
                        @EndLib
                    @Endif

                    @If (@Exists("@SubDir\\JFW.INI"))
                    @Else
                        @BeginLib RUNSET.RED
                        @File JFW.INI
                        @EndLib
                    @Endif

                    @BeginLib MFCDLL.RED
                    @File *.*
                    @EndLib

                    @BeginLib JFWFiles.RED
                    @File JFWkill.exe
                    @File DrJaws.exe
                    @EndLib

                    @BeginLib JFW.RED
                    @File JFW.exe
                    @EndLib

                    @BeginLib DLL.RED
                    @File drjaws*.*
                    @File jfwvid.dll
                    @File jhook.dll
                    @File osm16.dll
                    @File sh34w32.dll
    //                @File sqcps32p.dll
                    @File psapi.dll
                    @EndLib

                    @BeginLib LANGUAGE.RED
                    @File DrJaws.enu
                    @File jfw.enu
                    @EndLib

                    @BeginLib WAVE.RED
                    @File *.*
                    @EndLib

            @EndDisk

    @Endif


@Endif





@SubDir = "@TTempDir\\JFWTemp"


@If( ( @InstallFromHard == @True && @Exists("@StartupDrive:\\@StartupDir\\DEFAULT.INI") ) )

    @If( @Exists("@TTempDir\\JFWTemp\\runtime\\welcome.wav") )
        @SoundOn = @True
        @If(@SoundCardInstalled)
            @PlayWAV("@TTempDir\\JFWTemp\\runtime\\welcome.wav", @True)
        @Endif
        @SoundOn = @False
    @EndIf

    @If(@NoDrJaws == @False)
        @If( @Exists("@TTempDir\\JFWTemp\\runtime\\voice.wav") )
            @SoundOn = @True
            @If(@SoundCardInstalled)
                @PlayWAV("@TTempDir\\JFWTemp\\runtime\\voice.wav", @True)
            @Endif
            @SoundOn = @False
        @EndIf
    @Endif


@Endif






@OutDrive = @TempDrive




@If(@InstallFromHard == @True)
    @If ( @Exists("@StartupDrive:\\@StartupDir\\DEFAULT.INI") )

        @MkDir("@WinDrive:\\@WinDir\\Speech")

        @DefineDisk
          @Label="HardDisk"

        	@BeginLib EloqRoot.RED
        	@File HJSPEECH.DLL
        	@File Speech20.DLL
        	@EndLib
            @BeginLib MFCDLL.RED
//            @File MSVCRT.DLL
//            @File MFC42.DLL
//            @File MSVCIRT.DLL
            @File DELTREE.EXE
            @EndLib

        @EndDisk

        @ConfigureEloquence()

    @Endif

    @StartDrJaws()

    @If ( (@NoRuntime == @False)  && (@NoDrJaws == @True) )
        @StartJFW()
    @Endif

@Endif


@ConfigureIESettings()



@SubDir = @JFWDir

@ChDrive(@StartupDrive)
@ChDir("@StartupDir")

//Optional install include file, Add for Special Beta Notices, etc.
@If (@Exists("install.inc"))
//  @IncludeScript("@InDrive:.\\install.inc")    ***** jdb
@Endif

//   old location   @IncludeScript("@InDrive:.\\commproc.inc")

    @WinNT = @IsSystemNT()

    @If(@WinNT)
    @Else
      @EverlockExists = @CheckForEverlock()
    @Endif

    @AuthorizationExists = @CheckForAuthorization()

    //Checks to see if system files need to be updated using MSAA
    //Sets @RunMSAA if files are out of date (see @Finish Block for more info)
    @If(@WinNT)
    @Else
        @CheckMSAA()
    @Endif

  @GetInstallType( @InstallType )


  @If (@OptionIsSet(100))
    // @Debug("Standard Desktop", 5)
    @PlayWAV("sdesk.wav", 0)
    @IncludeScript("@StartupDrive:\\@StartupDir\\question.inc")
    //The following 4 lines were added to Dynamically Create and use the Synth/Braille Dialog boxes

    @DlgCtrlSize(0, 3, 3, 12, 48)
    @MakeGetDevices(@SynthFilename,"Synthesizer","Synth",@StartSynth)
    @DlgCtrlSize (0,-1,-1,0,0)

    @DlgCtrlSize(0, 3, 3, 8, 35)
    @MakeGetDevices(@BrailleFilename,"Braille Device","Braille",@StartBraille)
    @DlgCtrlSize (0,-1,-1,0,0)

    @IncludeScript("@TTempDir\\Synth.inc")
    @IncludeScript("@TTempDir\\Braille.inc")
    @IncludeScript("@StartupDrive:\\@StartupDir\\standard.inc")
    @GetStandardDesktopOptions()
  @ElseIf (@OptionIsSet(101))
    // @Debug("Standard Laptop", 5)
    @PlayWAV("slap.wav", 0)
    @IncludeScript("@StartupDrive:\\@StartupDir\\question.inc")
    //The following 4 lines were added to Dynamically Create and use the Synth/Braille Dialog boxes

    @DlgCtrlSize(0, 3, 3, 12, 48)
    @MakeGetDevices(@SynthFilename,"Synthesizer","Synth",@StartSynth)
    @DlgCtrlSize (0,-1,-1,0,0)

    @DlgCtrlSize(0, 3, 3, 8, 35)
    @MakeGetDevices(@BrailleFilename,"Braille Device","Braille",@StartBraille)
    @DlgCtrlSize (0,-1,-1,0,0)

    @IncludeScript("@TTempDir\\Synth.inc")
    @IncludeScript("@TTempDir\\Braille.inc")
    @IncludeScript("@StartupDrive:\\@StartupDir\\standard.inc")
    @GetStandardLaptopOptions()

  @ElseIf (@OptionIsSet(102))
    // @Debug("Custom", 5)
    @PlayWAV("custom.wav", 0)

    @IncludeScript("@StartupDrive:\\@StartupDir\\question.inc")
    //The following 4 lines were added to Dynamically Create and use the Synth/Braille Dialog boxes

    @DlgCtrlSize(0, 3, 3, 12, 48)

    @MakeGetDevices(@SynthFilename,"Synthesizer","Synth",@StartSynth)

    @DlgCtrlSize (0,-1,-1,0,0)

    @DlgCtrlSize(0, 3, 3, 8, 35)
    @MakeGetDevices(@BrailleFilename,"Braille Device","Braille",@StartBraille)
    @DlgCtrlSize (0,-1,-1,0,0)

    @IncludeScript("@TTempDir\\Synth.inc")
    @IncludeScript("@TTempDir\\Braille.inc")
    @IncludeScript("@StartupDrive:\\@StartupDir\\custom.inc")
    @GetCustomOptions()

  @ElseIf (@OptionIsSet(103))
    // @Debug("Partial", 5)
    @PlayWAV("partial.wav", 0)
        @IncludeScript("@StartupDrive:\\@StartupDir\\partial.inc")
    @GetPartialOptions()
    //Until this section is complete exit to keep from running the rest of the script
    @Exit

  @ElseIf (@OptionIsSet(104) )

        //IncludeScript doesn't work inside a function!!!
        // @IncludeScript("@StartupDrive:\\@StartupDir\\default.ini")



    // @Debug("Forced", 5)
    @OutDrive = @JFWDrive
    @SubDir = @JFWDir
  @ElseIf (@OptionIsSet(105))
    // @Debug("Make Def", 5)
    @PlayWAV("makedef.wav", 0)
    @IncludeScript("@StartupDrive:\\@StartupDir\\question.inc")
    //The following 4 lines were added to Dynamically Create and use the Synth/Braille Dialog boxes
    @MakeGetDevices(@SynthFilename,"Synthesizer","Synth",@StartSynth)
    @MakeGetDevices(@BrailleFilename,"Braille Device","Braille",@StartBraille)
    @IncludeScript("@TTempDir\\Synth.inc")
    @IncludeScript("@TTempDir\\Braille.inc")
    @IncludeScript("@StartupDrive:\\@StartupDir\\custom.inc")
        @IncludeScript("@StartupDrive:\\@StartupDir\\makedef.inc")
    @GetCustomOptions()
    @MakeDefaults()
    //Exit to skip the rest of the script  (Just make a default.ini)
    @Exit
  @Else
    @Display
        An unknown error has occured, please contact Henter-Joyce
        ERROR INSTALL TYPE NOT 100-104
    @Pause
    @EndDisplay
    @Exit
  @Endif
//Give user chance to re-do questions


// @Debug("In install.dat at line 564, looking at Flag 104 : @OptionIsSet(104)", 0)

@If (@OptionIsSet(104))
@Else
    @Debug("In install.dat at line 568, looking at VerifyOptions ", 0)
    @If (@VerifyOptions()==@False)
      @ResetDevices()
      @If (@OptionIsSet(100))
        @GetStandardDesktopOptions()
      @ElseIf (@OptionIsSet(101))
        @GetStandardLaptopOptions()
      @ElseIf (@OptionIsSet(102))
        @GetCustomOptions()
      @ElseIf (@OptionIsSet(103))
        @GetPartialOptions()
        @Exit
      @Endif
    //  @Goto Restart
      @ShowMyOptions()
@Endif

 @Endif
//start extracting options...



    @If (@Exists("@JFWDrive:\\@JFWDir\\UNINST.DAT") )
        @Delete("@JFWDrive:\\@JFWDir\\UNINST.DAT")
    @Endif





//
// Ask if we should run JMERGE
//


@If (@OptionIsSet(104) )  // if we are FORCED
    @RunJMerge = @False
@Else

    @If (@JFWPathFound == @True)

      @ClearOption(125)
      @ClearOption(126)
//// check
        @DlgCtrlSize(0, 6, 5, 9, 17)

        @GetOption
        @Cls
        A link to a previously installed version of
        JFW has been found. Do you want to run the
        merge utility to preserve your existing
        configuration, dictionary, and graphic
        file entries?

        @Option 125 = "Yes"
        @Option 126 = "No"
      @EndOption
      @DlgCtrlSize(0, -1, -1, 0, 0)

        @If (@OptionIsSet(125))
            @RunJMerge = @True
        @ElseIf (@OptionIsSet(126))
            @RunJMerge = @False
        @Else
            @RunJMerge = @True
        @EndIf
    @Endif
@EndIf





@If(@OptionIsSet(104) )
    @If ( @DiskFree(@OutDrive) < 50000000 )
    @Display
    @Cls
    You do not have enough free disk space on @OutDrive:
    to install this software.  Please clean up enough
    space so that at least 50M of disk space will be
    available, then rerun this program.
    @Pause
    @EndDisplay
    @If (@Exists("@TTempDir\\JFWTemp\\runtime\\jfwkill.EXE") )
       @WEResult = @WinExec("@TTempDir\\JFWTemp\\runtime\\jfwkill.EXE" ,2,(-1))
    @Endif
    @Exit
    @Endif
@Endif















@If (@InstallFromHard)
//  @Display
//  @Cls
//  The Install program is now ready to begin copying files to your system. Press the Enter key now to begin copying the @Name files. If you wish to abort this install, please press Escape followed by Enter.
//  @Pause
//  @EndDisplay
@Else
  @Display
  @Cls
  The Install program is now ready to begin copying files to your system.  During this stage, if you are installing from floppy disks, the computer will beep when it is through with a disk. When this happens, remove your current disk from the floppy drive, replace it with the next numbered disk, press the Enter key, and let Install continue.  If the system beeps again, put the next disk in and repeat the procedure.  Install will continue when it has the disk it needs. When you have gone through all the disks in the set, return to the first disk.
  Press the Enter key now to begin copying the @Name files.
  If you wish to abort this install, please press Escape followed by Enter.
  @Pause
  @EndDisplay
@Endif




@ProgramManager("[DeleteGroup(JFW331)]")





//Turn off sound
//  @MCISendString("close all")

/* Install Common Files */

    @ChDrive(@OutDrive)

    @MkDir("\\@SubDir")
    @MkDir("@JFWTempDir")

    @If (@WinNT)

        @UnInst( "@@Exit\n\n" )

        @UnInst("@@System(\"Deltree /y @JfwDrive:\\\\@JfwDir\",0,-1)\n")
        @UnInst("@@ChDir(\"\\\\\")\n")

        @UnInst("@@Delete(\"SETJV.EXE\")\n")
        @UnInst("@@Delete(\"JFW*.*\")\n")
        @UnInst("@@ChDir(\"\\\\@WinDir\\\\System32\")\n")
        @UnInst("@@ChDrive(@WinSystemDrive)\n")

        @UnInst("@@WinExec(\"@JFWDrive:\\\\@JFWDir\\\\DrJAWS.EXE /SETJV=R\", 2,-1)\n")


    @Else


        @UnInst( "@@Exit\n\n" )

        @UnInst("@@System(\"Deltree /y @JfwDrive:\\\\@JfwDir\",0,-1)\n")
        @UnInst("@@ChDir(\"\\\\\")\n")
        @UnInst("@@WinRegCloseKey(@@NewHandle2)\n")
        @UnInst("@@WinRegDeleteValue(@@NewHandle2, \"JfwEXE\" )\n")
        @UnInst("@@WinRegOpenKey(@@HKeyLocalMachine, \"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\RunServices\", @@NewHandle2)\n")


    @Endif

    @UnInst( "@@ProgramManager(\"[DeleteGroup(JFW331)]\")\n" )

    @UnInst( "@@ChDir(\"\\\\\")\n" )





  @Copy("@StartupDrive:\\@StartupDir\\uninst.EXE", "@JFWDrive:@JFWDir\\\\UNINST.EXE" )
  @Copy("@StartupDrive:\\@StartupDir\\DISK.ID", "@JFWDrive:@JFWDir\\\\DISK.ID" )


//@Display
//@Cls
//    Current Directory : @GetCWD()
//@Pause
//@EndDisplay





@ChDrive(@StartupDrive)
@ChDir("@StartupDir")


//@Display
//@Cls
//    Current Directory : @GetCWD()
//@Pause
//@EndDisplay




    @If (@Exists("@JFWDrive:\\@JFWDir\\JFW.INI") )
        @Delete("@JFWDrive:\\@JFWDir\\JFW.INI")
    @Endif

    @If (@Exists("@JFWDrive:\\@JFWDir\\ELOQ.INC") )
        @Delete("@JFWDrive:\\@JFWDir\\ELOQ.INC")
    @Endif






    @DefineDisk

        @If(@InstallFromHard)
            @Label="HardDisk"
        @Else
            @Label="Disk 1"
        @Endif

        @BeginLib CONFIG.RED
            @File *.*
        @EndLib

//        @If ( @NumBraille > 0)
//            @BeginLib BTABLE.RED
//                @File *.*
//            @EndLib
//        @Endif


    @If (@Exists("extra.red"))
        //for any last minute announcements
            @BeginLib EXTRA.RED
            @File *.*
            @EndLib
    @Endif

    @EndDisk


// @Debug("about to modify JFW.INI", 0)
    //JFW.INI pulled from CONFIG.RED

    @ModifyJFWINI() //run after there is a JFW.INI to Modify :)

    @If(@WinNT)
    @Else
        @CopyHJCR()
    @Endif



// @Debug("about to change to InDrive: @InDrive, StartupDrive = @StartupDrive", 0)
    @AltInDrive = @InDrive
    @ChDrive(@InDrive)

    @If(@InstallFromHard)
        @Chain("HardDisk", "INSTALL.2")
    @Else
        @Chain("Disk 2", "INSTALL.2")
    @Endif

