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.

Retrieve data from a file (other alternative)

Help for those learning Tcl or writing their own scripts.
Post Reply
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Retrieve data from a file (other alternative)

Post by juanamores »

I tried another way to retrieve data from a file.
I know the "traditional" way, but I tried for other alternative to be learning.

Code: Select all

proc noti_nolist {nick uhost handle chan arg} {
global canal_admin
	if {[string tolower $chan] != [string tolower $canal_admin]} {
		return
	}
		if {[file exist prohibidos.txt]} {
			set file [open prohibidos.txt "r"]
			set x 0
			while {![eof $file]} {
				set nickpr [gets $file]
				if {([llength $nickpr] == 0) && ($x == 0)} { putmsg $chan  "The list is empty."; return } 
					if {$nickpr == ""} { continue }
						putmsg $chan "$nickpr"
						set x [expr {$x + 1}]
			}
			close $file
			putmsg $chan "The list contains  $x prohibited nicks."
		} else {
			putmsg $canal_admin "Has not yet entered any nick,database is missing.!"
		}
}
Works well! :D
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
Post Reply