tcl

How to toggle Tcl interact and expect for telnet automation?

纵然是瞬间 提交于 2021-01-29 15:59:48
问题 Similar to but different from autoexpect in that autoexpect will always produce the same output for any given input. Whereas, trying to allow for user input sometimes at least. This works in that it passes control back to the user as below: thufir@dur:~/NetBeansProjects/spawnTelnet/telnet$ thufir@dur:~/NetBeansProjects/spawnTelnet/telnet$ tclsh main.tcl got nyc spawn telnet rainmaker.wunderground.com Trying 35.160.169.47... Connected to rainmaker.wunderground.com. Escape character is '^]'. --

llength not returning correct list size

旧巷老猫 提交于 2021-01-29 15:18:11
问题 I have a list which has the elements below. test = {a[1] b[60] c[25] c[36]} I am checking the length of test as below: set result [llength ($test)] This is giving me the error below: list element in braces followed by ")" instead of space What could be the issue? Thanks in advance. 回答1: You might need to review the basics of Tcl syntax Don't put parenthesis around the argument to llength. set x {test = {a[1] b[60] c[25] c[36]}} set result [llength $x] In future questions, it is better to post

When source a Tcl script in Tcl shell, how can I let Tcl print every Tcl command inside the script to the shell?

谁说胖子不能爱 提交于 2021-01-29 14:21:49
问题 Running our software will start a Tcl shell in Terminal, then we can execute a series of tcl commands in this Tcl shell by souce a tcl script file. But the tcl commands inside the tcl script file will not be printed on the Tcl shell, so, we cannot see what commands have been executed by source the tcl script. So my question is, is there any configuration of Tcl can print out the commands in the script when the script been source. Following is an sample tcl script # sample.tcl, composed of 3

Tkinter ttk: background/foregound color will not work on my computer

我只是一个虾纸丫 提交于 2021-01-29 13:10:46
问题 If I run this code via IDLE or a virtual environment in pycharm on both windows 10 and 7: import tkinter as tk from tkinter import ttk x = tk.Tk() y = ttk.Treeview(x) y.insert('',0,values=['red', 'blue'], tags= ('even',)) y['columns'] = ('color1','color2') for item in y['columns']: y.heading(item, text=item) y.tag_configure('even',foreground='yellow',font=('',25)) y.pack() x.mainloop() It changes the font but not the background color. This code does work when run from https://repl.it

How to access and modify a sibling of a Tcl/Tk object in R

我的梦境 提交于 2021-01-29 08:26:59
问题 In short: I use tcltk package in R. But non-R users may suggest ideas too and provide examples in other language than R. I have a list of Tcl/Tk objects in R <Tcl> .1.1.1.1 .1.1.1.2 .1.1.1.3 and want to access and modify each object separately. How can I do it? Or If I have button A object, how can I access and modify button B object? Details: I have the following widget: The code to create it: library(tcltk) top <- tktoplevel() frame_1 <- tkframe(top) tkgrid(frame_1) frame_n <- tkframe(frame

How to make a scrollable frame with canvas in Ruby TK?

这一生的挚爱 提交于 2021-01-29 07:20:19
问题 I need to scroll a frame that contains multiple labels. Since frames aren't scrollable, so i've choosed to use a canvas that contains a frame with these labels in it. But this would be the first time for me using a canvas, so i really don't know where to start, i ended up with this code: canvas=TkCanvas.new(root) {grid :row =>0, :column =>0} frame=TkLabelframe.new(canvas) {grid :row =>0, :column =>0} scroll=Tk::Tile::Scrollbar.new(root) {orient 'vertical'; grid :row =>0, :column =>1, :sticky

Redirect the stdout when loading package in Tcl

一曲冷凌霜 提交于 2021-01-29 02:52:54
问题 I would like to redirect the stdout to null when loading package in Windows Tcl. (Redirect the wording of "Quality Windows Audio/Video Experience (qWAVE) support is available." to null) Is their any way to solve this or any idea for this ?? Thank you so much. C:\Users\Tester>tclsh % set ixchariot_installation_dir "C:/Program Files x86)/Ixia/IxChariot" C:/Program Files (x86)/Ixia/IxChariot % cd $ixchariot_installation_dir % load ChariotExt Quality Windows Audio/Video Experience (qWAVE) support

regexp pattern across multiple lines

笑着哭i 提交于 2021-01-28 22:17:20
问题 I have a long regexp pattern that needs to be matched in TCL regexp {.*%MKA-5-SESSION_START: +\((.*) +:.*\) +MKA Session started for.*([0-9A-Fa-f]{4}.[0-9A-Fa-f]{4}.[0-9A-Fa-f]{4}).*AuditSessionID +(.*), +AuthMgr-Handle +(.*)} $op - intf mac auditsessid authmgrhdl How can i split this to multiple lines , splitting using \ is not working as regexp fails. Thanks, Agnel. 回答1: That is a monster RE. The easiest way to split it up would be to use an extended mode RE by putting (?x) at the start of

Expect/TCL telnet proc does not wait for the prompt

倖福魔咒の 提交于 2021-01-28 10:54:06
问题 I have a Expect proc that sends command for telnet login and send commands. Inside the telnet proc I do a TFTP . The size of the file is 10MB. But the telent prompt does not wait until the prompt appears .It waits for the timeout period and comes off. is there any way we can wait for the prompt in Expect . Regards, Mithun 回答1: If the tftp file transfer takes longer than Expect's default timeout (10 seconds) you will need to set a longer timeout first. Eg. for a 60-second timeout, start your

TCL Expect kills child of child process

旧街凉风 提交于 2021-01-28 06:06:58
问题 I have an expect script like this #!/usr/bin/expect -f set timeout 30 log_user 0 set PASSWORD $::env(PASSWORD) set USERNAME $::env(USERNAME) set TOKEN $::env(TOKEN) puts stderr "Generating OTP" spawn oathtool --totp $TOKEN expect -re \\d+ set otp $expect_out(0,string) puts stderr "Connecting to VPN server" spawn -ignore HUP env openconnect -b https://vpn expect "GROUP:" send "Tech\n" expect "Username:" send "$USERNAME\n" expect "Password:" send "$PASSWORD\n" expect "Password:" send "$otp\n"