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.

Error on script

Help for those learning Tcl or writing their own scripts.
S
SamSun
Voice
Posts: 1
Joined: Sat Sep 02, 2017 1:42 am

horoscop.tcl

Post by SamSun »

Hi tried the script and i got this error
RAC: <iframe frameBorder=\"0\" width=\"auto\" id=\"dailyHoroscopeFrame\" style=\"min-width: 550px\" src=\"http://www.sentimente.ro/horoscop/index ... "></iframe>
Website changed i guess but i don`t know how to fix the script to work again.If someone can take a look at the script and make that change. Thank You.

Here is the script:

Code: Select all

namespace eval zodiac { 
   package require http 
   setudef flag horoscop 
   bind pub -|- !horoscop [namespace current]::fetch 

   proc fetch {nick uhost hand chan text} { 
      if {![channel get $chan horoscop]} return 
      if {[scan $text {%s} sign] != 1} { 
         putserv "NOTICE $nick :Syntax: !horoscop <zodiac sign>" 
         return 
      } 
      set signs [list "berbec" "taur" "gemeni" "rac" "leu" "fecioara" "balanta" "scorpion" "sagetator" "capricorn" "varsator" "pesti"] 
      set sign [string tolower $sign] 
      if {[lsearch $signs $sign] == -1} { 
         putserv "NOTICE $nick :Error, $sign is a uknown sign. Pick another." 
         return 
      } 
      set http [::http::geturl "http://www.zodii.ro/zodiac/$sign*zodie_$sign-horoscop_zilnic.html"] 
      set data [::http::data $http] 
      ::http::cleanup $http 
      regexp -nocase {<div class="textArticol">(.*?)</div>} $data text 
      set result [lrange $text 2 end-1] 
      putserv "NOTICE $nick :[string toupper $sign]: $result" 
   } 
}
Post Reply