Chapter 15: Fun with Multimedia


In Brief

If you're not having complete and utter fun yet, this chapter is for you. In this chapter, you will learn how to use simple scripts to play and control multimedia files. You will also learn how to script the Office Assistant and Microsoft Agent characters to interact with your users.

The Dreaded Office Assistant

Office assistants are animated characters designed to help and entertain users of Microsoft Office. These characters provide tips, accept natural language queries (such as "How do I hide the Office Assistant?"), and perform animations based on the actions of the user . In theory, these assistants sound like a good idea. However, soon after the release of these assistants with Office 97, a flood of complaints followed denouncing them. The main problem was the over-interaction of these assistants.

To turn on the Office Assistant, choose Help/Show the Office Assistant. Once the assistant is visible, right-click on it and choose Options. Under the Options tab, you can disable the Office Assistant by unchecking Use the Office Assistant. Under the Gallery tab, you can choose which assistant you want to use. The default assistant is called Clippit, a hyperactive paper clip that doesn't know when to be quiet.

The Office Assistant Object Model

The Office Assistant object model is a limited one. At the top of the model is the assistant object. An instance of the Office Assistant object model is created whenever an instance of an office application is created. Once the instance is created, you can make the assistant visible by setting the Visible property to True:

  officeapp.  Assistant. Visible - True 

Once the assistant is visible, you can move, resize, or animate the assistant:

  officeapp.  Assistant.Left - 500  officeapp.  Assistant.Top - 500 

Office assistants display messages to users through the Balloon object. You can use the NewBalloon property to create an instance of the Balloon object:

 Set  Balloon - officeapp.  Assistant.NewBalloon 

Once an instance of the Balloon object has been created, you can create text messages and check boxes, and then show these messages using the Show property:

  Balloon.  Heading - "Some Text Heading"  Balloon.  Text - "Some Body Text"  Balloon.  CheckBoxes(1). Text - "An example check box"  Balloon.  Show 
Tip  

If you have Microsoft Office 2000 with the VBA help files installed, the complete Office Assistant object model can be found in the file VBA0FF9.CHM.

Under Office 97, office assistants are stored in actor files, with an ACT (Actor) extension (typically located in C:/Program Files/Microsoft Office/Office). Office 2000 uses the Microsoft Agent ActiveX technology and stores its assistants in ACS (Agent Character) files, allowing for more animations and interaction with the user.

Microsoft Agent

Microsoft Agent, originally called Microsoft Interactive Agent, is an ActiveX technology that allows you to display and animate characters to interact with the computer user. Agent characters are cartoon-like animations stored in agent character (ACS) files. Each character contains its own set of animations and voice patterns. You can use Microsoft Agent within Microsoft Office, script files, Web pages, and applications.

The Microsoft Agent Support Files

In order to run Microsoft Agent, you need to download and install the following items:

  • Microsoft Agent core components ”These are the core components that allow you to access and control a Microsoft Agent character.

  • Microsoft Agent character files ”These are the agent characters you can use to interact with the computer user.

  • Text-to-speech engines ”These engines allow the Microsoft Agent characters to translate text to speech, giving these characters the ability to "speak."

You can obtain these components from the Microsoft Agent Web site, http://msdn.microsoft.com/workshop/imedia/agent/.

The Microsoft Agent Process

All agent character commands and requests are exposed through the agent object model, MSAgent.ocx. After you create an instance of the object model, the character can be loaded and is ready to receive requests . When a request for a character animation is made, the data provider (AgentDPV.dll) decompresses the graphic and audio files, and passes them to the automation server (AgentSvr.exe). The automation server renders the files to use transparent backgrounds and borders, giving them the appearance of hovering on top of the screen.

Scripting the Microsoft Agent Using Windows Script Host

The first step to accessing the Microsoft Agent character methods is to create an instance of the Microsoft Agent Control:

 Set  ACTL  - CreateObject ("Agent.Control.2") 

Once a connection has been established, you can load one of the preinstalled Microsoft Agent characters and set a reference to it:

  ACTL.  Characters.Load charactername. "charactername.acs" Set  CREF - ACTL.  Characters(charactername) 

Here, charactername is the name of the Microsoft Agent character, such as Merlin or Peedy. After the character has been loaded, you can make the character visible using the Show method:

  CREF.  Show 

Once the character is visible, you can call on any of the character's methods to perform an animation or to speak. Each agent contains a set of unique animations. To make a character use a specific animation, you use the Play method:

  CREF.  Play "animation" 
Note  

For a complete list of animations, consult the character's animation reference file.

Here, animation is the type of animation to perform, such as greet or sad. You can use the Speak method to make the character say a specific phrase:

  CREF.  Speak "  text  " 

Finally, you can cause the character to move to a specific location using the MoveTo method:

  CREF.  MoveTo  x.y  

Here, x is the horizontal pixel location, and y is the vertical pixel location.

Tip  

Specifying 0,0 will move the characters to the upper left corner of the screen.




Windows Admin Scripting Little Black Book
Windows Admin Scripting Little Black Book (Little Black Books (Paraglyph Press))
ISBN: 1933097108
EAN: 2147483647
Year: 2004
Pages: 89

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net