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.
Help for those learning Tcl or writing their own scripts.
i
iRoc
Post
by iRoc » Sat Jun 22, 2013 5:25 pm
line 26 To 34
Code: Select all
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: Select all
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?
SpiKe^^
Owner
Posts: 831 Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:
Post
by SpiKe^^ » Sat Jun 22, 2013 5:38 pm
The problem is with this line of code...
Code: Select all
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: Select all
if {$today != [string trim $game]} {
i
iRoc
Post
by iRoc » Sat Jun 22, 2013 6:09 pm
SpiKe^^ wrote: The problem is with this line of code...
Code: Select all
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: Select all
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=si ... s%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: Select all
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:
speechles
Revered One
Posts: 1398 Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)
Post
by speechles » Sun Jun 23, 2013 12:20 am
Code: Select all
if {$today != [string trim [$game asText]]} {
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Sun Jun 23, 2013 10:40 am
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