웹마스터 팁

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

제목 글쓴이 날짜
로그인 후 그룹별로 다른 페이지로 가기 - 업데이트판 v1.5 [19] 무대포2 2009.06.24
로그인 페이지 만드는 방법 [5] 산토 2009.06.12
별도 페이지 로그인방법 cornet 2009.05.21
내가 작성 한 글에 대한 일괄 삭제/이동/복사 권한 주기 [2] file 개돌 2009.05.15
BNU님의 Planner XE 1.2 버젼(일정관리) [9] file 개돌 2009.04.21
다양한 언어로 홈페이지 서비스하기 - 무식한 방법 [4] 멀리서 2009.04.21
주민등록 입력 폼 1.2.0 [55] file 개돌 2009.04.10
요청하신 모듈을 찾을 수 없습니다 문제해결 방법 [2] 반도체맨 2009.04.09
클릭마다 조회수 올리기 [1.4.0] [12] file 지B 2009.04.04
특정그룹 멤버 표시 위젯에서 이름 순 정렬하기 [2] file 이재한744 2009.03.30
로그인 포인트 출력 위젯을 수정해보자 [花穗] 2009.03.27
제로보드의 아이콘을 내 맘대로 변경하기...(2) [2] file winter548 2009.03.23
브라우저 크기에 따라 본문 가로 크기 자동 조절 [1] 개돌 2009.03.18
첨부파일의 외부 무단 링크 차단하기(XE) 게시판설정 [7] file 왕초보왕따 2009.03.02
테스트용 아이디 탈퇴 막기 [1] SMaker 2009.02.26
게시판에서 사이트 관리자만 볼수있는 항목 만들기 [1] ☜ TeRy ☞ 2009.02.13
사이트 이전팁( files 폴더) [6] 샤이니라 2009.01.28
(재 수정) 제로보드 XE 신버젼에 Lavalic 2 설치하기 [4] 조성우371 2009.01.16
제로보드XE 쉽게 업데이트 하는 방법.. [13] 청개구리00 2009.01.12
로그인한 회원만 최근 게시글, 검색등 볼수 있도록 하기 [3] [_)s 2008.12.31