On Error Resume Next
flash_OK = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))
If Not speedSlider_OK Then speedSlider_OK = IsObject(CreateObject("SpeedSlider.Speed"))
If Not recordMeter_OK Then recordMeter_OK = IsObject(CreateObject("recordmeter.showmeter"))
If Not audioMeter_OK Then audioMeter_OK = IsObject(CreateObject("audiometer.audiographic"))
If Not ieSpell_OK Then ieSpell_OK = IsObject(CreateObject("IeSpell.ieSpellExtension"))


Dim oAgent
Dim oChar
Dim bAgent
Dim bChar
Dim bTTS
Dim bSR

	bAgent = False
	bChar = False
	bTTS = False
	bSR = False


	If LoadAgent() Then
		bAgent = True

		If LoadChar() Then
			bChar = True

			If LoadTTS() Then
				bTTS = True

				If LoadSR() Then
					bSR = True

				End If
			End If

		End If

	End If

	Call UnloadAgent


Function LoadAgent()
    ' Purpose:  Returns True if Agent 2.0 is installed, else False
    On Error Resume Next

    If ScriptEngineMajorVersion < 2 Then
        LoadAgent = False
    Else
        Set oAgent = CreateObject("Agent.Control.2")
        LoadAgent = IsObject(oAgent)
    End If
End Function

Function UnloadAgent()
	On Error Resume Next

	If Not oChar.HasOtherClients Then
		oAgent.Characters.Unload "Default"
	End If

	Set oAgent = Nothing
End Function

Function LoadChar()
	On Error Resume Next

	oAgent.Connected = True

	oAgent.Characters.Load("Default")

	Set oChar = oAgent.Characters("Default")

	LoadChar = (Err = 0)
End Function

Function LoadTTS()
	On Error Resume Next

	Dim sTTS

	sTTS = oChar.TTSModeID

	LoadTTS = (sTTS <> "")
End Function

Function LoadSR()
	On Error Resume Next

	Dim sSR

	sSR = oChar.SRModeID

	LoadSR = (sSR <> "")
End Function


