Script MSAgent Components The Microsoft Wizard pulled out the system with its own pet _vbs

Source: Internet
Author: User
Tags sleep
Copy Code code 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
' Objcharacter.languageid = &h804 ' menu is Chinese, but Microsoft does not develop Chinese voice

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'll show for you!")
Wsh.sleep 10000

' Side performance Side Show
Show "Acknowledge", "nod"
Show "Alert", "straighten and raise your eyebrows."
Show "Announce", "Raise your horn and play"
Show "Blink", "Blink"
Show "confused", "scratching his head"
Show "congratulate", "Display the prizes"
Show "congratulate_2", "Applause"
Show "Decline", "Raise your hands and shake your head."
Show "DoMagic1", "Raise the Magic Wand"
Show "DoMagic2", "put down the Magic stick, appear the Clouds"
Show "Dontrecognize", "Cover Your Ears"
Show "Explain", "Spread your arms to both sides."
Show "Gesturedown", "downward gesture"
Show "Gestureleft", "gesture to the left"
Show "Gestureright", "gesture to the right"
Show "Gestureup", "gestures up."
Show "Getattention", "Lean forward and tap"
Show "getattentioncontinued", "lean forward and tap again"
Show "Getattentionreturn", "return to normal posture"
Showloop "hearing_1", "ear elongation (circular animation)"
Showloop "Hearing_2", "head to left (looping animation)"
Showloop "Hearing_3", "head to left (circular animation)"
Showloop "Hearing_4", "head to the right (circular animation)"
Show "Hide", "disappear under the hat."
Show "Idle1_1", "Catch your breath."
Show "Idle1_2", "look to the left and blink."
Show "Idle1_3", "look to the right"
Show "Idle1_4", "look from top to right and blink"
Show "Idle2_1", "Look at the magic wand and blink."
Show "Idle2_2", "Shake Hands and Blink"
Show "Idle3_1", "yawning"
Showloop "Idle3_2", "Sleep (looping animation)"
Show "Lookdown", "Look Down"
Show "Lookdownblink", "Blink down."
Show "Lookdownreturn", "return to normal posture"
Show "Lookleft", "look to the left"
Show "Lookleftblink", "Blink to the Left"
Show "Lookleftreturn", "return to normal posture"
Show "Lookright", "look to the right"
Show "Lookrightblink", "Blink to the right."
Show "Lookrightreturn", "return to normal posture"
Show "LookUp", "Look Up"
Show "Lookupblink", "Blink up."
Show "Lookupreturn", "return to normal posture"
Show "MoveDown", "Flying Down"
Show "MoveLeft", "fly to the left."
Show "MoveRight", "Fly Right"
Show "MoveUp", "Flying Up"
Show "pleased", "smile and put your hands together"
Show "Process", "Stir Cauldron"
Showloop "Processing", "stirring the Cauldron (circular animation)"
Show "read", "Open the book, read and search"
Show "readcontinued", "Read and search"
Show "Readreturn", "return to normal posture"
Showloop "Reading", "Reading (looping animation)"
Show "Restpose", "normal posture"
Show "sad", "sad expression"
Show "Search", "Watch the crystal Ball"
Showloop "Searching", "observe the crystal Ball (circular animation)"
"Show", "appearing from the Hat."
Show "Startlistening", "Hand to ear"
Show "Stoplistening", "Hand over ear"
Show "Suggest", "Display light bulb"
Show "surprised", "look surprised"
Show "Think", "Hold your chin up with your hands."
Showloop "thinking", "Hold your chin up and look up (looping animation)"
Show "uncertain", "lean forward and raise your eyebrows."
Show "Wave", "waving"
Show "Write", "open book, Write and Search"
Show "writecontinued", "Write and search"
Show "Writereturn", "return to normal posture"
Showloop "Writing", "writing (looping animation)"


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 "," I "," uncertain "," Wave "," Write "," Writecontinued "," Writereturn ")

' Sequential performance
For the action in actions
Set objrequest = Objcharacter.play (action)
Do While objRequest.Status > 0
Wscript.Sleep 100
Loop
Next

' Random Show
Todo
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

Todo
Wscript.Sleep 1000
Loop Until Scriptcomplete


Function Gettimeofday ()
H = Hour (now)
If H < Then
TimeOfDay = "Morning"
ElseIf H < 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 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, and we know that there is a proxy software called the Office Assistant in the Office Help system, but it only allows Office components to be invoked. The agent animated characters can be invoked by any Windows program; the agent supports text balloons and input prompts, outputting the text to a cartoon text balloon while outputting the speech. If the agent speech recognition engine is installed in the computer system, the user can talk to msagent through the sound card and microphone.

Introduction MSAgent's post has already, here again use MSAgent, give this fun script, chat with active atmosphere, to attract everyone to the VBS interest, I hope we actively post

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.