How to gather input from Windows command line

Asked by Mychal Miller

I want to use a command window (in Windows) to display a test menu so that a specific test module can be selected by the user. To display the menu I'll use either sikuli "type" command to either type the menu or type a command to display the contents of a text file containing the menu. After displaying menu text how would I prompt and gather the input in the command window?

I know I could display the menu and gather the input in a popup, but I would like to keep user interaction contained to the testing menu window. I may also be using this window to display real-time test results, testing notes, status messages for QA, etc and want that window to be the primary source of input. There are other windows that may require interaction during the tests, but most of the interaction with the other windows will be automated.

I've tried a coupleversions of Python's (v2.7) raw_input but the script hung at the command.
testMenuReturn = raw_input("Main Menu Selection: ")
testMenuReturn = sys.raw_input("Main Menu Selection: ")

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

If you want to either use
input = sys.stdin.readline()

or
input = raw_input("some text: ")

the script has be to run from the command line or run as a subprocess of the command window main process.

And then you do not need type(), just use print, to display what you want.

Revision history for this message
RaiMan (raimund-hocke) said :
#2

BTW: Sikuli uses Jython, which is on the Python language level 2.5

Can you help with this problem?

Provide an answer of your own, or ask Mychal Miller for more information if necessary.

To post a message you must log in.