Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Lua
➜ Help with a script - logging the output of a command.
|
Help with a script - logging the output of a command.
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Virthe
(4 posts) Bio
|
| Date
| Thu 24 May 2012 09:42 AM (UTC) |
| Message
| I need to log the output of a command to a file on my hard disk?
So far I have this:
OpenLog("D:\Users\User\Documents\AL\test")
SetLogOutput (true)
world.Send("cat %1")
FlushLog()
It doesn't work at all.
I need to log all the output of the 'cat' command.
How do I correctly use log to store the MUD output?
Would I need to set up triggers to detect when the output of the command has finished? | | Top |
|
| Posted by
| Fiendish
USA (2,551 posts) Bio
Global Moderator |
| Date
| Reply #1 on Thu 24 May 2012 12:50 PM (UTC) |
| Message
|
Quote: Would I need to set up triggers to detect when the output of the command has finished?
Yes. |
https://github.com/fiendish/aardwolfclientpackage | | Top |
|
| Posted by
| Virthe
(4 posts) Bio
|
| Date
| Reply #2 on Thu 24 May 2012 01:03 PM (UTC) |
| Message
| Okay, I think I can sort out the trigger (enabling and disabling it with SetTriggerOption).
I can't figure out how to get the log file working though. Am I on the right lines with that? Will it work if I move FlushLog() to the end of file trigger? | | Top |
|
| Posted by
| Virthe
(4 posts) Bio
|
| Date
| Reply #3 on Thu 24 May 2012 02:55 PM (UTC) Amended on Thu 24 May 2012 06:09 PM (UTC) by Virthe
|
| Message
| Okay. I now have:
And an alias with the following script:
OpenLog("D:\Users\User\Documents\AL\log.txt",false)
SetLogOutput (true)
SetTriggerOption("eof","enabled","y")
world.Send("cat %1")
A trigger labelled "eof" with the following script:
FlushLog()
CloseLog()
SetTriggerOption("eof","enabled","n")
The trigger runs as planned and is enabled/disabled correctly.
However, the log file still doesn't work. No file is created. I have tried using the default log name with no success.
Is there anything else I need to do to enable/disable logging from the script? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,166 posts) Bio
Forum Administrator |
| Date
| Reply #4 on Fri 25 May 2012 01:05 AM (UTC) |
| Message
| You are short some backslashes. Inside a Lua string you need to double them, eg.
OpenLog("D:\\Users\\User\\Documents\\AL\\log.txt",false)
And if this is in "send to script" you have to double them again.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Virthe
(4 posts) Bio
|
| Date
| Reply #5 on Fri 25 May 2012 11:49 AM (UTC) |
| Message
| | Great! That fixed it. Thanks for your help. | | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
18,307 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top