AgentServerObjects

From IronPython Cookbook

Windows includes this bizarre feature called 'AgentServerObjects'. These are little animated characters that fly around the screen, making announcements and doing quite odd and quirky things.

They don't get used very much, in fact it is hard to see what you could use them for. But they're certainly fun.

Merlin looks like this:

Merlin at Work

and:

Merlin Again

In order to run this example I generated the interop dll in 'c:\'. Run tlbimp like this (more on Interop introduction):

C:\>set PATH=%PATH%;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin
C:\>tlbimp c:\WINDOWS\msagent\agentsvr.exe

The code to make this dude fly around your screen is:

import sys
sys.path.append('C:\\') # or wherever your interop dll is

import clr
clr.AddReference("AgentServerObjects.dll")
from AgentServerObjects import AgentServerClass

a = AgentServerClass()
id, rest = a.Load("merlin.acs")
ch = a.GetCharacter(id)

ch.SetSize(128,128)
ch.MoveTo(0, 0, 0)
ch.Show(0)
ch.MoveTo(600, 100, 2000)
ch.Play("Announce")
ch.MoveTo(300, 150, 1000)
ch.Play("Think")
ch.Play("Search")
ch.Play("Congratulate")
ch.Hide(0)

Cool...

More details here, and some example C# here.


Back to Contents.

TOOLBOX
LANGUAGES