Use Send command of Expect package

HI All,

I am currently working on one command line application on AIX (Unix Platform).Here i need to use Expect package.
By using Expect package at the top of the script,i want to use just Send command of Expect package to send characters like,

  1. Press Enter key
  2. Press spacebar
  3. Press Control B or Control x
  4. Or it could be just type character from keyboard through my perl script in the application.

Please let me know how can i use send command for above mentioned functionalities.I need this information ASAP.

Even if there is any other option than Expect please let me know the commands or package

Any help is much appreciated.

Thanks & Regards,
Neha

check if this is what you want

Hi Yogesh,

I am trying to install IO::Tty and Expect package but everytime it is giving me some problem of dependent packages.So i tried to install ppm on AIX but i couldnt as i am not very comfortable in working on unix platforms.

Please can you tell me on how to install and use Expect package.I have got information about Expect that ,it will take hexadecimal code (Ex.Press Enter key or tab ).

I need this information immediately..Expecting a quick reply.

Thanks,

Using CPAN Modules (Programming Perl)

Thank u very much for the link.

Hi,
Please tell me the send comamnd in Expect for keyboard inputs like pres sspacebar.UP and Down arrow keys.
I am searching in Google but not succeeded.
It is very urgent ..Please let me know.
Thanks,

This only refers to the true expect (which is a subset of tcl) but you can spawn a shell and use the internal parsing debugger (exp_internal 1) to see the expect generated output of your inputs.

#!/usr/bin/tclsh
package require Expect

#globals
exp_internal 1
log_user 0
set timeout 1000

        if \{[catch \{spawn [lindex $argv 0]\} err]\} \{
            puts "$err during exec of [lindex $argv 0]"
            exit
        \}
      
        interact