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.

Read file help..

Help for those learning Tcl or writing their own scripts.
Post Reply
F
FcLan
Halfop
Posts: 64
Joined: Fri Sep 30, 2005 10:46 am
Location: Poland

Read file help..

Post by FcLan »

Code: Select all

package require http
bind pub - !read foo
proc foo {n u h c t} {
   set x [::http::geturl www.website.com/file.txt]
   foreach e [split [::http::data $x] \n] {puthelp "privmsg $c :$e"}
   ::http::cleanup $x
}
It is code to read file from website, i`ve seen it on this forum, but I want to read only 4 latest lines, any ideas??
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Try

Code: Select all

[lrange [split [::http::data $x] \n] 0 3]
instead of

Code: Select all

[split [::http::data $x] \n]
F
FcLan
Halfop
Posts: 64
Joined: Fri Sep 30, 2005 10:46 am
Location: Poland

Post by FcLan »

thx
Post Reply