Analysis of Agent Plugin

Source: Internet
Author: User
Tags continue interface ole reset version microsoft website
Analysis of Agent Plugin
The use of Office XP, Jinshan poison PA and rising anti-virus software friends, will certainly be in the program of human animated characters impressed, this is entirely due to the introduction of Microsoft Agent ("Agent") technology, the agent using COM technology, using ActiveX control methods, Support the current popular development tools, not only to achieve the text reading aloud, but also to identify the user's voice commands, in the application and HTML files are widely used.
Below we use PowerBuilder 8.0 as a development tool to develop a small utility, step-by-step description of its implementation methods:
The first step is to download the agent plug-in from the Internet and install it on your computer, which is a preliminary preparation for development:
These plug-ins are from Microsoft Company's related website, download the URL is: http://www.microsoft.com/msagent/downloads/user.asp, the connection uses this webpage:
1, first click "Download the Microsoft Agent core componts (395kbs exe)" To download and install the Agent's core components, its file name is "Msagent.exe."
2, Next click (select "Simplified Chinese (127kb exe)") Download and install the language component, its file name is "AgtX0804.exe".
3, Second click (First select "Lernout & Hauspie TruVoice TTS engine-american 中文版 (1Mb exe)") Download and install the TTS engine with the file name "Tv_enua.exe" to enable speech reading , must be installed, the current version supports English.
4, then second click (First select "Doadload the Microsoft Speech recognition Engine (6Mb exe)") Download and install the speech recognition engine, its file name is "Actcnc.exe", to achieve voice command recognition, must be installed, The current version supports English.
5, finally click the "Download selected character" Download installation to use the animated role file, where we download the Microsoft website provided by the animation role files, including Genie (Monsters, Ghosts), Robby (robot), Merlin, Peedy (Pajamas) A total of four kinds of animated characters, they not only have a wealth of behavioral action, but also has the language function, its corresponding filename is Genie.acs, Robby.acs, Merlin.acs, Peedy.acs. The common animated actions of these agent roles are usually identified with the same meaning as the English word characters, as shown in the following table, which demonstrates the action effects they produce respectively.
Constant-related actions
Acknowledge show recognition, appreciation of the action
Alert displays a warning action
Announce shows the work of announcing and informing.
Blink shows the Blink action
Decline shows the action of rejecting the shaking head
DoMagic1, DoMagic2 show the movement of the conductor
Confused show the action of confusion
Congratulate show congratulations on the action
Dontrecognize Show Unrecognized action
Explain shows the action of the explanation
Gestturedown show the downward direction gesture action
Gesttureleft display gestures to the left direction
Gesttureright display gesture action in the right direction
Gesttureup display the upward direction gesture action
Getattention show attention to the action
Getattentioncontinued shows the move to attention.
Getattentionreturn shows the move to attention.
Greet shows the greeting action
Hearing_1
Hearing_2 show left and right listening action
Hearing_3
Hide Hidden animation role
Idle1_1 Show stretch of action
Idle1_2 display to left-leaning action
Idle1_3 shows the movement to the right.
Idle1_4 Show backward leaning action
Idle1_5 Show forward tilting action
Idle2_1 shows the action of listening to music with headphones
Idle2_2 shows the action of eating cookies.
Idle3_1 shows the action of listening to music with headphones
Idle3_2 shows sleepy movements.
Idle3_3 shows the action of listening to music with headphones
Lookdown Show down-view action
Lookdownblink shows the action of blinking down
Lookdownleft shows the action to the left and bottom view
Lookdownleftblink show blink of an eye to the left
Lookdownleftreturn show return to bottom left view action
Lookdownright shows the action below the right view
Lookdownrightblink shows blink of an eye right below
Lookdownrightreturn Show returns to the bottom right view action
Lookdownreturn Show returns to the bottom view of the action
Lookleft shows the action to the left view
Lookleftblink shows the blink of an eye to the left
Lookleftreturn Show returns to the left to view the action
Lookright shows the action to the right view
Lookrightblink shows the blink of an eye to the right.
Lookrightreturn shows returns to the right view of the action
LookUp shows actions to view up
Lookupblink shows the action of blinking up
Lookupleft shows the actions viewed above the left
Lookupleftblink shows blinking in the top left
Lookupleftreturn show return to the top left view action
Lookupright shows the action viewed above the right
Lookuprightblink shows the blinking action above the right
Lookuprightreturn Show return to right view of action
Lookupreturn Show returns to the top view of the action
MoveDown Show moves down
MoveLeft show moves to the left
MoveRight Show moves to the right
MoveUp Show Moves up
Pleaseed shows happy moves.
The process shows the actions of the processing work
Processing shows the action being processed
Read shows the action of reading
Readcontinued shows the action to continue reading
Reading shows the action being read
Readreturn Show stop reading action
Sad shows the action of sadness
Search displays the action of the lookup
Searching displays the action you are looking for
Show animated characters
Startlistening shows the action to start listening
Stoplistening Show stop listening to action
Suggest show suggested actions
Surprised shows a look of surprise
Think to show the look of thought
Thinking shows the expression that is thinking
Uncertain shows an indeterminate action.
Wave shows the gesture of greeting
Write shows the written action
Writecontinued shows the action to continue writing
Writing shows the action being written
Writreturn Show Stop Write action
Of course, we can also click "Download" from the http://www.microsoft.com/msagent/downloads/developer.asp page.
Microsoft Agent Character Editor (1Mb exe) "and" Download the Microsoft Agent linguistic information
Sound Editing Tool (6.2Mb exe) "Download production tools, personally create their favorite animated character image."
The second step is to design the application
OLE controls are provided in PowerBuilder so that powerbuilder applications can use COM components and ActiveX controls written by other development tools
Before using the related COM components and ActiveX controls, you must register the associated COM components and ActiveX controls, register the controls in the PowerBuilder, and you can Powerbulider
Development environment, when you insert an OLE control, select Regisiter New to register.
The main properties of the agent control are the following table:
Property Purpose
Charactors used to set the animated role file associated with the control
Connected is used to determine whether a control is connected to the agent server
LanguageID is used to set the language used by the agent and can only be set to 16 "409", or "&h409"
The main methods of the agent control are the following table:
Method use
Load is used to initialize the agent control and load the animated role data file
UnLoad used to uninstall animation role data files
Show the agent animation role used for display, and can control the display speed of the animation role through parameters
Hide is used for hidden agent animation roles and can control the hidden speed of animation roles through parameters
StopAll all actions to stop an animated character
Stop the current action that stops an animated role
MoveTo is used to move an animated character, and you can set the moving coordinates and the speed of movement by using parameters
Interrupt the animation that interrupts the animated character, when performing some persistent animation actions, such as not
To interrupt the action is to perform the next action, resulting in an abnormal behavior
Wait is used to coordinate action between multiple animation roles
Play is used to perform the specified animation action, which can be set by using parameters to animate the type
Speak is used to achieve the speech synthesis output function of English through speech synthesis engine, that is, only need to input
English string, the agent can "speak" through the sound output device
The main events for the agent control are the following table
Event use
Show triggers when the agent animation role is displayed, which can be used to hide the program's main interface
Hide triggers when the agent animation role is hidden, which can be used to display the program's main interface again
The steps to implement in PowerBuilder are as follows
1, the new MYEXAMPLE.PBW work area;
2, the new MYEXAMPLE.PBT application target, PowerBuilder will automatically create a PBL library file to store the relevant PowerBuilder objects, and create a myexample
The Application object;
3, create a new Window object w_example, and put the control on it as follows table:
Control Control Name
ListBox lb_1
CommandButton cb_1
CommandButton cb_2
OLE control Ole_1 (and inserting the corresponding agent ActiveX controls)
4, new Menu Object M_file, and add the relevant menu items as follows table:
Menu Name Menu Text Menu script
M_file file (&f)
M_fileopen Open (&o) parentwindow.triggerevent ("Ue_fileopen")
M_BAR1-
M_fileexit exit (&e) parentwindow.triggerevent ("Ue_fileexit")
5, the Window object W_example MenuID property set to M_file
6, the definition window W_example instance variables are as follows:
Privite:
Boolean Ib_flag
String Is_animationname
7, write the window W_example related event script:
The Open event script is as follows:
Long Result,ll
If FileExists (getcurrentdirectory () + "\peedy.acs") =false Then
Result=messagebox ("Hint", "no animated role file in the current directory of the program", stop!)
Ib_flag=false
Close (This)
Else
Ib_flag=true
Ole_1. O B J E C t.characters.load ("Characterid", getcurrentdirectory () + "\peedy.acs")
Ole_1. O B J E C t.characters ("Characterid"). languageid=1033
Ole_1. O B J E C t.characters ("Characterid"). MoveTo (20,20)
Ole_1. O B J E C t.characters ("Characterid"). Show ()
Ole_1. O B J E C t.characters ("Characterid"). Play ("Wave")
Ole_1. O B J E C t.characters ("Characterid"). Speak ("Hello,welcome to use the Character Animation, Previewer programm!")
Ole_1. O B J E C t.characters ("Characterid"). Play ("Reading")
Lb_1.reset ()
For ll=1 to Upperbound (ole_1. O B J E C t.characters ("Characterid"). Animationnames)
Lb_1.additem (ole_1. O B J E C t.characters ("Characterid"). Animationnames[ll])
Next
Lb_1.selectitem (1)
The Close event script is as follows:
If Ib_flag=true Then
Ole_1. O B J E C t.characters ("Characterid"). Hide ()
Ole_1. O B J E C t.characters.unload ("Characterid")
End If
The script for custom event Ue_fileopen is as follows:
String DocName, named
Integer value
Value = Getfileopenname ("Select animated role File", DocName, named, "ACS", "Animated role file (*.acs), *.acs")
IF value = 1 THEN
Ole_1. O B J E C t.characters.unload ("Characterid")
Ole_1. O B J E C t.characters.load ("Characterid", DocName)
Ole_1. O B J E C t.characters ("Characterid"). languageid=1033
Ole_1. O B J E C t.characters ("Characterid"). MoveTo (20,20)
Ole_1. O B J E C t.characters ("Characterid"). Show ()
Ole_1. O B J E C t.characters ("Characterid"). Speak ("hello!")
Ole_1. O B J E C t.characters ("Characterid"). Play ("congratulate")
Ole_1. O B J E C t.characters ("Characterid"). Play ("Wave")
Cb_1.enabled=false
Lb_1.reset ()
For ll=1 to Upperbound (ole_1. O B J E C t.characters ("Characterid"). Animationnames)
Lb_1.additem (ole_1. O B J E C t.characters ("Characterid"). Animationnames[ll])
Next
Lb_1.selectitem (1)
Ole_1. O B J E C t.characters ("Characterid"). MoveTo (0,0)
Lb_1.setfocus ()
End If
The script for custom event Ue_fileexit is as follows:
Close (This)
The Lb_1 clicked Event script is as follows:
Cb_1.enabled=true
The Lb_1 doubleclicked event script is as follows:
Cb_1.triggerevent ("clicked")
The Lb_1 GetFocus events are as follows:
Cb_1.default=true
The Cb_1 clicked Event script is as follows:
Ole_1. O B J E C t.characters ("Characterid"). Stop
This.title= "Demo Animation role Action:" +lb_1.selecteditem ()
Ole_1. O B J E C t.characters ("Characterid"). Play (Lb_1.selecteditem ())
The cb_2 clicked Event script is as follows:
Ole_1. O B J E C t.characters ("Characterid"). Stop ()
8, write the Application object Open event script is as follows:
Open (W_example)

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.