Dim AgentControl
On Error Resume Next
Set AgentControl = CreateObject("Agent.Control.1")
If IsObject(AgentControl) Then 'it loaded ok
AgentControl.Connected = True
Dim merlin
On Error Resume Next
AgentControl.Characters.Load "merlin", "C:\Program Files\Microsoft
Agent\characters\merlin.acs"
set merlin= AgentControl.Characters ("merlin")
merlin.Get "state", "Showing"
merlin.Get "state", "Speaking"
merlin.MoveTo 10, 10
merlin.Show
merlin.Get "state", "Moving"
merlin.MoveTo 257, 177
merlin.Speak ("Isn't it about time you started doing some real work?")
merlin.Hide
End If
wscript.echo "What do you think?"
Regards,
Ian Morrish
http://wsh.glazier.co.nz WSH FAQ
http://ils.glazier.co.nz (NetMeeting)
http://www.glazier.co.nz
Thats really GREAT!!!
I have a lot of fun with this toy (I am afraid, my boss does not). But I've
2 Questions on it:
1. Why does nothing happen, when the last line :"WScript.echo "..." is
deleted?
2. How to connect the Agent-Events.
Thanks,
christoph.
Ian Morrish schrieb in Nachricht ...
Extremely Cool, thanks for pointing out and sharing this technology. I can
see a lot of uses for this agent technology.
Matt Sinkovits
Ian Morrish wrote in message ...
Ian Morrish
WSH FAQ http://wsh.glazier.co.nz
Home page http://www.glazier.co.nz
NetMeeting http://ils.glazier.co.nz
callto:ils.glazier.co.nz/i...@glazier.co.nz
Ian Morrish wrote in message ...
I combined Ian's sample along with the pause function from
http://sams.prohosting.com/cwashington/scripts/vbscripts/index.html
to use Merlin (the agent) as a progress indicator for a file copy procedure.
Merlin pops up to tell you the copy is in progress and waits around to let
you know when it is finished.
Thanks!!!
Here's the code....
Set WSHShell = WScript.CreateObject("WScript.Shell")
Set fs = CreateObject("Scripting.FileSystemObject")
' set d to a: drive and check if a disk is inserted
Set d = fs.GetDrive("a:")
Do while d.IsReady = false
test=msgbox("Please insert a disk in Drive A:",1,"Drive Not Ready")
If test = vbCancel Then WScript.Quit
loop
' Ian Morrish's code sample to set Merlin into action
Dim AgentControl
On Error Resume Next
Set AgentControl = CreateObject("Agent.Control.1")
If IsObject(AgentControl) Then 'it loaded ok
AgentControl.Connected = True
Dim merlin
On Error Resume Next
AgentControl.Characters.Load "merlin", "C:\Program Files\Microsoft
Agent\characters\merlin.acs"
set merlin= AgentControl.Characters ("merlin")
merlin.Get "state", "Showing"
merlin.Get "state", "Speaking"
merlin.MoveTo 10, 10
merlin.Show
merlin.Speak ("Copying myfile")
merlin.Get "state", "Moving"
merlin.MoveTo 257, 177
End If
' copy the file to a:
Fs.CopyFile "c:\My Documents\myfile.txt", "A:\"
' execution will continue here after copy is complete
merlin.Speak ("Copy complete!")
' pause (from Clarence Washington) function
' to allow the last speak to complete
pause(3)
Function Pause(x)
StartTime = cint(second(time))
i = 0
Do
i = i + 1
loop While cint(second(time)) < StartTime + cint(x)
End Function