如何从另一个 tcl 文件调用一个 tcl 文件
how to call a tcl file from another tcl file
我需要调用一个 tcl 文件,其中包含从另一个 tcl 文件捕获图像的代码。
例如我的 image.tcl 文件代码如下:
proc image {} {
set time [clock format [clock seconds] -format %Y%m%d_%H%M%S]
exec ffmpeg -f dshow -s 1280x720 -i "video=Integrated Webcam" -benchmark c:/test/sample_$time.jpg
}
image
所以,我想从另一个名为 main.tcl 的 tcl 文件调用这个 image.tcl 文件,所以 main.tcl 的代码可以如下所示:
proc a {} {
"c:/test/image.tcl"
"c:/test/video.tcl"
"c:/test/live.tcl"
}
a
当我调用main.tcl
时,上面的tcl脚本应该运行一个接一个
任何解决方案。添加代码作为答案。谢谢。
您需要使用source
。
在 main.tcl 中,您将拥有:
proc a {} {
source "c:/test/image.tcl"
source "c:/test/video.tcl"
source "c:/test/live.tcl"
}
a
我需要调用一个 tcl 文件,其中包含从另一个 tcl 文件捕获图像的代码。
例如我的 image.tcl 文件代码如下:
proc image {} {
set time [clock format [clock seconds] -format %Y%m%d_%H%M%S]
exec ffmpeg -f dshow -s 1280x720 -i "video=Integrated Webcam" -benchmark c:/test/sample_$time.jpg
}
image
所以,我想从另一个名为 main.tcl 的 tcl 文件调用这个 image.tcl 文件,所以 main.tcl 的代码可以如下所示:
proc a {} {
"c:/test/image.tcl"
"c:/test/video.tcl"
"c:/test/live.tcl"
}
a
当我调用main.tcl
时,上面的tcl脚本应该运行一个接一个任何解决方案。添加代码作为答案。谢谢。
您需要使用source
。
在 main.tcl 中,您将拥有:
proc a {} {
source "c:/test/image.tcl"
source "c:/test/video.tcl"
source "c:/test/live.tcl"
}
a