On Tue, Dec 13, 2011 at 3:41 AM, Juan Perez <corleon...@gmail.com> wrote: > I need to automate a .exe console program in windows, and send key > characters like 'a', 'M' ... > I had this running in an autoIT script which with only activating cmd > window, and with the "send" parameter I had all already done. But I'm having > a lot of problems with python, I've tried with process.call, communicate(), > os.popen ... but no results. I can't comunicate with the program and even i > can't maintain it opened more thanĀ a few seconds. If I open a program like > notepad.exe it remains opened but when I try to comunicate with the stdin > pipe just don't write anything to the program.
GUI programs such as Notepad usually don't read from STDIN, which is where text goes if you write to a pipe. You may have to check out how, exactly, the program accepts commands; your autoIT script is probably sending keystrokes using the Wndows GUI, so it works as long as the program has focus. Ideally, look into whether the program has an actual automation mode - and if it doesn't have one, ask the programmer to expose his code directly to a Python script. Hey, it's worth a shot! :) ChrisA -- http://mail.python.org/mailman/listinfo/python-list