Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language

Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

TCL(Tool Command Language) Scripting

TK/Expect causes BEEP bacause of <CTL> chars, need to disable or filter <CTL> chars

I think I am going crazy. I'm writing a utility in TCL/TK/Expect. Every
thing works great except for one problerm that I have not been able to fix.
I'll explain what the utility does and what the problem is in detail below.
If anyone can hep me fix this I will be forever GREATFULL!!!!

Basically, Expect is sending strings to the user (in the expect_out(buffer))
with a certain <CTL> char. Later I use some of the strings to send back to
the device through expect, but expect (or TK, or the OS) doesn't like the
<CTL chars> and beeps for every char (millions of beeps).

My Configuration:

USER PC <----------------------> Device, or DUT (device under test)
(TCL/TK/Expect)   (ethernet)            (Internet router)

There is a GUI interface, the user starts the program, enters in the
destination IP address to the device that the user wants to configure (the
DUT) with my TK/Expect utility. When the tool runs, it gets the old
configuation from the DUT by sending a command to the device (DUT) and it
saves the config (parses expect_out(buffer) to a file. (NOTE: This fle is
not used now, but can be used at a later time by parsing the file
(extracting the commads), saving them to an array, etc). The user selects
the text file that contains configuration commands, loads the commands (the
utility parses the file for commands), saves the commands to an array, and
then logs into the device (DUT) and sends the commands to the DUT, one
command at a time.

When the commands are sent to the DUT via Expect and telnet, I usually hear
a loud BEEP! It wouldn't be a big deal if I didn't have thoudsands of
commands, and a dozen co-workers all using the tol. Can you hear thousands
or millions of BEEPs for 8 hours during the day. Actually, no one would use
it, they would probably just laugh. Anyway, I have tried to change the
settings on the user's OS platform (I used xset on the Sun, and the system
settings for Windows) and the TK/Expect utility it still beeps anyway) .
(Mostly the utility will be used on Windows XP). On the platforms, I
disabled the BEEP on both platforms and the Utility still causes a beep.
When I see the "running display" on the TCL/TK/Expect utility while all the
beeps are occouring, I do see one extra extra control characters over and
over and am pretty certain that Expect sending these control characters to
the DUT is causing the beep. Either Expect, TK, or the OS to beep. In the
text file (with Windows notepad) I do not see the <CTL chars>, all looks
okay, but I do see the <CTL chars> in the tool console and running-log
display. I beleive it's a linefeed or something like that.

This is the character causing the problem: ""
The char doesn't even show up in this message (above), instead I see a
carrage retrn or lne feed or something. When the script runs, I can see the
chrs in the running log. It looks like a verticle bar, or an emply square.

- Daniel K

Posted via a free Usenet account from http://www.teranews.com

At 2007-05-25 02:15AM, "dopeAdd@fukdup.com" wrote:

>  Basically, Expect is sending strings to the user (in the expect_out(buffer))
>  with a certain <CTL> char. Later I use some of the strings to send back to
>  the device through expect, but expect (or TK, or the OS) doesn't like the
> <CTL chars> and beeps for every char (millions of beeps).

What else are you doing with those strings?  Writing them to a log file?
Are you printing them to the screen with puts or send_user?  I suspect
they are Ctl-G (the ascii BEL character)

I assume the functionality is working as expected but the only annoyance
is the beeping.

Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry

disabling logging of matched input to stderr with

        log_user 0

comees to mind.
Check first with

        puts log_user:[log_user]

will be "1" if enabled (default)


Yes, I set log_user to "1" when I debug, but I've tried it with log_user "0"
and still hear the bell. Yes, the program works, but if I send a command and
it fails for some (legitimate) reason I hear the bell and when I login to
the device through telnet/expect, the login banner at the device through
telnet expect has the vertcal bar at the end of every line (I think CTL-G)
and in the middle of some lines. If I telnet to the same device without
using expect I do not see the CTL chars in the telnet sesion, only the
telnet/expect session.

Maybe some term config setting or something. What about stderr, is there any
way to change this to remove the bell on error? I'll try anythng. I will
play with log_user and see if it helps but I remember trying this a while
back but I've made other changes since then so it's worth trying again.
- Daniel

Posted via a free Usenet account from http://www.teranews.com

You didn't answer Glenn's fundamental question: are you, or not,
displaying back on the console what comes back from telnet ?

If yes, then you can simply filter out the ^G's with [string map].
If it goes to the console without your intervention, please say so.


Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc