웹마스터 팁

제가 관리하는 홈페이지에 사용한 ms agent의 소스입니다...

그리고 자바가 아닌 VBScript 입니다. 그리고 <head>와 </head> 사이에 삽입하시면 링크에러가 날 것입니다.
<body> 부분에 넣어서 사용하세요..


<Script Language="VBScript">

' * Character Objects
Dim Genie

'+ ' * Variables
Dim UsedChars
Dim GenieID
Dim GenieACS
Dim GenieURL
Dim GenieStates
Dim GenieAnimations
Dim GenieReq
Dim GenieStatesReq
Dim GenieAnimationsReq
Dim GenieLoaded
Dim HideReq
Dim Req

' * Initialize
UsedChars = "Genie"

' * Genie
Genie = "Genie"
GenieACS = "Genie.acs"
GenieURL = "http://agent.microsoft.com/agent2/chars/genie/genie.acf"
GenieStates = "Showing, Hiding, Speaking, Moving, Gesturing"
GenieAnimations = "GestureRight, DoMagic1, DoMagic2, Idle1_1, Idle1_2, Idle1_3, Idle1_4, Idle1_5, Idle1_6, Idle2_1, Idle2_2, Idle2_3, Idle3_1, Process, GetAttentionReturn, Greet"
GenieLoaded = False


' * Prevent Auto-Download of Microsoft Agent if not already installed
If AgentInstalled() Then
    Document.WriteLn "<Object ID=""AgentControl"" Width=0 Height=0"
    Document.WriteLn "  ClassID=""CLSID:D45FD31B-5C6E-11D1-9EC1-00C04FD7081F"""
    Document.WriteLn "  CodeBase=""#VERSION=2,0,0,0"">"
    Document.WriteLn "</Object>"

    Document.WriteLn "<Object ID=""L&HTruVoice"" Width=0 Height=0"
    Document.WriteLn "  ClassID=""CLSID:B8F2846E-CE36-11D0-AC83-00C04FD97575"""
    Document.WriteLn "  CodeBase=""#VERSION=6,0,0,0"">"
    Document.WriteLn "</Object>"
End If

Function AgentInstalled()
    ' Purpose:  Returns True if Agent 2.0 is installed, else False
    On Error Resume Next

    Dim AgentControl
    Dim ScriptVersion

    ScriptVersion = GetScriptVersion()

    If ScriptVersion > 1 Then
        Set AgentControl = CreateObject("Agent.Control.2")
        AgentInstalled = IsObject(AgentControl)
    Else
        AgentInstalled = False
    End If
End Function

Function GetScriptVersion()
    ' Purpose:  Returns major version of the Scripting Engine
    On Error Resume Next

    Dim Ver

    Ver = 0
    Ver = ScriptEngineMajorVersion
    If Ver = 0 Then Ver = 1
    GetScriptVersion = Ver
End Function

Sub Window_OnLoad()
    ' Purpose:  Runs automatically when page is loaded
    On Error Resume Next

    ' * INSERT ANY NON-AGENT RELATED SCRIPTING HERE

    If Not AgentInstalled() Then
        Exit Sub
    End If

    AgentControl.Connected = True

    GenieLoaded = LoadLocalAgent(GenieID, GenieACS)

    If GenieLoaded Then
        Call SetCharObj
    End If

    Call CheckLoadStatus
End Sub

Function LoadLocalAgent(ByVal CharID, ByVal CharACS)
    ' Purpose:  Attempts to load the specified character
    ' Returns:  True if successful, False if not
    On Error Resume Next

    AgentControl.Characters.Load CharID, CharACS

    If Err = 0 Then
        LoadLocalAgent = True
        Exit Function
    End If
    LoadLocalAgent = False
End Function

Sub SetCharObj()
    ' Purpose:  Sets the character reference and TTS Language ID
    On Error Resume Next

    Set Genie = AgentControl.Characters(GenieID)
    Genie.LanguageID = &H412
End Sub

Sub CheckLoadStatus()
    ' Purpose:  Determines if required characters have been loaded.
    '           If not, issue request to load next character
    '           else run the AgentIntro routine

    If Not GenieLoaded Then
        Window.Status = "Loading " & GenieID & " Character.  Please Wait..."
        Set GenieReq = AgentControl.Characters.Load(GenieID, GenieURL)
        Exit Sub
    End If

    Window.Status = ""
    Call AgentIntro
End Sub

Sub AgentControl_RequestComplete(ByVal RequestObject)
    ' Purpose:  Take action on completion or failure of requests
    On Error Resume Next

    Select Case RequestObject
    Case GenieReq
        If RequestObject.Status = 0 Then
            Call SetCharObj

            If GenieStates <> "" Then
                Window.Status = "Loading " & GenieID & " States.  Please Wait..."
                Set GenieStatesReq = AgentControl.Characters(GenieID).Get("State", GenieStates, True)
            ElseIf GenieAnimations <> "" Then
                Window.Status = "Loading " & GenieID & " Animations.  Please Wait..."
                Set GenieAnimationsReq = AgentControl.Characters(GenieID).Get("Animation", GenieAnimations, True)
            Else
                GenieLoaded = True
                Call CheckLoadStatus
            End If
        Else
            Call LoadError
        End If
        Exit Sub
    Case GenieStatesReq
        If RequestObject.Status = 0 Then
            If GenieAnimations <> "" Then
                Window.Status = "Loading " & GenieID & " Animations.  Please Wait..."
                Set GenieAnimationsReq = AgentControl.Characters(GenieID).Get("Animation", GenieAnimations, True)
            Else
                GenieLoaded = True
                Call CheckLoadStatus
            End If
        Else
            Call LoadError
        End If
        Exit Sub
    Case GenieAnimationsReq
        If RequestObject.Status = 0 Then
            GenieLoaded = True
            Call CheckLoadStatus
        Else
            Call LoadError
        End If
        Exit Sub
    Case HideReq
        AgentControl.Characters.Unload GenieID
    End Select
End Sub

Sub LoadError()
    Dim strMsg
    Window.Status = ""
    strMsg = "Error Loading Character: " & GenieID
    strMsg = strMsg & Chr(13) & Chr(13) & "This Microsoft Agent Script requires the character(s):"
    strMsg = strMsg & Chr(13) & UsedChars
    MsgBox strMsg, 48
End Sub

Sub AgentControl_Click(ByVal CharacterID, ByVal Button, ByVal Shift, ByVal X, ByVal Y)

End Sub

Sub AgentControl_DblClick(ByVal CharacterID, ByVal Button, ByVal Shift, ByVal X, ByVal Y)
    ' Purpose:  Stop and Hide all characters on double-click
    On Error Resume Next

    Genie.StopAll
    If Not GenieID.HasOtherClients Then
        If Genie.Visible Then
            Set HideReq = Genie.Hide()
        Else
            AgentControl.Characters.Unload GenieID
        End If
    End If
End Sub

Function GetDay()
    ' Purpose:  Returns current weekday name
    Dim aDay
    aDay = Array("","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
    GetDay = aDay(WeekDay(Now()))
End Function

Function GetDate()
    ' Purpose:  Returns current long date
    Dim aMon
    Dim sDay

    aMon = Array("","January","February","March","April","May","June","July","August","September","October","November","December")

    sDay = Day(Now())

    If sDay = "11" Or sDay = "12" Or sDay = "13" Then
        sDay = sDay & "th"
    Else
        Select Case Right(sDay, 1)
        Case "1": sDay = sDay & "st"
        Case "2": sDay = sDay & "nd"
        Case "3": sDay = sDay & "rd"
        Case Else
            sDay = sDay & "th"
        End Select
    End If

    GetDate = aMon(Month(Now())) & " " & sDay & ", " & Year(Now())
End Function

Function GetTime()
    ' Purpose:  Returns current time
    On Error Resume Next
    Dim sTime

    sTime = Left(Time(), 5)
    If Right(sTime, 1) = ":" Then
        sTime = Left(sTime, Len(sTime) - 1)
    End If
    sTime = sTime & Mid(Time(), InStr(Time(), " "))

    GetTime = sTime
End Function

Function GetTimeOfDay()
    ' Purpose:  Returns current time of day
    Dim TimeOfDay
    Dim h

    h = Hour(Now())

    If h < 12 Then
        TimeOfDay = "Morning"
    ElseIf h < 17 Then
        TimeOfDay = "Afternoon"
    Else
        TimeOfDay = "Evening"
    End If

    GetTimeOfDay = TimeOfDay
End Function

Sub InitAgentCommands()
    ' Purpose:  Initialize the Commands menu
    On Error Resume Next

    Genie.Commands.RemoveAll
    Genie.Commands.Caption = "My Menu Name"
    Genie.Commands.Add "ACO", "Advanced Character Options", "Advanced Character Options"
End Sub

Sub AgentControl_Command(ByVal UserInput)
    ' Purpose:  Determine Command that was selected either by menu or voice
    '           and run the applicable Command Script
    On Error Resume Next

    Dim BadConfidence
    BadConfidence = 10

    If (UserInput.Confidence <= -40) Then
        ' Bad Recognition
        Exit Sub
    ElseIf (UserInput.Alt1Name <> "") And Abs(Abs(UserInput.Alt1Confidence) - Abs(UserInput.Confidence)) < BadConfidence Then
        ' Bad Confidence - too close to another command
        Exit Sub
    ElseIf (UserInput.Alt2Name <> "") And Abs(Abs(UserInput.Alt2Confidence) - Abs(UserInput.Confidence)) < BadConfidence Then
        ' Bad Confidence - too close to another command
        Exit Sub
    Else ' High Confidence
        ' *** BEGIN MASH USER COMMANDS ***
        Select Case UserInput.Name
        Case "ACO"
            AgentControl.PropertySheet.Visible = True
        End Select
        ' *** END MASH USER COMMANDS ***
    End If
End Sub

Sub AgentControl_Bookmark(ByVal BookmarkID)
    On Error Resume Next

End Sub

Sub AgentIntro()
    On Error Resume Next

    Call InitAgentCommands

    ' *** BEGIN MASH USER SCRIPT ***

    Genie.Show
    Genie.MoveTo 870, 170
    Genie.Play "MoveDown"
    Genie.Play "Greet"
    Genie.Speak "안녕하세요 Good " & GetTimeOfDay() & "! 지니입니다.  오늘은   " & GetDay() & ", " & GetDate() & "."
    Genie.Speak "소리사랑 홈페이지를 방문해주셔서 감사합니다."
    Genie.Play "Process"
    Genie.MoveTo 30, 170
    Genie.Speak "원하는 메뉴를 선택하세요!!           "
    Genie.Play "Gestureleft"
    Genie.Play "Acknowledge"
    Genie.Play "Confused"
    Genie.Play "Process"
    Genie.MoveTo 800, 280
    Genie.Play "DoMagic1"
    Genie.Play "DoMagic2"
    Genie.Speak "참 먼저 로그인을 해주세요!!          "
    Genie.Play "GestureRight"
    Genie.Speak "그리고 회원은 소리사랑가족만 받습니다!!"
    Genie.Speak "그리고 비밀번호 혹은 아이디를 잊어 먹었을때는 비밀번호찾기를.. ^^           "
    Genie.MoveTo 800, 480
    Genie.Play "Congratulate"    
    Genie.Speak "박수 박수"
    Genie.Speak "생일도 축하해줍시다. "
    Genie.MoveTo 870, 170
    Genie.Play "Idle1_1"
    Genie.Play "Idle1_2"
    Genie.Play "Idle1_3"
    Genie.Play "Idle1_4"
    Genie.Play "Idle1_5"
    Genie.Play "Idle1_6"
    Genie.Play "Idle2_1"
    Genie.Play "Idle2_2"
    Genie.Play "Idle2_3"
    Genie.Play "Idle1_1"
    Genie.Play "Idle1_2"
    Genie.Play "Idle1_3"
    Genie.Play "Idle1_4"
    Genie.Play "Idle1_5"
    Genie.Play "Idle1_6"
    Genie.Play "Idle1_1"
    Genie.Play "Idle1_2"
    Genie.Play "Idle1_3"
    Genie.Play "Idle1_4"
    Genie.Play "Idle1_5"
    Genie.Play "Idle1_6"
    Genie.Play "Idle2_1"
    Genie.Play "Idle2_2"
    Genie.Play "Idle2_3"
    Genie.Play "Idle3_1"
    Genie.Play "Process"
    Genie.Play "GetAttentionReturn"
    Genie.Speak "앗 저의 주인님이 부르시는군요!!"
    Genie.Speak "급히 가봐야겠습니다."
    Genie.MoveTo 490, 350
    Genie.Play "Greet"
    Genie.Speak "Good bye 먼저 갑니다..."
    Genie.hide

    ' *** END MASH USER SCRIPT ***
End Sub


</Script>

제목 글쓴이 날짜
[PHP]간단한 로그인페이지 만들기 [15] ZipShin 2002.07.09
MYSQL에 접속하기..^^ [9] ZipShin 2002.05.20
[OsE=] Session을 배워보자~ [#1] OsE= 2002.03.02
파일시스템에서 비밀번호 생성/수정/인증 [7] 두기두바 2002.01.10
[추천 소스] phpMyAdmin 다중사용자용... [5] WOWpc 2001.11.29
대화방을 만들어보쟈~ [20] 해그리드짱!!! 2001.06.03
PHP 인증 페이지를 만들자! - Lesson 3 수정본 #1 [3] ☺[폐]허접-_- 2002.01.24
쿠키(cookie)의 활용 [44] zero 2000.03.06
{로그인}관리자 로그인 폼 간단함 [2] 김민환 2006.10.10
상위 셀렉트박스 값 변경시 하위셀렉트박스(다수)제어하기. [2] Xian 2005.02.19
특정위치에 떠있는 레이어 (슬라이딩 애드콘) - 노프레임홈에서의 문제해결 [8] 검미르 2004.05.03
[초간단 자바스크립트!] 자바로 로그인폼 만들기 [3] ∑Ztxy 2004.01.26
[초간단 자바스크립트!] 홈페이지에 FTP 폼 넣기?! [10] ∑Ztxy 2003.09.29
크롬리스(Chromless) 웹어플리케이션 -5 [3] sundew 2003.05.28
다음 로그인 폼 입니다... 로그인후 원하는 곳으로!! [3] 정성교 2003.03.05
로그인과 로그아웃을 체크하는 방법입니다. [3] 이영호 2003.01.24
텍스트 폼에 커서가 미리 깜빡이도록... [8] 카리 2003.01.22
[re] 아래 행복한고니님의 할아버지 소스의 업글(?) 버젼입니다. [2] Mahican 2002.12.02
[자작] select 폼 태그 html로 허접하게나마 꾸며보기 [18] zero 2002.11.05
자바스크립트로 여러개 아이디 로그인 하기 [5] ZipShin 2002.09.17