Script MsAgent component Microsoft genie pulls out the pets that come with the System

Source: Internet
Author: User

Copy codeThe Code is as follows: '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
The 'objcharacter. LanguageID = & H804 'menu is in Chinese, but Microsoft has not developed a Chinese speech.

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 while explaining
Show "Acknowledge", "nod"
Show "Alert", "Straighten and raise your eyebrows"
Show "Announce", "raise your horn and play"
Show "Blink", "blinking"
Show "Confused", "scratching your head"
Show "Congratulate", "show prizes"
Show "Congratulate_2", "applaud"
Show "Decline", "raise your hand and shake your head"
Show "DoMagic1", "raise the Magic Stick"
Show "DoMagic2", "Put down the magic stick and show the clouds"
Show "DontRecognize", "cover your ears"
Show "Explain", "show both sides"
Show "GestureDown", "downward gesture"
Show "GestureLeft", "gesture to the left"
Show "GestureRight", "gesture to the right"
Show "GestureUp", "upward gesture"
Show "GetAttention", "leaning forward and hitting"
Show "GetAttentionContinued", "leaning forward and hitting again"
Show "GetAttentionReturn", "Return normal posture"
ShowLoop "Hearing_1", "ear stretch (loop animation )"
ShowLoop "Hearing_2", "head tilting left (loop animation )"
ShowLoop "Hearing_3", "Turn left (loop animation )"
ShowLoop "Hearing_4", "Turn right (loop animation )"
Show "Hide", "disappears under hats"
Show "Idle1_1", "breathe"
Show "Idle1_2", "Looking left and blinking"
Show "Idle1_3", "Right view"
Show "Idle1_4", "From top to right and blinking"
Show "Idle2_1", "Look at the Magic Stick and blink"
Show "Idle2_2", "handshaking and blinking"
Show "Idle3_1", "yawning"
ShowLoop "Idle3_2", "Sleep (loop animation )"
Show "LookDown", "Look down"
Show "LookDownBlink", "blinking down"
Show "LookDownReturn", "Return normal posture"
Show "LookLeft", "Look left"
Show "LookLeftBlink", "blinking to the left"
Show "LookLeftReturn", "Return normal posture"
Show "LookRight", "Right view"
Show "LookRightBlink", "blinking right"
Show "LookRightReturn", "Return normal posture"
Show "LookUp", "Look up"
Show "LookUpBlink", "blinking up"
Show "LookUpReturn", "return to normal posture"
Show "MoveDown", "flying down"
Show "MoveLeft", "Fly left"
Show "MoveRight", "Fly Right"
Show "MoveUp", "Fly up"
Show "Pleased", "smile and put your hands together"
Show "Process", "Stir pot"
ShowLoop "Processing", "stirring pot (loop animation )"
Show "Read", "open a book, Read and search"
Show "ReadContinued", "Read and search"
Show "ReadReturn", "Return normal posture"
ShowLoop "Reading", "Reading (loop animation )"
Show "RestPose", "normal posture"
Show "Sad", "Sad expressions"
Show "Search", "Watch the crystal ball"
ShowLoop "Searching", "observing the crystal ball (loop animation )"
Show "Show", "show from hats"
Show "StartListening", "Hand to ears"
Show "StopListening", "cover your ears with your hands"
Show "Suggest", "light bulb display"
Show "Surprised", "Surprised"
Show "Think", "Hold your chin in your hand and look up"
ShowLoop "Thinking", "holding your chin up with your hand (loop animation )"
Show "Uncertain", "leaning forward and raising your eyebrows"
Show "Wave", "Swing"
Show "Write", "open a book, Write and search"
Show "WriteContinued", "write and search"
Show "WriteReturn", "Return normal posture"
ShowLoop "Writing", "Writing (loop animation )"

Actions = Array ("Acknowledge", "Alert", "Announce", "Blink", "Confused", "Congratulate", "Congratulate_2", "Decline", "DoMagic1 ", "DoMagic2", "DontRecognize", "Explain", "GestureDown", "GestureLeft", "GestureRight", "GestureUp", "GetAttention", "success", "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 ")

'Ordered performances
For each action in actions
Set objRequest = objCharacter. Play (action)
Do While objRequest. Status> 0
WScript. Sleep 100
Loop
Next

'Random performer
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 ("are you sure you want to exit? ", 33," confirm to exit ")-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

In fact, we call the MsAgent component in the system. Microsoft Agent is an Agent software development Technology released by Microsoft. We know that there is an Agent software called Office assistant in the Office help system, but it can only be called by Office components. The Agent animation character can be called by any Windows program. The Agent supports text balloons and input prompts, and outputs text to a cartoon text balloon while outputting speech. If an Agent speech recognition engine is installed in the computer system, you can use the sound card and microphone to communicate with the MsAgent.

The post about MsAgent already exists. Here, we use MsAgent again to give this fun script, chat in an active atmosphere, and draw everyone's interest in vbs. I hope you will post it actively.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.