Page 1 of 2 12>
Topic Options
#123417 - 2004-07-21 02:55 AM agent.kix won't go away, needs to hit ENTER to go
pentrix2 Offline
Fresh Scripter

Registered: 2004-07-21
Posts: 6
I'm using the agent.kix file. But everytime when the wizard character comes up and finish welcoming the user, it won't go away until the user has to hit the ENTER key. Below is the script, how and where would I make my modification to make him go away by himself after he welcomes my user when they login to the domain/network??

; agent.kix
;
; Demonstrates the use of COM automation to program a Microsoft Agent.
;
; Note : This code sample is provided for demonstration purposes only.
; Microsoft makes no warranty, either express or implied,
; as to its usability in any given situation.
;
; Copyright (C) 2001 Ruud van Velsen.
; All rights reserved.
;
break on


; first, try for the default agent (the wizard 'Merlin')

if exist( "%WinDir%\msagent\chars\merlin.acs" )
$agentname = "merlin"
else
;
; merlin doesn't live on this PC, try for any other MS Agent
;
$agentname = dir( "%WinDir%\msagent\chars\*.acs" )
if len( $agentname )
$agentname = substr($agentname,1, len($agentname)-4) ; remove .acs extension from name
endif
endif


if len( $agentname )
$agentpath = "%WinDir%\msagent\chars\" + $agentname + ".acs"

$agent = CreateObject ("agent.control.2")

if @error = 0
$agent.connected = "1"
$=$agent.characters.load($agentname,$agentpath)
$char = $agent.characters.character($agentname)

$=$char.show()
$=$char.moveto(400, 300)
while $char.status = 4
sleep 1 ; give him time to catch up...
loop

$=$char.play("read")
while $char.status = 4
sleep 1 ; give him time to catch up...
loop


$req=$char.speak("Hello, " + @fullname + ". Thank you for logging on to the " + @LDOMAIN + " domain.")

while $char.status = 4
sleep 1 ; give him time to catch up...
loop

$=$char.play("readreturn")
gets $x
else
? "Microsoft Agent not installed, or failed to start. " + @error + " / " + @serror
endif
else
? "Microsoft Agent not installed."
endif

Top
#123418 - 2004-07-21 03:15 AM Re: agent.kix won't go away, needs to hit ENTER to go
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
That would be the line:
gets $x
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#123419 - 2004-07-21 04:12 AM Re: agent.kix won't go away, needs to hit ENTER to go
pentrix2 Offline
Fresh Scripter

Registered: 2004-07-21
Posts: 6
you say the line "gets $x"

What do I put in place, or modify to make this script work without having the user to hit the ENTER to proceede furhter?

Top
#123420 - 2004-07-21 04:16 AM Re: agent.kix won't go away, needs to hit ENTER to go
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Did you even look in the manual to see what GETS does?

Just remove it.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#123421 - 2004-07-21 04:37 AM Re: agent.kix won't go away, needs to hit ENTER to go
pentrix2 Offline
Fresh Scripter

Registered: 2004-07-21
Posts: 6
My bad. That was a dummy question. Yupe, it works now. Thanks. Where do I download the manual? The agent.kix, I found it as a sample on the web and looks pretty cool to run it on my work network. They are going to get a big kick out of this one.
Top
#123422 - 2004-07-21 04:52 AM Re: agent.kix won't go away, needs to hit ENTER to go
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
The latest version of KiX, samples, and the manaul are all in one download available from
www.kixtart.org/downloads/


THere is also a compiled CHM available from
http://www.scriptlogic.com/kixtart/
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#123423 - 2004-07-21 07:36 AM Re: agent.kix won't go away, needs to hit ENTER to go
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Additionally to Les' response.. A manual (Word Document) is included with each KiXtart download.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#123424 - 2004-07-21 01:11 PM Re: agent.kix won't go away, needs to hit ENTER to go
pentrix2 Offline
Fresh Scripter

Registered: 2004-07-21
Posts: 6
Got it working the way I wanted, but how do I make him stay a little bit longer? He goes away too fast????
Top
#123425 - 2004-07-21 01:48 PM Re: agent.kix won't go away, needs to hit ENTER to go
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Try

sleep 3

[Hint]Manual[/hint]
_________________________



Top
#123426 - 2004-07-21 02:00 PM Re: agent.kix won't go away, needs to hit ENTER to go
pentrix2 Offline
Fresh Scripter

Registered: 2004-07-21
Posts: 6
I tried sleep 3 for all three of them, even put as sleep 5, but no difference.
Top
#123427 - 2004-07-21 02:06 PM Re: agent.kix won't go away, needs to hit ENTER to go
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
ah no, I think you should replace gets $x whith sleep 3
_________________________



Top
#123428 - 2004-07-21 02:09 PM Re: agent.kix won't go away, needs to hit ENTER to go
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
ja, and if it still doesn't work, post your latest code. There's a little trick we can show you on how to "synchronize" the action.
Top
#123429 - 2004-07-21 02:28 PM Re: agent.kix won't go away, needs to hit ENTER to go
pentrix2 Offline
Fresh Scripter

Registered: 2004-07-21
Posts: 6
Hey Les, thanks!! It worked like a charm!! This script is going to be tons of fun with Kixtart, I never knew logon scripting can be so much fun compared to your plain old dumb fashion way of just mapping drives. This Kixtart goes beyond just mapping drives, by the examples, samples and codes from other user's here, i see this kixtart will live for a very long time. Again, thanks Les!!!!
Top
#123430 - 2004-11-17 10:30 PM Re: agent.kix won't go away, needs to hit ENTER to go
Anonymous
Unregistered


Could you share this trick to syncronize the MS Agent? I'm using the following code and would like to have it exit when the character is hidden. I would prefer not to use a sleep function as the MS agent could be on screen for 3 seconds to 15 seconds.

Code:
break on


; first, try for the default agent (the wizard 'Merlin')

if exist( "%WinDir%\msagent\chars\merlin.acs" )
$agentname = "merlin"
else
;
; merlin doesn't live on this PC, try for any other MS Agent
;
$agentname = dir( "%WinDir%\msagent\chars\*.acs" )
if len( $agentname )
$agentname = substr($agentname,1, len($agentname)-4) ; remove .acs extension from name
endif
endif


if len( $agentname )
$agentpath = "%WinDir%\msagent\chars\" + $agentname + ".acs"

$agent = CreateObject ("agent.control.2")

if @error = 0
$agent.connected = "1"
$=$agent.characters.load($agentname,$agentpath)
$char = $agent.characters.character($agentname)

$=$char.show()
$=$char.wait()
$=$char.moveto(400, 300)
$req=$char.speak("Ola, " + @fullname + ". Obrigado por se logar ao domínio " + @LDOMAIN + ". Tenha um bom dia, um ótimo trabalho e até mais...")



endif



Thanks,
Jeff

Note: The greeting is in spanish, this was taken from a sample I obtained...I will be converting it at a later date and time.

Top
#123431 - 2004-11-18 12:15 AM Re: agent.kix won't go away, needs to hit ENTER to
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
ja, sure thing, here's the code ...

;---8<---
break On

$path = "%windir%\msagent\chars\merlin.acs"

$agent = createobject ("agent.control.2")

$agent.connected = 1

$= $agent.characters.load("merlin",$path)

$merlin = $agent.characters.character("merlin")

$= $merlin.moveto(400,200)

$= $merlin.show()

$wait = $merlin.play("announce" )

do sleep 0.25 until $merlin.wait($wait) <> 0

?"After announce..."

$wait = $merlin.speak("Hello! I am a basta !" )

do sleep 0.25 until $merlin.wait($wait) <> 0

?"After I am basta..."

$wait = $merlin.speak("Jooel is a basta !" )

do sleep 0.25 until $merlin.wait($wait) <> 0

?"After Jooel basta..."

$wait = $merlin.speak("Wouldn't you like to be a basta too ?" )

do sleep 0.25 until $merlin.wait($wait) <> 0

?"After you basta..."

exit 0

;---8<---

The important bit is this here:

$wait = $merlin.speak("Hello! I am a basta !" )

do sleep 0.25 until $merlin.wait($wait) <> 0

Basically means "start merlin speaking, and save a handle to that activity in a variable called $wait. Then do a sleep 0.25 (ms) until the $wait finishes (when wait($wait) <> 0 - merlin is finished speaking).

-Shawn

Top
#123432 - 2004-11-18 01:32 AM Re: agent.kix won't go away, needs to hit ENTER to
Cybex Offline
Getting the hang of it
*****

Registered: 2004-07-21
Posts: 81
Loc: Brandon, FL.
Here is another way to exit.

Code:

Break On

$path = "%windir%\msagent\chars\merlin.acs"
$agent = CreateObject ("agent.control.2")
$agent.connected = 1
$= $agent.characters.load("merlin",$path)
$merlin = $agent.characters.character("merlin")
$= $merlin.moveto(400,200)
$= $merlin.show()

$wait = $merlin.Play("announce" )
Do Sleep 0.25 Until $merlin.wait($wait) <> 0

?"After announce..."
$wait = $merlin.speak("Hello! I am a basta !" )
Do Sleep 0.25 Until $merlin.wait($wait) <> 0

?"After I am basta..."
$wait = $merlin.speak("Jooel is a basta !" )
Do Sleep 0.25 Until $merlin.wait($wait) <> 0

?"After Jooel basta..."
$wait = $merlin.speak("Wouldn't you like to be a basta too ?" )
Do Sleep 0.25 Until $merlin.wait($wait) <> 0

?"After you basta..."
$wait = $merlin.Play("READ")
$merlin.speak("Oh yeah, it says here Cybex is one cool basta!" )
Do Sleep 0.25 Until $merlin.wait($wait) <> 0

$wait = $merlin.hide
Do Sleep 0.25 Until $merlin.wait($wait) <> 0

Exit 0

_________________________
Common sense isn't so common.

Top
#123433 - 2004-11-18 01:44 AM Re: agent.kix won't go away, needs to hit ENTER to
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
rofl, good one. you really are a basta! ;0)
Top
#123434 - 2004-11-18 01:49 AM Re: agent.kix won't go away, needs to hit ENTER to
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Well, not fully MERLIN compliant, but another way of playing sound/video perhaps along with Merlin.

Code:
; Minimum DLL version shell32.dll version 4.71 or later 

; Minimum operating systems Windows 2000, Windows NT 4.0 with Internet Explorer 4.0,
; Windows 98, Windows 95 with Internet Explorer 4.0
; $FILE=Path and name of file to use
; $Show sets whether or not to show the player 0=no 1=yes
; $Wait says for the script to wait for the file to finish before closing 0=no 1=yes
; If files listed in the $MediaList are videos it will display the player even if you set it to no

Break On
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')

Dim $Play,$UserList
$UserList = Split("user1|user2|user3","|")
If AScan ($UserList, @USERID)>=0
$Play=PlayMediaFile(@LDrive+'weaklink.wav',0,0)
EndIf

Function PlayMediaFile($File,$Show,$Wait)
Dim $objShell,$MediaList,$RC
If Exist($File)
If $Show<>1 $Show=0 EndIf
If $Wait<>1 $Wait=0 EndIf
$MediaList = "wmv","asf","mpg","avi"
If AScan ($MediaList, Right(($File),3))>=0
$Show=1
EndIf
$objShell=CreateObject('WScript.Shell')
$RC=$objShell.Run('mplay32.exe /play /close ' + '"' + $File + '"',$Show,$Wait)
Else
$PlayMediaFile=@ERROR
Quit $PlayMediaFile
EndIf
EndFunction


Top
#123435 - 2004-11-23 04:59 PM Re: agent.kix won't go away, needs to hit ENTER to
Anonymous
Unregistered


Quote:

Here is another way to exit. :grin




Thanks, I just did a quick test and it works perfectly. Just in time for a quick deployment for the thanksgiving day holiday =)

Top
#123436 - 2005-03-31 02:02 AM Re: agent.kix won't go away, needs to hit ENTER to
Spitzu Offline
Lurker

Registered: 2005-03-23
Posts: 1
You don't have to answer if you don't want to, because I'm just bored and screwing around...

But, do any of you know how I might make Merlin move in an uninterrupted circle around the screen? As it is now, he just makes a hop, stops, and then flys off to the next coordinate.



Code:
 
break on



$agentname = "merlin"

if len( $agentname )
$agentpath = "%WinDir%\msagent\chars\" + $agentname + ".acs"

$agent = CreateObject ("agent.control.2")

if @error = 0
$agent.connected = "1"
$=$agent.characters.load($agentname,$agentpath)
$char = $agent.characters.character($agentname)

$=$char.show()
$=$char.moveto(0, 0)
while $char.status = 4
sleep 1 ; give him time to catch up...
loop

$=$char.play("read")
while $char.status = 4
sleep 1 ; give him time to catch up...
loop

:loop
$=$char.moveto(1000, 0)
$=$char.moveto(1000, 800)
$=$char.moveto(0, 800)
$=$char.moveto(0, 0)
$=$char.moveto(1000, 400)
$=$char.moveto(500, 800)
$=$char.moveto(0, 400)
$=$char.moveto(500, 0)
gosub "loop"

while $char.status = 4
sleep 1 ; give him time to catch up...
loop

$=$char.play("readreturn")
gets $x
else
? "Microsoft Agent not installed, or failed to start. " + @error + " / " + @serror
endif



Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 847 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.084 seconds in which 0.049 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org