egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Textfile-Output in only one line

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
darton
Op


Joined: 21 Jan 2006
Posts: 155

PostPosted: Sat Aug 26, 2006 7:37 am    Post subject: Textfile-Output in only one line Reply with quote

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
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Aug 26, 2006 8:05 am    Post subject: Reply with quote

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
View user's profile Send private message
darton
Op


Joined: 21 Jan 2006
Posts: 155

PostPosted: Sat Aug 26, 2006 1:25 pm    Post subject: Reply with quote

Thank you. It works.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber