- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am testing some memory using System Console and I would like to make a simple progress bar which will show current progress. For that I would need a backspace character.
The Tcl interpreter from Centos 7 works as expected:
$ tclsh
% puts $tcl_version
8.5
% puts "abc\bd"
abd
But System Console gives this:
% puts $tcl_version
8.5
% puts "abc\bd"
abcd
Is there any way I can delete current characters or maybe whole line in System Console?
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Probably not. System Console is a very crippled console interface which I believe is based on Jacl (a Java TCL interpreter).
You might be better off looking at the Dashboard widgets and see if you can use a progress indicator there. Cheers, Dave- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The solution is so simple that I am almost ashamed to post it. You don't have to delete anything if you dont print anything, so for a very simple progress bar it is enough to print a character on the right iterations.
Here is the code:
set BAR_LEN 50
# ##############################################################################
# Puts top line
proc put_top_line { } {
global BAR_LEN
puts -nonewline "|"
for {set i 0} {$i < $BAR_LEN} {incr i} {
puts -nonewline "-"
}
puts -nonewline "|\n"
}
# ##############################################################################
# Puts# to fill the progress bar, should be called every loop iteration
proc put_filler {cur max} {
global BAR_LEN
if { } {
puts -nonewline "|"
} elseif { } {
puts -nonewline "|\n"
} else {
set curValue
set nextValue
if { } {
puts -nonewline "#"
}
}
}
# ##############################################################################
# Test
put_top_line
for {set i 0} { $i < 1000 } { incr i } {
put_filler $i 999
after 10
}

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page