我的编程空间,编程开发者的网络收藏夹
学习永远不晚

vbs中如何通过MsAgent组件实现微软精灵

短信预约 -IT技能 免费直播动态提醒
省份

北京

  • 北京
  • 上海
  • 天津
  • 重庆
  • 河北
  • 山东
  • 辽宁
  • 黑龙江
  • 吉林
  • 甘肃
  • 青海
  • 河南
  • 江苏
  • 湖北
  • 湖南
  • 江西
  • 浙江
  • 广东
  • 云南
  • 福建
  • 海南
  • 山西
  • 四川
  • 陕西
  • 贵州
  • 安徽
  • 广西
  • 内蒙
  • 西藏
  • 新疆
  • 宁夏
  • 兵团
手机号立即预约

请填写图片验证码后获取短信验证码

看不清楚,换张图片

免费获取短信验证码

vbs中如何通过MsAgent组件实现微软精灵

这篇文章主要介绍了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组件实现微软精灵”这篇文章对大家有帮助,同时也希望大家多多支持编程网,关注编程网行业资讯频道,更多相关知识等着你来学习!

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

vbs中如何通过MsAgent组件实现微软精灵

下载Word文档到电脑,方便收藏和打印~

下载Word文档

猜你喜欢

vbs中如何通过MsAgent组件实现微软精灵

这篇文章主要介绍了vbs中如何通过MsAgent组件实现微软精灵,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。代码如下:On Error Resume Next strAge
2023-06-08

JAVA如何通过使用数组遍历和if条件实现选择数据中的最大值

这篇文章给大家分享的是有关JAVA如何通过使用数组遍历和if条件实现选择数据中的最大值的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。前言:通过使用数组遍历和if条件实现选择数据中的最大值。/* 计算数组中的
2023-06-02

编程热搜

  • Python 学习之路 - Python
    一、安装Python34Windows在Python官网(https://www.python.org/downloads/)下载安装包并安装。Python的默认安装路径是:C:\Python34配置环境变量:【右键计算机】--》【属性】-
    Python 学习之路 - Python
  • chatgpt的中文全称是什么
    chatgpt的中文全称是生成型预训练变换模型。ChatGPT是什么ChatGPT是美国人工智能研究实验室OpenAI开发的一种全新聊天机器人模型,它能够通过学习和理解人类的语言来进行对话,还能根据聊天的上下文进行互动,并协助人类完成一系列
    chatgpt的中文全称是什么
  • C/C++中extern函数使用详解
  • C/C++可变参数的使用
    可变参数的使用方法远远不止以下几种,不过在C,C++中使用可变参数时要小心,在使用printf()等函数时传入的参数个数一定不能比前面的格式化字符串中的’%’符号个数少,否则会产生访问越界,运气不好的话还会导致程序崩溃
    C/C++可变参数的使用
  • css样式文件该放在哪里
  • php中数组下标必须是连续的吗
  • Python 3 教程
    Python 3 教程 Python 的 3.0 版本,常被称为 Python 3000,或简称 Py3k。相对于 Python 的早期版本,这是一个较大的升级。为了不带入过多的累赘,Python 3.0 在设计的时候没有考虑向下兼容。 Python
    Python 3 教程
  • Python pip包管理
    一、前言    在Python中, 安装第三方模块是通过 setuptools 这个工具完成的。 Python有两个封装了 setuptools的包管理工具: easy_install  和  pip , 目前官方推荐使用 pip。    
    Python pip包管理
  • ubuntu如何重新编译内核
  • 改善Java代码之慎用java动态编译

目录