Analysis of Agent Plugins

xiaoxiao2021-03-06  49

Agent plugin uses Office XP, Jinshan Taxi and Rising anti-virus software, will definitely impress the humanized animation role in the program, which is completely attributed to the Agent ("Agent") technology launched by Microsoft, Agent With COM technology, use the ActiveX control method to support the current popular development tools, not only you can read it aloud, but also recognize the user's voice command, which is widely used in the application and HTML files.

Below we use PowerBuilder 8.0 to develop a small utility, step by step to implement its implementation:

The first step download Agent plugin from the Internet and is installed on the computer, which is the early preparation work for development:

These plugins are derived from Microsoft's website, downloaded URLs: http://www.microsoft.com/msagent/downloads/User.asp, connection to use this page:

1. First click on "Download The Microsoft Agent Core Componts" download and install the core component of the Agent, which is named "Msagent.exe".

2, followed (first select "Simplified Chinese (127kb EXE)") download and install the language component, which is named "AGTX0804.exe".

3, followed (first select "LERNOUT & HAUSPIE TRUVOICE TTS Engine - American English (1MB EXE)") download and install the TTS engine, the file name is "TV_enua.exe", to achieve voice reading, must be installed, current version Support English.

4, then click (first select "DoadLoad The Microsoft Speech Recognition Engine (6MB EXE)") Download and install the voice recognition engine, the file name is "actcnc.exe", to implement voice command identification, must be installed, current version Support English.

5, finally click "Download SELECTED Character" to download the animation role file you want to use, here we download the animation role file provided by Microsoft website, mainly including Genie (Monsters, Ghost), Robby (Robot), Merlin, PEEDY (pajamas) has four animation roles, which not only have rich behavior, and has language functions, and their corresponding file names are Genie.ACS, Robby.acs, Merlin.acs, Peedy.ACS. Common animation actions for these Agent characters, usually identified with English word characters containing the same meaning, as shown in the following table, the following program example demonstrates their respective action effects.

Constant related action

Acknowledge shows a acknowledgment, thank you

Alert shows the action of warning

Announce shows that the work of the announcement

Blink shows the blinking action

Decline Shows the action of shaking head refused

Domagic1, Domagic2 Displays the action of the command performance

Confused showed confusing action

CONGRATE shows the action of congratulations

DONTRECognize Displays unrecognized action

Explain shows the action of the explanation

GESTTUREDOWN shows the direction of the direction

GESTTURELEFT shows gesture action in the left direction

GestTureright shows the gesture action in the right direction

GESTTUREUP Shows the direction of the direction of gesture, GetAttTent, showing the positive action

GetAtTentionContinued Display Continued Puzzle Action

GetAttentionReturn display continues to work with

Greet shows the action of greetings

Hearing_1

Hearing_2 shows the action listening to the left and right

Hearing_3

Hide hides animation role

IDLE1_1 shows the action of stretching

IDLE1_2 displays the movement to the left

IDLE1_3 displays the action to right

IDLE1_4 shows the movement of backward

IDLE1_5 displays a moving action forward

IDLE2_1 shows the action with headphones listening to music

Idle2_2 shows the action of eating biscuits

IDLE3_1 shows the action with headphones listening to music

IDLE3_2 shows sleeping action

IDLE3_3 shows the action with headphones listening to music

LookDown Shows the action viewed

LOOKDOWNBLINK shows the movement of the blink of an eye

LOOKDOWNLEFT Displays the action to view the lower left

LOOKDOWNLEFTBLINK displays an eye on the left?

LOOKDOWNLEFTRETURN Shows the action to return to the lower left

LookDownRight shows the action viewed to the bottom right

LOOKDOWNRIGHTBLINK shows the movement of the blink of an eye

LOOKDOWNRIGHTRETURN The action viewed back to the bottom right

LOOKDOWNRETURN The action that viewed back to the next view

Lookleft shows the action viewed to the left

Lookleftblink shows the movement of the left

Lookleftreturn Show back to the left to view the action

LOOKRIGHT Displays the action viewed to the right

LOOKRIGHTBLINK shows the movement of the right side

LOOKRIGHTRETURN The action viewed back to the right

Lookup Shows the action viewed

Lookuppblink shows the moving action

LOOKUPLEFT displays actions to view the top left

LookupleFTBLINK shows the movement of olocketing to the top left

LOOKUPLEFTRETURN Shows the action to return to the top left

LookUpright displays the action to view to the top right

LookuprightBlink shows the movement to the top right

LookUprightreturn Show back to return to the top right

LOOKUPRETURN The action that viewed backwards

MoveDown displays the movement movement

Moveleft display moves to left movement

Moveright displays the action moving to the right

MoveUp Displays the action of moving up

Pleaseed showing a happy action

Process display the action of processing work

Processing Displays the action that is working

Read display actions

ReadContinued Displays the action that continues reading

Reading displays the action being reading

Readreturn displays the action stopped

SAD shows sad action

Search Shows the action

Searching shows the action being found

SHOW Displays animation role

STARTLISTENING shows the action that starts listening

Stoplistening Displays the action that stops listening

Suggest Shows Suggestive Action

Surprised shows an amazing expression

Think shows the expression of thinking

Thinking shows the expression that is thinking

Uncertain displays uncertain action

Wave shows a payment action

Write displayed actions

WriteContinued Display Continued Writing Writing Displays the action written

Writreturn displays the action stopped

Of course, we can also click "Download the" from 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 the production tool, personally make your own animation character image.

Second step design application

The OLE control is available in PowerBuilder so that the PowerBuilder application can use the COM components and ActiveX controls written by other development tools.

In the use of related COM components and ActiveX controls, you must register related COM components and ActiveX controls, register control at Powerbuilder, can be in Powerbulider

In the development environment, when inserting the OLE control, select Regisiter New to register.

The main properties of the Agent control are as follows:

Attribute use

Charactors is used to set animation role files associated with the control

Connected is used to discriminate whether the control is connected to the Agent server

LanguageID is used to set the language used by the Agent, which is currently only set to "409", "& H409"

The main ways for the Agent control are as follows:

Method use

LOAD is used to initialize the Agent control, and load the animation role data file

Unload used to unload animation role data files

SHOW is used to display the Agent animation role, and can control the display speed of the animation role via parameters.

Hide is used to hide the Agent animation role and can control the hidden speed of the animation role through parameters

StopAll is used to stop all the actions of the animation role

STOP is used to stop the current action of the animation role

MoveTo is used to move the animation role, which can set the moving coordinates and moving speeds through the parameters.

Interrupt is used to interrupt animation roles, when doing some sustained animation, if not

Interrupting the action is to perform the next action, it will generate an exception

WAIT is used to achieve mutual action coordination between multiple animation roles

Play is used to perform the specified animation action, which can set the movie type by parameter.

Speak is used to achieve English speech synthesis output function through a speech synthesis engine, ie only input

English string, Agent can pass the sound output device "speak"

The main events of the Agent control are as follows

Event use

Show triggers when the Agent animation role is displayed, and the main interface of the program can be used to hide the main interface of the program.

Hide triggers when the Agent animation role is hidden, and the event can be re-displays the main interface of the program.

The steps implemented in PowerBuilder are as follows

1. Create a work area for Myexample.pbw;

2. New Myexample.pbt application target, PowerBuilder automatically creates a PBL library file to store the relevant PowerBuilder object and create a MyExample

Application object;

3. New window objects w_example, and place the controls in the table:

Control control name

Listbox lb_1

CommandButton CB_1

CommandButton CB_2

OLE Control OLE_1 (and inserted into the corresponding Agent ActiveX control)

4. New menu object m_file and add related menu items as follows:

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. Set the MENUID property of the window object w_example to m_file

6. Define the instance variables of the window w_example as follows:

Privite:

Boolean ib_flag

String is_animationname

7. Write a window w_example related event script:

The OPEN event script is as follows:

Long RESULT, LL

If FileExists () "/ peedy.acs") = false kil

Result = MessageBox ("Tip", "No Animation Role File in the current directory", 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

Custom Event UE_FILEOPEN's script is as follows:

String Docname, Named

Integer Value

Value = GetFileOpenName ("Select Animation Role File", DocName, Named, "ACS", "Animation 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

Custom event UE_FILEEXIT's script is as follows:

Close (this)

The Clicked event script of LB_1 is as follows:

CB_1.enabled = true

The DoubleClicked event script of lb_1 is as follows:

CB_1.triggerevent ("clicked")

The GetFocus events of LB_1 are as follows:

Cb_1.default = true

CB_1 Clicked event script is as follows:

OLE_1. O B J E C T.Characters ("CharacterID"). STOP

THIS.TITLE = "Demonstrate Animation Action:" LB_1.SelectedItem ()

OLE_1. O B J E C T.Characters ("CharacterID"). Play (lb_1.selectededItem ())

The CB_2 Clicked event script is as follows:

OLE_1. O B J E C T.Characters ("CharacterID"). STOP ()

8. Writing Application object Open event scripts is as follows:

Open (w_example)

转载请注明原文地址:https://www.9cbs.com/read-115530.html

New Post(0)