中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

vbs中如何通過MsAgent組件實現微軟精靈

發布時間:2021-10-13 14:38:21 來源:億速云 閱讀:301 作者:小新 欄目:開發技術

這篇文章主要介紹了vbs中如何通過MsAgent組件實現微軟精靈,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

代碼如下:

'On Error Resume Next
strAgentName = "Merlin"
strAgentPath = "c:\windows\msagent\chars\" & strAgentName & ".acs"
ScriptComplete=0

Set objAgent = WScript.CreateObject("Agent.Control.2","agent_")
objAgent.Connected = True
objAgent.Characters.Load strAgentName, strAgentPath
Set objCharacter = objAgent.Characters(strAgentName)
objCharacter.LanguageID = &H409
'objCharacter.LanguageID = &H804 '菜單為中文,但微軟沒有開發中文語音

objCharacter.MoveTo 0, 700
objCharacter.Show
objCharacter.GestureAt 900, 700
wsh.sleep 2000
objCharacter.MoveTo 900, 700
wsh.sleep 3000
objCharacter.GestureAt 900, 100
wsh.sleep 2000
objCharacter.MoveTo 900, 100
wsh.sleep 3000

objCharacter.Speak("Good " & GetTimeOfDay())
objCharacter.Speak("I love you")
objCharacter.speak("Hello, how are you?")
objCharacter.speak("I will show for you!")
wsh.sleep 10000

'邊表演邊說明
show "Acknowledge", "點頭"
show "Alert", "伸直并抬起眉毛"
show "Announce", "舉起喇叭并吹奏"
show "Blink", "眨眼睛"
show "Confused", "撓頭"
show "Congratulate", "展示獎品"
show "Congratulate_2", "鼓掌"
show "Decline", "抬起手并搖頭"
show "DoMagic1", "舉起魔法棍"
show "DoMagic2", "放下魔法棍,出現云彩"
show "DontRecognize", "捂住耳朵"
show "Explain", "將兩臂向兩側展開"
show "GestureDown", "向下的手勢"
show "GestureLeft", "向左的手勢"
show "GestureRight", "向右的手勢"
show "GestureUp", "向上的手勢"
show "GetAttention", "向前傾并敲擊"
show "GetAttentionContinued", "向前傾并再次敲擊"
show "GetAttentionReturn", "返回正常姿勢"
ShowLoop "Hearing_1", "耳朵伸長(循環的動畫)"
ShowLoop "Hearing_2", "頭向左傾(循環的動畫)"
ShowLoop "Hearing_3", "頭向左轉(循環的動畫)"
ShowLoop "Hearing_4", "頭向右轉(循環的動畫)"
show "Hide", "消失在帽子下面"
show "Idle1_1", "喘口氣"
show "Idle1_2", "向左看并眨眼"
show "Idle1_3", "向右看"
show "Idle1_4", "從上往右看并眨眼"
show "Idle2_1", "看看魔法棍并眨眼"
show "Idle2_2", "手握手并眨眼"
show "Idle3_1", "打呵欠"
ShowLoop "Idle3_2", "入睡(循環的動畫)"
show "LookDown", "向下看"
show "LookDownBlink", "眨眼向下看"
show "LookDownReturn", "返回正常姿勢"
show "LookLeft", "向左看"
show "LookLeftBlink", "眨眼向左看"
show "LookLeftReturn", "返回正常姿勢"
show "LookRight", "向右看"
show "LookRightBlink", "眨眼向右看"
show "LookRightReturn", "返回正常姿勢"
show "LookUp", "向上看"
show "LookUpBlink", "眨眼向上看"
show "LookUpReturn", "返回正常姿勢"
show "MoveDown", "向下飛行"
show "MoveLeft", "向左飛行"
show "MoveRight", "向右飛行"
show "MoveUp", "向上飛行"
show "Pleased", "微笑并把手合在一起"
show "Process", "攪拌大鍋"
ShowLoop "Processing", "攪拌大鍋(循環的動畫)"
show "Read", "打開書,閱讀并查尋"
show "ReadContinued", "閱讀并查尋"
show "ReadReturn", "返回正常姿勢"
ShowLoop "Reading", "閱讀(循環的動畫)"
show "RestPose", "正常姿勢"
show "Sad", "悲傷的表情"
show "Search", "觀察水晶球"
ShowLoop "Searching", "觀察水晶球(循環的動畫)"
show "Show", "從帽子中出現"
show "StartListening", "手靠向耳朵"
show "StopListening", "手捂在耳朵上"
show "Suggest", "顯示電燈泡"
show "Surprised", "顯得很吃驚"
show "Think", "用手托住下巴向上看"
ShowLoop "Thinking", "用手托住下巴向上看(循環的動畫)"
show "Uncertain", "向前傾并抬起眉毛"
show "Wave", "擺手"
show "Write", "打開書,書寫并查尋"
show "WriteContinued", "書寫并查尋"
show "WriteReturn", "返回正常姿勢"
ShowLoop "Writing", "書寫(循環的動畫)"


actions=Array("Acknowledge","Alert","Announce","Blink","Confused","Congratulate","Congratulate_2","Decline","DoMagic1","DoMagic2","DontRecognize","Explain","GestureDown","GestureLeft","GestureRight","GestureUp","GetAttention","GetAttentionContinued","GetAttentionReturn","Hide","Idle1_1","Idle1_2","Idle1_3","Idle1_4","Idle2_1","Idle2_2","Idle3_1","LookDown","LookDownBlink","LookDownReturn","LookLeft","LookLeftBlink","LookLeftReturn","LookRight","LookRightBlink","LookRightReturn","LookUp","LookUpBlink","LookUpReturn","MoveDown","MoveLeft","MoveRight","MoveUp","Pleased","Process","Read","ReadContinued","ReadReturn","RestPose","Sad","Search","Show","StartListening","StopListening","Suggest","Surprised","Think","Uncertain","Wave","Write","WriteContinued","WriteReturn")

'順序表演
for each action in actions
Set objRequest = objCharacter.Play(action)
Do While objRequest.Status > 0
WScript.Sleep 100
Loop
next

'隨機表演
do
Randomize
i=Int((UBound(actions) + 1) * Rnd)
action = actions(i)
Set objRequest = objCharacter.Play(action)
Do While objRequest.Status > 0
WScript.Sleep 100
Loop
loop

Do
WScript.Sleep 1000
Loop Until ScriptComplete


Function GetTimeOfDay()
h = Hour(Now)
If h < 12 Then
TimeOfDay = "Morning"
ElseIf h < 18 Then
TimeOfDay = "Afternoon"
Else
TimeOfDay = "Evening"
End If
GetTimeOfDay = TimeOfDay
End Function

Sub Show(action,prompt)
objCharacter.Speak(action)
wsh.sleep 300
objCharacter.Think(prompt)
wsh.sleep 200
Set objRequest = objCharacter.Play(action)
Do While objRequest.Status > 0
WScript.Sleep 100
Loop
end sub

Sub ShowLoop(action,prompt)
objCharacter.Speak(action)
objCharacter.Think(prompt)
objCharacter.Play(action)
wsh.sleep 5000
objCharacter.stop
end sub

Sub agent_dblclick(ByVal CharacterID, ByVal Button, ByVal Shift, ByVal X, ByVal Y)
if MsgBox("確定要退出嗎?",33,"確認退出")-2 then
objCharacter.StopAll
WScript.Quit
end if
End Sub

Sub agent_DragStart(ByVal CharacterID, ByVal Button, ByVal Shift, ByVal X, ByVal Y)
objCharacter.Speak("Shit! Don't drag me!")
wsh.sleep 5000
End Sub


其實我們調用了系統里的MsAgent組件。Microsoft Agent是微軟公司發布的一項代理軟件開發技術,我們知道,在Office幫助系統中有一種叫作Office助手的代理軟件,但其只允許Office各個組件調用。而Agent動畫人物可由任何Windows程序調用;Agent支持文字氣球和輸入提示條,在輸出語音的同時把文字輸出至一個卡通式文字氣球中。如果電腦系統中安裝有Agent語音識別引擎,用戶可以通過聲卡、麥克風與MsAgent交談。

感謝你能夠認真閱讀完這篇文章,希望小編分享的“vbs中如何通過MsAgent組件實現微軟精靈”這篇文章對大家有幫助,同時也希望大家多多支持億速云,關注億速云行業資訊頻道,更多相關知識等著你來學習!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

溧水县| 灵山县| 新野县| 雷波县| 城步| 石家庄市| 正蓝旗| 澳门| 华安县| 喜德县| 南城县| 定远县| 元朗区| 察隅县| 绍兴市| 瑞丽市| 太谷县| 奎屯市| 大竹县| 东辽县| 孟津县| 北京市| 将乐县| 鲁甸县| 九龙城区| 拜泉县| 邵武市| 安仁县| 江津市| 万山特区| 彰化县| 德令哈市| 赤峰市| 灵寿县| 金坛市| 阿荣旗| 梅河口市| 漳州市| 永和县| 万源市| 菏泽市|