Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Command Line Program Wrapper

by lospinoj (Initiate)
on Apr 15, 2016 at 14:43 UTC ( [id://1160527]=perlquestion: print w/replies, xml ) Need Help??

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

Hello, Trying to write a script that will kick of a command line program on Windows and interact with it. That is instead of me reading the screen and responding, I want the script to do that while I just watch. And yes if only there was a module to take the place of the Windows program that'd be way better, but there's not. I've poked around with Win32::Console a bit, but if that's the solution my wee brain's not connecting the dots. Any insights would be most appreciated. J-

Replies are listed 'Best First'.
Re: Command Line Program Wrapper
by graff (Chancellor) on Apr 15, 2016 at 17:02 UTC
    Sounds like you're looking for Expect.
Re: Command Line Program Wrapper
by Marshall (Canon) on Apr 15, 2016 at 18:27 UTC
    SimonPratt mentioned that this might be an XY problem. To further clarify the terminology, here is one of many links that explain what that is: http://xyproblem.info/. If you back up a bit and explain more about X to us, there may be some really simple solution to the problem.

    Update: perhaps an example...some of these things ask a fixed set of questions in the same order every time, in that case sometimes all that is needed is a file with "the answers" which gets redirected into the program. It might or might not be necessary to "read the questions".

Re: Command Line Program Wrapper
by SimonPratt (Friar) on Apr 15, 2016 at 16:18 UTC

    What are you trying to do?

    What application are you trying to interact with?

    What code have you written (and specific issues you have with it)?

    Just a bit concerned this might be the beginning of an XY problem

Re: Command Line Program Wrapper
by NetWallah (Canon) on Apr 15, 2016 at 17:34 UTC
    If you are trying to enter text into a console window, the "SendKeys" facility in Win32::GuiTest should fit the bill with minimal hassle.

            This is not an optical illusion, it just looks like one.

Log In?
Username:
Password:

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

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

    No recent polls found