tcl

How to do lappend in a while loop using regexp

ⅰ亾dé卋堺 提交于 2020-01-25 03:08:33
问题 when I am using the while loop to match a variable using regexp I want the matched variable to form a list by using lappend. The code is set file_name [open filename.txt r] set newlist [list] while {[gets $file_name line] >= 0} { regexp {cell \(\"(.*)\"} $line match cell_name if {[info exists cell_name] && $cell_name != ""} { puts "$cell_name" lappend $newlist $cell_name unset cell_name } } foreach item $newlist {puts $item} close $file_name The text which it is matching is like cell ("aabbcc

Running shell commands in background, in a tcl proc

丶灬走出姿态 提交于 2020-01-25 02:03:38
问题 I'm trying to create a tcl proc, which is passed a shell command as argument and then opens a temporary file and writes a formatted string to the temporary file, followed by running the shell command in background and storing the output to the temp file as well. Running the command in background, is so that the proc can be called immediately afterwards with another arg passed to it, writing to another file. So running a hundred such commands should not take as long as running them serially

TCL_REGEXP::How to grep 5 diifferent words from a variable using TCL regexp. And how to send greeped output to each column of excel sheet?

江枫思渺然 提交于 2020-01-25 00:19:26
问题 My TCL script: set line { Jul 24 21:06:40 2014: %AUTH-6-INFO: login[1765]: user 'admin' on 'pts/1' logged Jul 24 21:05:15 2014: %DATAPLANE-5-: Unrecognized HTTP URL www.58.net. Flow: 0x2 Jul 24 21:04:39 2014: %DATAPLANE-5-: Unrecognized HTTP URL static.58.com. Flow: Jul 24 21:04:38 2014: %DATAPLANE-5-: Unrecognized HTTP URL www.google-analytics. com. Flow: 0x2265394048. Jul 24 21:04:36 2014: %DATAPLANE-5-: Unrecognized HTTP URL track.58.co.in. Flow: 0 Jul 24 21:04:38 2014: %DATAPLANE-5-

Problem starting program (vcom) with multiple arguments in TCL

坚强是说给别人听的谎言 提交于 2020-01-24 21:09:05
问题 I'm trying to start a program (vcom) from a TCL script with extra options: set compilationArgs "-quiet -93" vcom $compilationArgs -work work polar2rect/sc_corproc.vhd But when I run this, I get following error message: # Model Technology ModelSim ALTERA vcom 6.5e Compiler 2010.02 Feb 27 2010 # ** Error: (vcom-1902) Option "-quiet -93" is either unknown, requires an argument, or was given with a bad argument. # Use the -help option for complete vcom usage. # /opt/altera/10.0/modelsim_ase

Strawberry Perl v5.30.0 not able to install Tcl (Windows 10)

大城市里の小女人 提交于 2020-01-24 20:26:05
问题 I downloaded and installed strawberry-perl-5.30.0.1-64bit.msi from strawberryperl.com on my Windows 10 and tried to install Tcl module using cpan, but it fails for missing tclsh. What could be the problem? C:\Strawberry>cpan Tcl Loading internal logger. Log::Log4perl recommended for better logging CPAN: CPAN::SQLite loaded ok (v0.217) Database was generated on Thu, 24 Oct 2019 12:40:15 GMT Running install for module 'Tcl' CPAN: Digest::SHA loaded ok (v6.02) CPAN: Compress::Zlib loaded ok (v2

Tcl/Tk LstBox width in CombBox

流过昼夜 提交于 2020-01-24 18:17:07
问题 How can I configure the listbox component width in a combobox, so that it will fit to longest entry? The widget width itself (the entry component) can be short, but I'm looking for a way to configure the listbox component to be wider than the entry... 回答1: This is possible, but not without a bit of hacking ;) You can find the implementation of combobox in combobox.tcl (in my case /usr/share/tcltk/tk8.5/ttk/combobox.tcl . There you see that if you have a combobox set cb [ttk::combobox .cb

Python pass more than one arguments to tcl proc using Tkinter tcl.eval

孤街浪徒 提交于 2020-01-24 13:56:05
问题 how to pass more than one arguments to tcl proc using Tkinter. i want to pass 3 args to tcl proc tableParser from python proc validate_op which has 3 args... from Tkinter import Tcl import os tcl = Tcl() def validate_op(fetch, header, value): tcl.eval('source tcl_proc.tcl') tcl.eval('set op [tableParser $fetch $header $value]') <<<<< not working proc tableParser { result_col args} { .. .. .. } 回答1: The simplest way to handle this is to use the _stringify function in the Tkinter module. def

Tcl基础

故事扮演 提交于 2020-01-22 16:42:42
tcl简介 Tcl 表示工具命令语言(Tool Command Language),属于动态变成语言,它是一种流行的脚本编制语言,最初由加州大学伯克利分校的 John Ousterhout 教授开发。John Ousterhout 打算将 Tcl 作为一种将其它程序组件粘合在一起的语言,既可以以同其它脚本语言相同的方式将 Tcl 用作交互式 shell/脚本解释器,也可以将其作为脚本解释器嵌入您自己的 C 应用程序。在这种方式下,它就变成了一种向您自己的程序中添加脚本编制控制的方法,并且它提供了一些接口,这些接口允许您用自己的以 C 语言实现的脚本命令扩展基本 Tcl 语言. Tcl 还有各种扩展,诸如 Tk,UI 工具箱,以及 Expect,Expect 是一种扩展,用于自动化同其它基于 shell 的命令(例如 telnet 和 ftp)的交互。 Tcl是一种很通用的脚本语言,它几乎在所有的平台上都可以解释运行,功能强大。 Tcl包含了两个部分:一个语言和一个库。   首先,Tcl是一种简单的脚本语言,主要使用于发布命令给一 些互交程序如文本编辑器、调试器和shell。它有一个简单的语法 和很强可扩充性,Tcl可以创建新的过程以增强其内建命令的能力。 其次,Tcl是一个库包,可以被嵌入应用程序,Tcl的库包含了一个分析器、用于执行内建命令的例程和可以使你扩充(定义新的 过程

How to run a Tcl Script in a folder in Python?

人盡茶涼 提交于 2020-01-22 03:52:07
问题 I have a Tcl script stored in C:/ How do I run it from Python? (It is not write the Tcl script in python and then run it) To clarify my question, firstly I have a Tcl-based programme called oommf, which is used for simulation. Here is a short introduction http://math.nist.gov/oommf/ I wrote some scripts by this programme and would like to use python to run a series of simulation and then extract the data to plot some graph. The script in in .mif format, and what I wish to do is Use python to

Tcl C API: redirect stdout of embedded Tcl interp to a file without affecting the whole program

a 夏天 提交于 2020-01-22 03:05:11
问题 #include <tcl.h> int main(int argc, char** argv) { Tcl_Interp *interp = Tcl_CreateInterp(); Tcl_Channel stdoutChannel = Tcl_GetChannel(interp, "stdout", NULL); Tcl_UnregisterChannel(interp, stdoutChannel); Tcl_Channel myChannel = Tcl_OpenFileChannel(interp, "/home/aminasya/nlb_rundir/imfile", "w", 0744); Tcl_RegisterChannel(interp, myChannel); Tcl_Eval(interp, "puts hello"); } In this code I have tried to close stdout channel and redirect it to file. (As described Get the output from Tcl C