Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tcl puts command

Status
Not open for further replies.

NUSkyhawk

Programmer
Jun 3, 2005
2
US
Hello,

In a script I have written there is a stage in the script where output is displayed on the screen which tells the user to please wait for a process to finish. This is timed via the sleep command, and I am wondering if it is possible to display one of those cool looking helicopters or some type of percentage done output to the screen.

example: (Loop through this process so it looks like the bar is a "helicopter blade" and is spinning in the terminal, but appear on the same line)
Step 1.) |
Step 2.) /
Step 3.) --
Step 4.) \

How can I get this to work? I have tried using the flush command, but can't get the output to appear on the same line, effectively overwiting the output before it to make the bar look like it's spinning.

Thanks
 
Hi,


Code:
# to prevent puts from going to the next line use
puts -nonewline "Hallo"
flush stdout

# to make puts restart the current line use
puts -nonewline "something\r"
flush stdout

Since you want the result look like an "helicopter animation" it is important that you call "flush stdout" after every puts.

Greetings,
Tobi


 
Actually, I used the -nonewline and flush stdout commands in conjunction with a "puts -nonewlinw "\b" to erase the output. The "\b" is a backslash which deletes the text so I can replace it in the command line...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top