Application of Microsoft Agent Technology in Delphi

zhaozj2021-02-08  215

PLA Hefei Arts

Zhang Jianjun

China Bao Financial Insurance Anhui Tongling Branch

Han Ying

---- Microsoft Agent is a proxy software development technology issued by Microsoft in September 1997, and later integrated into Internet Explorer 4.0 Plus and later, the current version is 2.0, support Simplified Chinese. As a software agent tool, Agent has a very interactive manner interactive manner composed of menus, buttons, prompt boxes, etc., with its powerful interaction, distinctive human characteristics, beautiful operation interface and simple unified programming method. Big influence, with broad application prospects in multimedia creations, web applications, education software, software help systems and auxiliary tools.

I. Brief introduction to Microsoft Agent Technology

---- Agent's meaning is "agent", so the name, the main role of such agency software is to provide an operational interface that is easy to understand and use, accepts the user's instructions, instead of the user to complete some of the complexity Cumbersome work or help users. Scientific research shows that from the perspective of human machine engineering, more user-friendly colors are given to computers or programs, such as support speech synthesis output information, speech recognition input instructions, smart tips, animation, etc., can fully improve the effectiveness of human-machine interaction and Easy to use.

---- We know that there is a proxy software called Office Assistant in the Office 97 help system, with humorous animated characters, such as "big eye holder", can propose some depending on the user's operation step "intelligent" Suggestions or help information. Compared with the Office assistant, the Agent function is more powerful and manifested in:

The Office Assistant is fully blocked with the background behind the traditional opaque rectangular window; the Agent animation character is a "alwaysontop" window, only the character part is partially blocked, the rest is transparent.

The Office Assistant only allows all component calls of Office 97, and the Agent animation characters can be called by any Windows program;

Agent supports text balloons and input prompts that output text to a cartoon text balloon while output speech. If the computer system is installed in the computer system, when the user presses the input key, such as the Scroll Lock button, an input command window appears below the Agent person, indicating that it is "listening" the user's voice command.

Agent provides animated characters such as Genie, Merlin, Bobby and Peedy, not only with beautiful and humorous movements, but also through sound cards, microphones and users.

Second, Microsoft Agent installation method

---- Agent is an ActiveX control, its server program (C: /Windows/msAgent/agentsvr.exe) runs on the WIN95 / 98 / NT operation platform, providing services for other calling agents. The client can be a use of applications developed by VB, C , Delphi, VFP, PB, or Visual Script, Java Script scripting language code in the HTML file.

Install the Agent core component Msagent.exe.

Install Lernout & Hauspie Truvoice Text-to-Speech Engine (complete English from text synthetic voice, current version only supports English) CGram.exe.

Install Microsoft Command and Control Speech Engine (providing voice recognition feature, current version only supports English) ActCNC.exe.

Agent animated character human data file. Agent supports a single-structure role file (.acs, role data and animation data exists in the same file), also supports separation structural role files (.acf, role data existing in .acf, animation data exists in .aca). Based on local hard drives and network applications can use .acs files, web-based HTML files will be automatically called when accessing in the browser, and is used to usage .acs files. ---- The above file can be downloaded from http://www.microsoft.com//workshop/imedia/agent/default.asp.

Third, Microsoft Agent programming points

---- 1, add agent control in Delphi

---- Select Menu Component in Delphi IDE, Import ActiveX Control - Select Microsoft Agent Control 2.0 (Version 2.0) in the list box under Import ActiveX, click Button Install - Click the button OK in the Install dialog. Click on the button yes in the Confirm dialog. Click the button OK in the dialog. At this point, the Agent control is added to the Delphi component board ActiveX page.

---- 2, adjust the Agent control in Delphi

---- (1) Creating Project1 in Delphi IDE (containing Form1), place the Agent1 on Form1 (Name property is MyAgent), button1.

---- (2) define the variable.

VAR

PEEDY: IAGENTCTLCHARACTEREX;

Request1, Request2: iAgentctLRequest;

---- (3) The main attributes, methods, events.

---- 1Characters attribute and load, unload method: initialize the Agent, load animation data, uninstall the animated characters

---- Request1: = myagent.characters.Load ('peedy', 'c: /windows/system/peedy.acs);

---- peedy: = myagent.characters.Character ('peedy');

---- Myagent.Characters.unload ('peedy');

---- 2SHOW and HIDE Method: Show, hide the Agent animation. The parameter FAST represents the movie character display, hidden speed. FAST is 0 indicates that Agent is flying, flying out, FAST is 1 means Agent directly, disappears, no animation process.

---- peedy.show (0);

---- Peedy.hide (1);

---- 3Stopall, STOP method: Stop all actions.

---- peedy.stopall ('');

---- Peedy.stop (Request);

---- 4Connected Property: Is Agent to connect to a Microsoft Agent server.

---- myagent.connected: = true;

--- 5Get_Height, Get_Width, SET_HEIGHT, SET_WIDTH Method: Get the height, width of the Agent animation character.

Agenet: = peedy.get_height;

AgentWidth: = peedy.get_width;

Peedy.set_height (Round (AgentHeight / 2);

Peedy.set_width; ---- 6MoveTo method: Parameters x, y indicates the coordinate of the Agent animation person moves, and the parameter speed represents the speed of movement.

---- peedy.moveto (Screen.width-peedy.get_width) Div 2, (Screen.height-peedy.get_height) Div 2, 2);

---- 7INTERRUPT method: Interrupt the animation of the specified role. In dozens of animation actions, there is a kind of action that is a kind of suffix "ING", such as "Processing", "Searching", "Reading", "Writing", once executed, you must by call another animated person's Interrupt Method can be interrupted. The role cannot be interrupted, otherwise it will result in an exception.

Request1: = Robby.play ('Reading');

Peedy.Iterrupt (Request1);

---- 8WAIT method: coordinate animation actions between multiple different animation characters, such as waiting for SRobby's current action execution, peedy does another action.

REQUEST1: = Robby.play ('read');

Peedy.wait (Request1);

Peedy.Play ('search');

---- ⑨Play method: Perform the specified animation action, parameter Animation is a constant, indicating the animation type. Agent provides dozens of predefined actions, just call these constants directly when developing software. The following is a brief introduction to some of the commonly used constants are for programming purposes only.

---- Action Type Chinese Invention Action Type Chinese Invention Action Type Chinese Invention

Acknowledge acknowledges that looktown looks down SAD sadness

Alert Warning LOOKDOWNBLINK looks down for blinking Search

Announce declares that lookup startlistening to listen to STARTLISTENING

BLINK blinking lookupblink looks down the blink of Wink stoplistening stop listening

Confused confused Lookleft to look left Suggest suggestion

Congratulate Congratulations to Lookleftblink to see the blink of an eye surprised to the left

Decline refuses to look at Think Thinking to Right

DONTRECognize does not admit that lookrightblink wink to the right WAVE waving

Explain Interpretation MoveDown Moves Write Writing

GESTUREDOWN downward movement moves up processing calculations ...

GESTUREUP Positions Moveright moves Reading to the right ...

GESTURELEFT moves to left moving search for left grapes ...

GESTURHT PLESED is pleased to write Writing writing ...

GetAttTent gets Note Read Read Greet

Greetings RESE Restore Initial State

Request: = peedy.play ('search'); ---- ⑩SPEAK method: Agent By calling the voice synthesis engine, supporting English speech synthesis output function, just enter the English string, Agent can speak through the sound card, speaker " ". The current version of Agent does not have to support Chinese speech synthetic function, so "can only play Chinese in the form of .WAV file. The Chinese sentence you want to say is pre-recorded in advance, stored in .wav form, call it in the program. The parameter text represents the text displayed in the text balloon, the parameter URL represents the path to the .wav file.

---- Peedy.Speak ('Hey, friends, you are good, now I will help you!', 'C: / New folder / Help.wav');

---- peedy.speak ('do you like my help? If so, please send me an email! Thank you!', '');

---- ⑾commands.add method: Add a custom voice recognition command for the agent in the Button1Click event, the parameter const name indicates the identity of the voice command, the parameter caption indicates that the command is displayed in the input command window, the parameter Voice indicates the command. Corresponding statement. When the user issues a voice command through the microphone, triggered the Command event of the Agent, so we can additionally write a process to complete the speech recognition.

Procedure TFORM1.BUTTON1CLICK (Sender: TOBJECT);

Begin

Peedy.commands.add ('delphi', 'Run

Delphi ',' Delphi ', True, True;

Peedy.commands.add ('Visual Basic', '

Run VB ',' VB ', TRUE, TRUE;

PEEDY.SHOW (0);

PEEDY.SPEAK ('What CAN I do for you, sir?', '');

END;

---- ⑷, press F9 to run the program. The above programs were debugged in Delphi3.0 / 4.0, Windows95 / 98 / NT Simplified Chinese version.

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

New Post(0)