| View previous topic :: View next topic |
| Author |
Message |
darton Op
Joined: 21 Jan 2006 Posts: 155
|
Posted: Sat Aug 26, 2006 7:37 am Post subject: Textfile-Output in only one line |
|
|
Hello!
If I want to display everything of a textfile in a channel I use this script.
| Code: | proc foo {nick uhost hand chan arg} {
set fd [open $::foofile r]
while {![eof $fd]} {
putquick "PRIVMSG $chan :[gets $fd]"
}
close $fd
} |
The output looks like this:
| Quote: | (@Bot) bla
(@Bot) blabla
(@Bot) blablabla
|
But I want that everything is displayed in just one line. So it must look like this:
| Quote: | | (@Bot) bla blabla blablabla |
What do I have to change in my script? |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Aug 26, 2006 8:05 am Post subject: |
|
|
you could try "read" (reads as much as possible from the file), and then use string map (to change newlines into spaces)
| Code: | proc foo {nick host hand chan text} {
set fd [open $::foofile r]
set data [read $fd]
puthelp "PRIVMSG $chan :[string map {"\n" " " "\r" " "}]"
close $fd
} |
I think something like that should do the trick... _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
darton Op
Joined: 21 Jan 2006 Posts: 155
|
Posted: Sat Aug 26, 2006 1:25 pm Post subject: |
|
|
| Thank you. It works. |
|
| Back to top |
|
 |
|