El lunes, 27 de noviembre de 2023 a las 1:25:06 UTC+1, pd escribió:
So, my question, Is any way to merge a console app and a graphical app in the same tcl script?
Really I'm wrapping the script in a starkit so another point of view is, is there any way to pack in a starkit (starpack) a console app and a graphical app deciding to call one or another based in some criteria?
Ok, I answer myself after simple testing, it's so easy to do that, simply refactor the script as:
----my.tcl---------------------------------------------------------
set cmd scite
if { $argc > 2 } {
puts "executing $cmd"
exec $cmd [lindex $argv 0] [lindex $argv 1] [lindex $argv 2]
exit
} else {
package require Tk
entry .e1 -textvariable p1
entry .e2 -textvariable p2
entry .e3 -textvariable p3
button .b -text "Do it" -command {exec $cmd $p1 $p2 $p3}
pack .e1 .e2 .e3 .b
}
-----------------------------------------------------------------------
and execute it using tclsh rather than wish
sorry for that silly question!
regards
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)