Re: expect script doesnt pass graphics chars correctly



On May 19, 7:07 am, Jeremy Cook <jeremy.c...@xxxxxxxxxxx> wrote:
Hi folks,

My expect script needs to automate login to a terminal server which is
running a text based interface. The text based program assumes "scoansi"
terminal type and "ibm850" character encoding.

When I carry out the login steps by hand everything works beautifully
and the ansi graphics look good (well as good as it gets...). However
when I try to automate this with expect, something is going wrong with
the terminal emulation/setup/whatever and the graphics characters do not
show properly. I feel it must be some sort of tty mode issue, but have
not been able to find a solution. Any and all comments are welcome.

A transcript of my script:

#!/usr/bin/expect -f
spawn -nottyinit ssh -t some...@xxxxxxxxxxxx
set ssh $spawn_id
expect "*?assword: "
send -- "yadayada\r"
expect "\u0005"
stty -echo
send -- "okydoky\r"
stty raw -echo
interact -reset -output $ssh

Now I can interact, but all of the graphics chars are garbled.

eg ?Ã"Ã"Ã"Ã"Ã"Ã"Ã"Ã"Ã"Ã"Ã"Ã"Ã"Ã"Ã"Ã"Ã"Ã"Ã"
instead of -----------------

Any ideas? Or can I jump out of expect somehow at the end (I dont need
it anymore once the last send has been done).

Jeremy


About 5 years ago I used expect to automate terminal based SAP
administration. I had the same problem with the ANSI terminal and as
far I can remember now, there was no way around it. What you see on
the screen is not what Expect sees. The terminal driver translates the
characters to be suitable for your screen and you don't see any
control sequences but Expect does. Also, the drawing of the text on
the terminal screen does not always happen sequentially (any part of
the screen can be repainted at any time by the terminal driver).
Meanwhile, expect reads everything sequentially. What I have done is
discard irrelevant data and only look for distinct peaces of relevant
data. It is somewhat a brute force programming and is not very exact,
although it worked just fine for me. First, use the autoexect script
to record your entire session and then modify the captured session to
suit your needs. The Expect book also mentions the same problem and
the advice has been similar to what I have done, as far as I can
remember.

Hope that helps,

---Victor
.



Relevant Pages

  • Re: Newbie php problem
    ... The OP said that their script would send email without ... Another common way is that spam bots will hit commonly ... you betcha he would automate it soon enough. ...
    (alt.php)
  • Re: OO-COBOL for Unisys IX
    ... >>Our biggest problem is that our configuration management system has been ... >>scripted to automate a mainframe compile from a ... >> us to try to script that, then send the intermediate results up to the ...
    (comp.lang.cobol)
  • Re: Newbie php problem
    ... The OP said that their script would send email without ... CAPTCHA images are hackable/readable by the bots, ... you betcha he would automate it soon enough. ... contact form could have anything to do with its action script. ...
    (alt.php)
  • Re: Newbie php problem
    ... and the script only executes the mail function ... hidden field to prevent blank emails, but spambots pass common variable ... bots (form mail spam bots, ... you betcha he would automate it soon enough. ...
    (alt.php)
  • Re: SSL and ISA 2000 on SBS 2000
    ... but the KB is vague on whether the VB script needs ... I ran a Google search on "ISA SSL changing port" and I ... >> Have a client that needs to access a website via SSL ...
    (microsoft.public.backoffice.smallbiz2000)