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.

problem with 1 old script

Support & discussion of released scripts, and announcements of new releases.
Post Reply
s
suspect34
Voice
Posts: 4
Joined: Sun Apr 11, 2010 6:45 am

problem with 1 old script

Post by suspect34 »

Hello i use an old script named knac.tcl
here is the script

Code: Select all

###############################################
#
# KNAC ! Now playing on www.knac.com
#
# Usage :
#
# !knac
# Returns the title & artist of the song currently on air on www.knac.com
# Note : functionnal as of 10/2002. May not work when they modify their
# system, url or stuff :)
#
# Contact stuff :
# Ozh, ozh@planetquake, #SARL on irc.quakenet.org
###############################################

set knac_url "http://www.knac.com/text1.txt"

bind pub - !knac knac_get

proc knac_get {nick mask hand chan args} {
	global knac_url
	set file [open "|lynx -source $knac_url" r]
	set html "[gets $file]"

	regsub -all "<br>" $html " " html
	regsub -all "<\[^b]{0,1}b{0,1}>" $html "" html
	regsub "text1=" $html "" html
	regsub "NOW PLAYING:" $html "Now on www.knac.com: \002" html
	regsub "BY:" $html "\002, by \002" html

	putchan $chan $html
}

putlog "KNAC.tcl loaded ! If it's too loud, you're too old ! :)"
if i use !knac i get this error [/code]Tcl error [knac_get]: couldn't create error file for command: no such file or directory.
thanks for your time
r
raider2k
Op
Posts: 140
Joined: Tue Jan 01, 2008 10:42 am

Post by raider2k »

what i wanted to do is to put that script into one of my bots, but then found out that i dont have lynx on my system and i dont want to install it (even though its possible to deinstall).

so i was thinking about possible errors, not really sure about it but you might want to try:

Code: Select all

regsub -all "<\[^b]{0,1}b{0,1}>" $html "" html 
the first [ is being escaped, but the second one isnt, escape it as well

furthermore theres no close tag for the file you opened. nevertheless i have to admit that im not really familiar with the error message "couldn't create error file for command". the only thing which could lead to something is "no such file or directory" which could mean that lynx wasnt found on the system?
s
suspect34
Voice
Posts: 4
Joined: Sun Apr 11, 2010 6:45 am

Post by suspect34 »

Thanks for your replay , i will try to fix this but i don't know to much about tcl scripts i need to do a stats to get info from a web page to my irc channel
r
raider2k
Op
Posts: 140
Joined: Tue Jan 01, 2008 10:42 am

Post by raider2k »

if you need help with something in particular just holla. if someone else is willing to install additional software or has lynx on his system already might want to try your existing script. from my point im only able to play a bit of guessing games and give you hints ;)
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

The error message "couldn't create error file for command: no such file or directory." usually originates from the exec command, and is usually related with windows systems. In this case, you are using open with a pipe, which is very similar to using exec, just that you gain control of both stdin and stdout.

What you need to do, in essence, is to redirect stderr (which is the cause of the issue) to stdout or some file. Have a look at this post: http://forum.egghelp.org/viewtopic.php?p=90869#90869
Although it deals with exec, not open, the solution should work equally well.
NML_375
Post Reply