This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Running A Program from a TCL Script

Old posts that have not been replied to for several years.
Locked
O
OnFire
Voice
Posts: 23
Joined: Tue Oct 01, 2002 1:51 pm

Running A Program from a TCL Script

Post by OnFire »

Hi
I'm not sure if this can be done and I've had a look through the forums without luck.

I'd like to run mircstats from a tcl script. I know about the exec command but I've got a windrop so at the moment I can't get it to run because I use Windows. Does anyone know how to do this, or is it just not possible?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

The exec command will work on windows.
O
OnFire
Voice
Posts: 23
Joined: Tue Oct 01, 2002 1:51 pm

Post by OnFire »

OK I didn't realise that...my current code looks like this:

Code: Select all

proc stats {nick host hand chan text} {
exec {\mircstats\mircstats.exe}
}
Where mircstats is a directory under the root of the bot. However, when I type it the bot comes up with:

Tcl error [stats]: couldn't execute "\mircstats\mircstats.exe": no such file of directory

I've also tried the full path with drive letter and everything but still with no luck. Any help would be appreciated!
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Using \ as teh first character of the location, is the same as giving the full path.

You bot will most likely be looking in "c:\mircstats\mircstats.exe".

The first characters lets the interpreter know what location you are looking in. Seeing as you are looking in a directory uinder the bots directory, you simply drop the first \
O
OnFire
Voice
Posts: 23
Joined: Tue Oct 01, 2002 1:51 pm

Post by OnFire »

Thanks but I still can't get it to work...

The bot is in
f:\documents and settings\simon\my documents\windrop
and mircstats is in
f:\documents and settings\simon\my documents\windrop\mircstats\mircstats.exe

I'm a bit stuck for ideas at the moment...
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Using your example, you can use

Code: Select all

proc stats {nick host hand chan text} { 
exec "mircstats/mircstats.exe"
}
You might want to increase your console flags and look for error messages being returned.
t
tainted
Master
Posts: 239
Joined: Sun May 12, 2002 8:00 pm
Location: chicago
Contact:

Post by tainted »

It also looks like you aren't passing it $text, which is included in the first line of your proc. Do you need to pass options to it?
O
OnFire
Voice
Posts: 23
Joined: Tue Oct 01, 2002 1:51 pm

Post by OnFire »

I've tried your advice and still can't get it to work. However, I now have a different error message:

[17:12] Tcl error [stats]: couldn't duplicate input handle: bad file number

I've checked the filenames and they are fine. I've also set the console flags to +d but there are no other error messages.

If I take text out of the first line, it says:

[17:06] Tcl error [stats]: called "stats" with too many arguments

So, once again, any suggestions?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

The $text is fine where it is. If you failed to understand what he said, then you might as well forget what he said.

The "can't duplicate input handler" messages, is generated mainly of windows systems, and is usualy a sign that it was able to execute the program (IE, it worked) but it failed to do some internal tasks.

There is not much else you can do, though, you could try creating a .bat (MSDOS batch program) to launch mircstats, and load the batch file instead.
Locked