Previous Topic

Next Topic

Book Contents

Book Index

What to remove from the expect line?

Many times capturing a menu traversal like GE Centricity/IDX, the non-human readable characters can and should be removed to make the lines more readable and keep the size of the commands lines less than 255. Lines can be re-duce down to as a few characters as you like. Typically, it's best to leave at least one character so the timing can be managed if needed. Also, it's helpful to keep human readable information. Watch out for menu inserted dates that appear in the "expect" lines because these will change daily. You need to remove these dates because they will never be the same day to day. In the example below "##" is the pre-edited version.

expect "Terminal"

send -- "C-VT220\r"

expect "Override this specification? NO=> "

send -- "\r"

expect "Select Function: "

send -- "30\r"

expect "Select Activity:"

send -- "1\r"

expect "Device:"

send -- "\r"

expect "Right Margin:"

send -- "\r"

expect "Advanced Options?:"

send -- "Y"

expect "Device:"

send -- "/db/per/Claims/lov10hBluetmp.nop\r"

## Parameters: \"RWSN\" => "

expect "=> "

send -- "\r"

expect "Form:"

send -- "1298\r"

##Is this the one Y=>

expect "=>"

send -- "Y\r"

expect "Begin new run?"

send -- "Y\r"

##Do you want the formatter? NO=>

expect "NO=>"

send -- "\r"

## Do you want to queue this activity? No=>

expect "No=>"

send -- "\r"

expect "Select Activity: "

send -- "\r"

expect "Select Function: "

send -- "\r"

expect "PER>"

send -- "h\r"

expect eof

By default autoexpect adds lines at the beginning of the script that add control to the script. One of those controls is the delay in between lines. This delay is very helpful in driving menu session such that the response "send" doesn't occur too quickly. Another control allows you to force a breakout of the script if the menu session hangs on a "send" or "expect".

Many times a menu transversal is a sequence of "down arrows" until you reach a particular menu choice. You can remove the repeated "expect" "send" pairs with a "while" loop. This becomes handy if your menu selections are changed by the development staff. When using a "while" loop the menu selection will continue to work even as additional menu selections are added and removed.

See Also

Appendix C - Using expect with EnterpriseSCHEDULE

General guidelines

Using expect’s record feature to capture an interactive session

Common edit changes made to Autoexpect recorded scripts

Breaking expect Jobs into reusable pieces using include within a Job

Creating Expect prototype Job Templates