spranav has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.
  • Comment on Calling hyper terminal and executing commands in hyper terminal from Perl

Replies are listed 'Best First'.
Re: Calling hyper terminal and executing commands in hyper terminal from Perl
by Sinistral (Monsignor) on Mar 30, 2010 at 00:09 UTC

    Since you specifically mention Hyper Terminal, I'm guessing you are running some flavor of Microsoft Windows. That being said, you might want to check out Win32::SerialPort to programmatically interact with the serial port directly, rather than somehow remotely controlling Hyper Terminal

    If you really really want to somehow automate interaction with Hyper Terminal (and that's a not so subtle hint that you probably don't), the canonical Perl module for mucking about with Windows applications is Win32::GuiTest.

      I agree that Win32::SerialPort is the way to go, I have used it myself. The API is not simple and the docs are none too clear, though, so I made my own wrapper to make it simpler to use. In case it is of use to you, I am including below my wrapper class (called Win32::RS232Port) and some snippets from an application of mine that use it.

      The Win32::RS232Port class:

      An example of using the Win32::RS232Port (The app uses the classic hashref-as-object OO style, which is why the serial port object is stored in $self->{serport}):

      # open serial port, create instance of Win32::RS232Port object $self->{serport} = Win32::RS232Port->new($comport_name, handshake => +'rts', baudrate => 9600); if (!defined $self->{serport}) { die "Could not open reference COM por +t"; } # manually set state of handshaking output lines: $self->{serport}->rts_active(1); $self->{serport}->dtr_active(1); # transmit some data: $self->{serport}->qtx("SYST:ERR?\r\n"); sub poll { # call this function regularly to check for received data and to p +ass on any queued data for transmission my $self = shift; if ( defined $self->{serport} ) { # pass on any queued data for transmission $self->{serport}->poll_tx; # handle incoming data: here I'm just appending it to $self->{ +com_rxd} where it can be picked up by code that's interested. my $rx = $self->{serport}->rx_data; if ($rx ne q{}) { $self->{com_rxd} = q{} if !defined $self->{com_rxd}; $self->{com_rxd} .= $rx; } } } sub wait_for_tx_done { my $self = shift; my $tstart = time; while (defined $self->{serport} && $self->{serport}->tx_pending) { $self->poll(); die "Timeout on serial port transmission\n" if time > $tstart ++ 10; } } # close the serial port $self->{serport}->close();

      --

      "Any sufficiently analyzed magic is indistinguishable from science" - Agatha Heterodyne

Re: Calling hyper terminal and executing commands in hyper terminal from Perl
by ww (Archbishop) on Mar 29, 2010 at 23:14 UTC
    I can't read that tiny font where you explained what you've tried and how it failed to satisfy.