пятница, 24 февраля 2012 г.

Talk to your agent.(Microsoft Bob)

Byline: Tim Nott

Talk to your agent

If you miss Bob and Rover, try out some third-party characters

Microsoft Agent first appeared over a decade ago, with the launch of Microsoft Bob. This provided a collection of programs for letter writing, email, housekeeping, financial management, and so on. These were wrapped up in what Microsoft called a social interface consisting of a set of rooms populated by your guide (a dog named Rover) and various other animals (see screen 1).

Besides being unbelievably naff, Bob was well known for taking ages to do anything because of the sheer number of mouse clicks needed. When bored, you could waste further hours rearranging the furniture, and choosing a different guide. These ranged from a gargoyle called Baudelaire to a guitar-playing rat.

Bob bombed spectacularly, and the advent of Windows 95 did much to speed its demise. The technology resurfaced in Office 97, with the debut of the infamous paperclip and his pals, which included Bob veterans Will (Shakespeare) and the Dot. Although the Office Assistant is still available as an Office 2003 option, agents found another career in the XP Search facility. Judging by the number of websites that give instructions for turning the animated characters off in XP Search, agents have once again failed to win the hearts and minds of Microsoft's users.

So, let's start with those turn off instructions. Fire up Search -- either from the Start Menu or from the Search button on the Explorer toolbar, and click on 'Change preferences'. If you don't see this, you'll need to scroll down (or resize) the search pane. Alternatively, if the animated character is visible, click on it. If you want to change the character, then you'll get the choice of a rather annoying dog (yes, it's recycled Rover), an even more annoying girl -- Courtney -- who appears to be in a sort of open-topped space vehicle, and the yet more annoying Earl -- a sort of surfboarding duck. There's also Merlin, who is the only character I have anything approaching a soft spot for, and, should you have Microsoft Office and its assistants installed, those are available too.

Microsoft has three more you can download from www.microsoft.com/msagent/

downloads/user.asp, including a parrot, a robot, and the genie in screen 2. You can also find third-party agents -- there are loads at www.inchain.com.au if you first click on the eclips tab then Desktop Characters.

Having downloaded the characters as .acs files, you may find a problem getting the Search options to recognise them. Rover, Courtney and Earl are stored in Windows\srchasst\chars, and Merlin lives at Windows\msagent\

chars. We found that copying the genie and robot files to the former folder made them available, but neither the parrot -- peedy.acs -- nor third-party agents would make themselves available from either folder. We could, however, force the issue with a little Registry editing. Having taken the usual Restore Point safeguard, you can find and modify the path to the agent file at HKEY_CURRENT_USER\Software\

Microsoft\Search Assistant\Actor.

Note that you don't get a preview thumbnail of agent character files in the normal Windows way, but you will find an animated preview in the file properties version tab.

The fun possibilities of changing the Search character can probably be exhausted in a matter of minutes, but the agents themselves -- together with a little scripting -- can provide hours of displacement activity for Windows 98, ME, 2000 and XP users. First, you need to be suitably equipped. If you are running Windows 98 check that the Windows Scripting Host is installed in Control Panel, Add/Remove programs, Windows Setup, Accessories.

Next you should make sure you have the agent software installed. Again, with Windows ME, 2000 or XP this should already be in place, in Windows\MSAgent. Windows 98 users can get the core components from the downloads page mentioned above. The characters come with sound effects, but if you want to hear your characters speak, you need to download a text-to-speech engine, and XP users may need to download the SAPI 4 runtime. Again, it's all to be found at that downloads page. When you think you've got everything in place, go to www.microsoft.com/msagent/

dev/code/TryMSAgent.asp to check that it is all working. We found this didn't work in Firefox, but was fine in Internet Explorer.

Now you are ready to take control of your character. We dipped our toes in VB script back in 1999, and in 2004 showed how it could be used to change the delay in the XP slideshow, so here's a brief recap. The Windows Scripting Host supports both VB and Java scripts. Both consist of plain-text files with either the .vbs or .js extension. You can create these in Notepad. If it insists on adding the .txt extension, so that you end up with myscript.vbs.txt, then make sure you have 'All files' selected in the 'Save As Type' box.

The first thing we have to do is summon the agent and assign it as an object. The first six lines of the code in figure 1 take care of that. They define variables to hold the name and path of the agent file, then start the agent server, connect to it, and load it with the specified agent. The sixth line creates an object -- actor -- that we can then manipulate. The next step is to make him visible with Actor.Show. This brings him on stage, with whatever animation and sound effect has been programmed into the character. However, on its own, it doesn't work. The script chugs on, processing every line without waiting to see if the actor has completed each action or speech. When it gets to the end of the script, it unloads everything and terminates -- so we never get to see the act.

One way round this is to make the script check if the actor is logically visible, ie a Show command has been processed that has not been countermanded by a Hide command or by the user right-clicking and hiding the actor. If so, then the script pauses for 500 milliseconds, before checking again. This is achieved in the last three lines, which causes the script to chase its own tail until the actor has finished performing and been hidden.

Like many of their human counterparts, actors can Speak, Think, MoveTo, GestureAt and Play. Actors will speak out loud with the text-to-voice engine installed as well as in a speech bubble. Thinking is silent, with the cartoon convention of a trail of bubbles. MoveTo and GestureAt take arguments of screen position in pixels from top left.

What the actor can play is up to its creator. Our script shows a few of the actions that Merlin can perform. If you've typed it correctly (watch out for commas and spaces, but don't worry too much about case), you'll see Merlin appear out of his hat, fly down the screen, blow a trumpet, flourish his wand, stir his cauldron and speak before disappearing back into his hat. The full list -- and those of the other agents -- can be found in the Agent SDK help file. You can download this from www.microsoft.com/

msagent/downloads/developer.asp#ace.

There is, of course, a lot more you can do with agents, including interacting with the user to respond to typed or spoken commands. Agents will also 'play' when left to their own devices -- if you leave out the Actor.Hide line, then Merlin will eventually doze off, snoring gently. If you're really smitten by the creative dramatic urge then you can stage a play with more than one actor. You'll need new names for the AgentName, AgentPath, AgentObject and actor variables for each member of the cast, and you'll need to make liberal use of the Wscript.Sleep command to stop your actors all talking at the same time.

Renaming again

In last September's column (see www.pcw.co.uk/2160242) we covered XP's bulk rename facility. A reader asked if you could specify the order in which the files were numbered, independently of the Explorer sort order. We've discovered that Picasa2, free from http://picasa.google.com will do this. Drag the thumbnails into the order you want them, select all, press F2 to rename them -- the number sequence will reflect the order you imposed. PCW

Комментариев нет:

Отправить комментарий