웹마스터 팁

제가 관리하는 홈페이지에 사용한 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>

제목 글쓴이 날짜
Mysql 4.0 버전에서 xe 설치해서 사용하기 [3] amamamam.myid.net 2007.08.13
(파일 첨부) 파일명 안보일 때 ... 없애기 [9] Simulz 2007.09.10
apmsetup5를 이용한 zbxe 설치 및 복구 [2] 무도사 2007.11.02
UTF-8과 Euc-kr 동시에 사용하기 [10] 써니a 2007.11.05
제로보드에서 로그인후 테크노트에서 로그인정보 사용하기 [4] JinHoHan 2007.12.26
HTTP 406 Error 가 나오면서 업로드 안될때 [16] file plruto 2008.02.08
[펌] Apache rewrite Module [8] ☜ TeRy ☞ 2008.02.22
자료 첨부 문제 단풍534 2008.07.15
[초간단]회원팝업메뉴에 메뉴넣기 [1] Pw-NET 2008.11.30
XE DB 백업한거 복원 하기 [2] 라르게덴 2009.03.17
폴더에 올린 mp3를 자동으로 podcast로 만들어주는 소스... ^^ [2] 하얀마법 2010.09.11
Microsoft 에이전트를 이용해서 멋나게 꾸며보자 -_-)/ [7] 티르-_-)/ 2002.02.23
textarea 입력받는 글자수 제한하는 스크립트 [5] 오기 2002.01.17
▩찾기 기능을 내 홈페이지에 넣어보자 [1] ▩윤미 2002.02.26
윈도우 할아버지 나타나게 하기 [11] 행복한고니 2002.11.14
[re] 아래 행복한고니님의 할아버지 소스의 업글(?) 버젼입니다. [2] Mahican 2002.12.02
아래 행복한고니님의 할아버지 소스의 업글(?) 버젼입니다. [7] (づ_-) 커터칼 2002.11.18
자바스크립트용 계산기 v1.0 [4] 찐군 2003.01.09
메인 접속하면 할아버지 나오는... [6] 공유 2003.08.28
[초간단 자바스크립트!] 자바로 플래시 따라하기! [3] ∑Ztxy 2003.10.15