###############################################
#
# 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
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:
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?
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
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
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.