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.

Sintax error in proc

Help for those learning Tcl or writing their own scripts.
Post Reply
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Sintax error in proc

Post by juanamores »

How I can invoke this process from another process ?
I have invoked the process in another code with name (addjss) , but I get the following error:

Code: Select all

proc addjss { } {
	if {![file exists djnick]} { return }
		set fname0 "djnick"
		set fp [open $fname0 "r"]
		close $fp
		set data [read -nonewline $fp]
		set lines [split $data " "]  
		set addjs [lindex $lines 0]
		set tempo [lindex $lines 1]
		set fechaa [lindex $lines 2]
 
	if {![file exists listaDJS.txt]} {
		set fs [open listaDJS.txt "w"]
		puts $fs ""
		close $fs
	}  else {
	set fname "listaDJS.txt"
	set fp [open $fname "a"]
	puts $fp $addjs $tempo $fechaa
	close $fp 
	}
}
wrong # args: should be "puts ?-nonewline? ?channelId? string"
Do not copy the other process because it is very long.
But I think that I'm invoking wrong, I do not think that problem long process.
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Try changing this line...

Code: Select all

puts $fp $addjs $tempo $fechaa
to something more like...

Code: Select all

puts $fp "$addjs $tempo $fechaa"
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

SpiKe^^ wrote:Try changing this line...

Code: Select all

puts $fp $addjs $tempo $fechaa
to something more like...

Code: Select all

puts $fp "$addjs $tempo $fechaa"
Not work.
For debugging purposes I have added messages ( blue color code).
It shows: Exist file djnick!
proc addjss { } {
global canal_admin
if {![file exists djnick]} { putmsg $canal_admin "Does not exist file djnick!";return }
putmsg $canal_admin "Exist file djnick!"
set fname0 "djnick"
set fp [open $fname0 "r"]
close $fp
set data [read -nonewline $fp]
set lines [split $data " "]
set addjs [lindex $lines 0]
set tempo [lindex $lines 1]
set fechaa [lindex $lines 2]

if {![file exists listaDJS.txt]} {
putmsg $canal_admin "Does not exist file listaDJS!"
set fs [open listaDJS.txt "w"]
puts $fs ""
close $fs
} else {
putmsg $canal_admin "Exist file listaDJs!"
set fname "listaDJS.txt"
set fp [open $fname "a"]
puts $fp "$addjs $tempo $fechaa"
close $fp
}
}
Now the error is:
can not find channel named "file416"
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Change this...

Code: Select all

 set fp [open $fname0 "r"] 
 close $fp 
 set data [read -nonewline $fp] 
to...

Code: Select all

 set fp [open $fname0 "r"] 
 set data [read -nonewline $fp] 
 close $fp 
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

It worked perfect.
Thanks SpiKe^^.
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
Post Reply