1

I have a process I'm that I'm constantly having to deal with.

  • It requires I run a command and then enter several pieces of information.
  • Then I'm presented with a curses menu listing several options.

The first half is easy to automate using expect. The second part I don't know of an easy way to automate.

Any suggestions?

Tabitha
  • 965
  • 1
  • 7
  • 14

3 Answers3

1

Unfortunately, expect (from any language) is not really suited to something that isn't a standard screen buffer response. I've seen some implementations that attempt to deal with cursor position updates such as curses but the results are not always effective.

I feel that your time would be better spent researching what operations the curses app is giving you a menu for configure your application do do those items yourself. I've found that nearly every curses menu has a companion cli cmd, or is a front end for one.

If you can share what the curses menu is for the community might be able to assist you with whats going on in the background. If you cant because it's something home grown, you should be able to trap whats going on in the background with something like strace

Hope this helps.

Xarses
  • 321
  • 1
  • 5
  • Thanks sadly the program I'm trying to work around is a partner companies software. We only have access to it by sshing into their box which launches the curses program. I don't have access to the box, or software. I do agree with you in general and in most cases I would be taking the path you suggest. – Tabitha Feb 27 '12 at 02:00
  • Thinking sideways, if the curses app is static( ie the option you want is always the third), you could always send the arrow key codes themselves and then your space and enter key. Its hokey, but should get you over the hump. – Xarses Feb 27 '12 at 02:29
0

Take a look at the hpuifilter utility included with RANCID. It was originally written to help RANCID's expect scripts deal with the curses-like menus of HP switches. However, it's written as a filter, so you can pipe your curses application into it, and it will spit out the plaintext stripped of VT100 control sequences, which should be easier to deal with in expect.

James Sneeringer
  • 6,755
  • 23
  • 27
0

Dialog

http://invisible-island.net/dialog/

Joel K
  • 5,765
  • 2
  • 29
  • 34