웹마스터 팁

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

제목 글쓴이 날짜
정말 쉬운 이미지 롤오버 [3] Nopedy Lee 2002.12.05
엔지오처럼 메뉴가 아래위로 움직이는 소스[steelheart님 만듬]. [10] 김태경 2002.11.23
iframe 내용에 맞게 자동으로 크기 조절하기 [36] 행복한고니 2002.11.21
[파파스 1] 즐겨찾기 추가기능 소스 [5] 파파스 2002.11.20
제로님 Select Box 조금 바꾼거... [5] 행복한고니 2002.11.18
아래 행복한고니님의 할아버지 소스의 업글(?) 버젼입니다. [7] (づ_-) 커터칼 2002.11.18
[re] 아래 행복한고니님의 할아버지 소스의 업글(?) 버젼입니다. [2] Mahican 2002.12.02
이미지 변환함수(롤오버) [3] 행복한고니 2002.11.18
글상자글적으면 적은수가 숫자로 표시(글제한할때좋죠). [2] 아벨라 2002.11.18
레이어를 원하는 곳에 고정하기입니다. [7] 아벨라 2002.11.14
윈도우 할아버지 나타나게 하기 [11] 행복한고니 2002.11.14
고정된 배경이미지는 싫다면서... [9] 디아릭스 2002.11.12
엔지오같은 메뉴 만들기 #2 - Error 수정판 -_-;; [13] Eccen 2002.11.12
[re] 엔지오같은 메뉴 만들기 #2 -> 레이어배치 팁! //ⓦⓞⓞⓡⓨ님참고 [3] Aracing™ 2003.01.10
방문자가 특정부분 텍스트크기 바꿀수 있게 (확대/축소) [2] 디아릭스 2002.11.05
링크 포커스 없애기 3탄 [10] 멀대 2002.11.05
엔지오같은 메뉴 만들기 #1 - 수정판 [6] Eccen 2002.11.05
[자작] select 폼 태그 html로 허접하게나마 꾸며보기 [18] zero 2002.11.05
글씨 하이퍼링크시 밑줄 없에기 [8] 이솔렛 2002.10.31
하이퍼링크 점선 테두리 없애기 [9] 레드 2002.10.31