On Tuesday, October 12, 2021 at 7:38:48 PM UTC-5, luocl wrote:
On 10/13/21 6:32 AM, Hassan Iqbal wrote:
I have a TCL terminal inside a program called "System Console". This is an add-on found with Intel Quartus Prime. In this I need to run a TCL procedure that once started, runs every 500 ms. This happens until a user presses a key at which point, it
stops.
Can this be done in TCL? If so, how?
first please reference https://wiki.tcl-lang.org/page/every to write "
run a TCL procedure that once started, runs every 500 ms."
second [fileevent stdin readable <commandToStopYourInfiniteLoop>]
and then enter event loop for example [vwait forever]
follow the script below
proc runcommand { timeout args } {
# your stuff here
puts "runcommand $args"
after $timeout [list runcommand $timeout {*}$args ]
}
set forever 0
proc handleStdin { fd } {
set char [ read $fd ]
incr ::forever
}
fconfigure stdin -blocking 0 -buffering none
fileevent stdin readable [list handleStdin stdin ]
runcommand 3000 45 67 89
vwait ::forever
puts "all done"
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)