PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Shurlock on 28 June, 2004, 23:28:52

Title: Execute a DOS Batch ??
Post by: Shurlock on 28 June, 2004, 23:28:52
Hi all,

Is there any way of writing a script that actually executes an MS-DOS batchfile and - after execution - returns the results so that the data can be handled by LUA?

Fact is: I have a DOS batchfile that works with a very old (but.... very NICE!!) program called SEARCHT.EXE
Using parameters, it will return the search results in NOTEPAD.
What I would like is: use this command and the results to accomodate OP's.

This tool gives me a very quick way of tracing nicknames in ALL log files, so you can imagine I would like my OP's to be able to use the DOS-instruction directly. If not, I need 48 hours in 1 day.   :(

Any suggestion is welcome!
Title:
Post by: plop on 28 June, 2004, 23:32:24
you can execute it with.
execute('batchfile.bat")
next open the txt file it makes.
readfrom("outputfile.txt")
after that you can remove it if you don't need it anymore.
remove("outputfile.txt")

plop
Title:
Post by: Shurlock on 28 June, 2004, 23:53:52
Thanks Plop!

Why didn't I think of that??   :]

But will that Execute command also accept parameters given by the OP's?

For example:
command = !dobatch [nickname]

Title:
Post by: Shurlock on 29 June, 2004, 01:13:55
Just to proove why I would like this....

I have logger LUA's running for KICKS, BANS and LOGONS.

Once a week I archive the LOGONS with a different name in the same folder.

Any OP that wishes to know ALL about a user, should get the results of that command from ALL the <.log> files.

The LOGON also includes the IP's and the MyInfo strings.
So, this tool could be very usefull!

Greets!
Title:
Post by: plop on 29 June, 2004, 03:44:57
execute("batfile.bat "..nickname)

you can stuff anyhing in it as long as the bat/program you start understands it.
or you can make lua write the bat file.
my site is an example of that, i'm using lua 2 generate the php scripts for me.

plop