egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

help tdom

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
iRoc
Guest





PostPosted: Sat Jun 22, 2013 5:25 pm    Post subject: help tdom Reply with quote

line 26 To 34
Code:
       set doc [dom parse -html $page]
      set root [$doc documentElement]
      
      set today [string map {"  " " "} [clock format [clock seconds] -format "%h %e"]]
      
      set game [lindex [$root selectNodes {//div[@id='my-teams-table']//tr/td[2][substring(normalize-space(text()),1,2)="FT" and text()!="Time" and text()!="Status"]/../td[1]}] end]
      if {$today != [string trim [$game text]]} {
         set game [lindex [$root selectNodes {//div[@id='my-teams-table']//tr/td[2][substring(normalize-space(text()),1,2)!="FT" and text()!="Time" and text()!="Status"]/../td[1]}] 0]
      }



Error:

Code:
2:18:47am / * <iRocc> .tcl putlog $::errorInfo
2:18:48am / * <iB0T> [20:18:48] invalid command name ""
2:18:48am / * <iB0T>     while executing
2:18:48am / * <iB0T> "$game text"
2:18:48am / * <iB0T>     (procedure "public_lineup" line 26)
2:18:48am / * <iB0T>     invoked from within
2:18:48am / * <iB0T> "public_lineup $_pub1 $_pub2 $_pub3 $_pub4 $_pub5"


can anyone tell me how to fix this error?
Back to top
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Sat Jun 22, 2013 5:38 pm    Post subject: Reply with quote

The problem is with this line of code...
Code:
if {$today != [string trim [$game text]]} {


The value of $game is not a valid command name, and can not be put in []'s

Darned if i can tell what the value of $game might be, but maybe you were wanting something more like...
Code:
if {$today != [string trim $game]} {

_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
iRoc
Guest





PostPosted: Sat Jun 22, 2013 6:09 pm    Post subject: Reply with quote

SpiKe^^ wrote:
The problem is with this line of code...
Code:
if {$today != [string trim [$game text]]} {


The value of $game is not a valid command name, and can not be put in []'s

Darned if i can tell what the value of $game might be, but maybe you were wanting something more like...
Code:
if {$today != [string trim $game]} {


if i chg
if {$today != [string trim [$game text]]} {
To
if {$today != [string trim $game]} {

bot say that

4:06:07am / * <iRoc> !lineup brazil
4:06:08am / * <iB0T> Unable to find next fixture.

and maybe i think prob searching text
set page [grabURL "http://www.google.com/search?btnI=&q=site:espnfc.com/team/fixtures%3Fid%3D+[ue $text]" 1]
$text brazil Go here
http://espnfc.com/team/fixtures/_/id/205/brazil?cc=4716

4:23:38am / * <iRoc> .tcl set today [string map {" " " "} [clock format [clock seconds] -format "%h %e"]]
4:23:39am / * <iB0T> Tcl: Jun 22

and
if {$today != [string trim [$game text]]} {


error log

Code:
4:19:07am / * <iB0T> [22:19:07] <!DOCTYPE html><head>
4:19:07am / * <iB0T> <title>Italy 2013 Fixtures / Schedules & Results - ESPN FC</title>
4:19:07am / * <iB0T>
4:19:07am / * <iB0T> <script>/*c: null*/function cookieFunc(a,j,k){if(j){if(k){var d=new Date();d.setTime(d.getTime()+(k*24*60*60*1000));var b="; expires="+d.toGMTString()}else{var b=""}document.cookie=a+"="+j+b+"; path=/; domain=espn.go.com;";document.cookie=a+"="+j+b+"; path=/; domain=espnfc.com;"}else{var e=a+"=";var f=document.cookie.split(";");for(var g=0;g<f.length;g++){var h=f[g];while(h.charAt(0)==" "){h=h.s
4:19:08am / * <iB0T> [22:19:07] Tcl error [public_lineup]: invalid command name ""
4:19:09am / * <iB0T> [22:19:09] <!DOCTYPE html><head>
4:19:09am / * <iB0T> <title>Brazil 2013 Fixtures / Schedules & Results - ESPN FC</title>
4:19:09am / * <iB0T>
4:19:09am / * <iB0T> <script>/*c: null*/function cookieFunc(a,j,k){if(j){if(k){var d=new Date();d.setTime(d.getTime()+(k*24*60*60*1000));var b="; expires="+d.toGMTString()}else{var b=""}document.cookie=a+"="+j+b+"; path=/; domain=espn.go.com;";document.cookie=a+"="+j+b+"; path=/; domain=espnfc.com;"}else{var e=a+"=";var f=document.cookie.split(";");for(var g=0;g<f.length;g++){var h=f[g];while(h.charAt(0)==" "){h=h.
4:19:10am / * <iB0T> [22:19:09] Tcl error [public_lineup]: invalid command name ""
4:19:21am / * <iRoc> .tcl putlog $::errorInfo
4:19:22am / * <iB0T> [22:19:22] invalid command name ""
4:19:22am / * <iB0T>     while executing
4:19:22am / * <iB0T> "$game $text"
4:19:22am / * <iB0T>     (procedure "public_lineup" line 26)
4:19:22am / * <iB0T>     invoked from within
4:19:22am / * <iB0T> "public_lineup $_pub1 $_pub2 $_pub3 $_pub4 $_pub5"
4:19:22am / * <iB0T> Tcl:
Back to top
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sun Jun 23, 2013 12:20 am    Post subject: Reply with quote

Code:
if {$today != [string trim [$game asText]]} {

_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Jun 23, 2013 10:40 am    Post subject: Reply with quote

Have you verified that your XPath expression actually returns any nodes at all? To me, it would seem that "$root selectNodes" returns an empty list, which is why the node-command appears as "" later on.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber