I finally found my solution and it works!!
I didnt have to use expect, i think my problem was when I try to open the file, I use system. I should have use open. Now I have automatic user input. Thanks everyone for their help and info, learned lots of stuff about Expect and seems very useful.
here my code using Expect...
#!/usr/bin/perl
use strict;
use warnings;
use Expect;
my $selection = "option1"
my $openprogram = system("progam.exe");
my $exp = Expect->spawn($openprogram) or die;
$exp-> send ("$selection");
It does not work :( .. I get error
Cannont exec(0):no such file or...
I got a program, once it execute the program (.exe), it gives 3 options to the User. Option1.. option2.. option3.. Depending on the User input, let say the User select by typing "option1", it runs option1. My question is that is there a way in Perl to write that so the User does not have to type...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.