Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Using Expect in a ActivePerl envirnoment

by TASdvlper (Monk)
on Jun 08, 2004 at 14:48 UTC ( [id://362358]=perlquestion: print w/replies, xml ) Need Help??

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

Hi All,

I've read a FAQ that Active Perl (Windows) does not support Expect. Is this true, and if so, is there a good alternate method ??

Basically, I have a program in Windows that's interactive and has about 10 different menus. So, I would like to automate this. So for example, say that program is mytest (executable) I would like to entering the following choices (1, 2, yes, no, 5, 6, yes, yes, no, 7, 10). Each choice followed by a carriage return, of course.

Any help would be greatly appreciated.

Thanks all.

***UPDATE***

So, I'm guessing I can not use Expect so I guess what I need to do it make STDIN a variable in the script (if you know what I mean) ?

  • Comment on Using Expect in a ActivePerl envirnoment

Replies are listed 'Best First'.
Re: Using Expect in a ActivePerl envirnoment
by BrowserUk (Patriarch) on Jun 08, 2004 at 15:17 UTC

    You can do this using Win32::Console. Be warned, it is non-trivial. The documentation in the module is sparse and the included links to the MSDN documentation are out of date ( go here for an overview and links to the API docs ).


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
Re: Using Expect in a ActivePerl envirnoment
by Fletch (Bishop) on Jun 08, 2004 at 15:00 UTC

    Expect runs things on a pseudo-terminal (pty) via IO::Pty. A pty is a Unix-ism for a fake serial termnial (tty) device that behaves (more or less) the way a serial console would. Windows console mode . . . stuff (for lack of a better term) doesn't work this way and hence there's no pty-y mechanism for Expect to use. You might see if the IPC::Run module's expect-like stuff works on Wintendo.

Re: Using Expect in a ActivePerl envirnoment
by jfroebe (Parson) on Jun 08, 2004 at 15:34 UTC

    Hi,

    Active State has Expect for Windows 1.0. This is probably what you are looking for.

    Jason L. Froebe

    No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1

Re: Using Expect in a ActivePerl envirnoment
by Mr. Muskrat (Canon) on Jun 09, 2004 at 00:17 UTC
    Another fine module for this sort of thing is Win32::GuiTest. You start your script, have it find the window handle of the executable that you wish to interact with, and then feed it keystrokes and/or mouse movements and clicks.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://362358]
Approved by Paladin
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-25 23:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found