Tcl/Tk Scripting
Tcl/Tk Scripting
Is there any way we can use the 'test' function in Tk programs?
i want to write a function that tests if a file is a file/directory.
Any good ref docs?
i want to write a function that tests if a file is a file/directory.
Any good ref docs?
Only Human
Re:Tcl/Tk Scripting
Ok got that one covered.
Another doubt though. How do we check to se if a string variable has valid data in it. (no spaces or empty)
Another doubt though. How do we check to se if a string variable has valid data in it. (no spaces or empty)
Re:Tcl/Tk Scripting
Check if it's empty (or just spaces). Then if it isn't, it contains something else. For anything more specific you'll have to say what "valid data" means.
Re:Tcl/Tk Scripting
is there any function to check if its empty/spaces? cause right now i use this
and it works fine. I just wanted to know if there was a simpler way.
Code: Select all
if {![string length [string trim $var]]} {
puts stdout "zero length";
}
Only Human
Re:Tcl/Tk Scripting
BTW I have another little problem now.
I want to create a procedure to display error messages which are stored in a err Array (global).
My procedures may call this error procedure with an index name/number and i want the appropriate error message to be printed out. I cannot seem to be able to display the error strings using upvar, I do not know why.
Does any one have some example code of this?
I want to create a procedure to display error messages which are stored in a err Array (global).
My procedures may call this error procedure with an index name/number and i want the appropriate error message to be printed out. I cannot seem to be able to display the error strings using upvar, I do not know why.
Does any one have some example code of this?
Only Human
Re:Tcl/Tk Scripting
Your code doesn't look that complicated to me. Besides, when you make it a function, it's just a function call everywhere else.
The array question I cannot answer; it's simply been too long since I wrote any TCL. But posting your non-working code here might help others spot the problem.
The array question I cannot answer; it's simply been too long since I wrote any TCL. But posting your non-working code here might help others spot the problem.
Re:Tcl/Tk Scripting
I just declared the array global insiide the proc and am using that right now.
Anyway now I'm trying to create sockets and connecting to remote machines form them. Will post here if I need more help.
BTW anyone here who has used sockets from scripts?
Anyway now I'm trying to create sockets and connecting to remote machines form them. Will post here if I need more help.
BTW anyone here who has used sockets from scripts?
Only Human
Re:Tcl/Tk Scripting
I've come across a point in the RFC's for FTP (959) that I cant seem to understand properly.
FTP reuqires 2 connections one control and another data connection.
How do i set up a data port connection? is there some predefined port for this, 21 is the control port only AFAIK.
<edit>
Should have read this ....
The RFC says that
</edit>
FTP reuqires 2 connections one control and another data connection.
How do i set up a data port connection? is there some predefined port for this, 21 is the control port only AFAIK.
<edit>
Should have read this ....
The RFC says that
Does this mean 22 is the server data port?Both the user and the server-DTPs have a default data port. The user-process default data port is the same as the control connection port (i.e., U). The server-process default data port is the port adjacent to the control connection port (i.e., L-1).
</edit>
Only Human
Re:Tcl/Tk Scripting
Port 20 is used for FTP data, although you generally either tell the server your port with a PORT command, or use passive mode, in which case server gives you an address to connect to.
Not that I've ever bothered to really learn FTP. So far HTTP (or some 3rd party library capable of FTP) has sufficed for my purposes.
Port 22 btw is SSH.
Not that I've ever bothered to really learn FTP. So far HTTP (or some 3rd party library capable of FTP) has sufficed for my purposes.
Port 22 btw is SSH.
Re:Tcl/Tk Scripting
I've been trying to manually replay a file transfer session using FTP, so far all I've been able to do is use execute only the Access Control commands (USER, PASS, PWD etc).
I tried a RETR but just get an errror saying
How is this done? I can't open a connection to port 20 too.
Is someone knows the steps that take place before and after a file transfer please let me know.
I tried a RETR but just get an errror saying
I can't transfer anything either way.425 Can't build data connection: Connection timed out.
How is this done? I can't open a connection to port 20 too.
Is someone knows the steps that take place before and after a file transfer please let me know.
Only Human
Re:Tcl/Tk Scripting
Like I said, you have two options:
1. Listen to some port, and tell the port to the server using PORT command. Server will then connect to that port to open the data connection. To do this manually you need netpipes or equivalent as plain telnet can't listen.
2. Switch to passive mode (PASV or something) in which case the server will give you the hostname and port (in rather esoteric notation) to use. You can then connect to that port (don't remember if you need/can do it before the transfer command, the RFC will tell though).
1. Listen to some port, and tell the port to the server using PORT command. Server will then connect to that port to open the data connection. To do this manually you need netpipes or equivalent as plain telnet can't listen.
2. Switch to passive mode (PASV or something) in which case the server will give you the hostname and port (in rather esoteric notation) to use. You can then connect to that port (don't remember if you need/can do it before the transfer command, the RFC will tell though).
Re:Tcl/Tk Scripting
Will I face any problems in FTP if i always set the transfer mode to binary even when transferring text files?
Only Human
Re:Tcl/Tk Scripting
No.Neo wrote: Will I face any problems in FTP if i always set the transfer mode to binary even when transferring text files?
The files will however have the line endings with which you sent them.