I have a software - FUNCOR2.exe - for calculating the autocorrelation function given a data file, i.e. test.txt.
First, I execute FUNCOR2.exe from Windows command line and then the program takes control and asks me for the input data file.
I want to automate this in Python, so I can use working:
os.system("FUNCOR2")
But then I am not able to type INTO the program the input file name.
So far I've tried:
PressKey(0x54) # T
PressKey(0x45) # E
PressKey(0x53) # S
PressKey(0x54) # T
PressKey(110) # .
PressKey(0x54) # T
PressKey(0x58) # X
PressKey(0x54) # T
which I took from Generate keyboard events, but it does not work, and also:
win32api.keybd_event(0x54, 0)
win32api.keybd_event(0x45, 0)
win32api.keybd_event(0x53, 0)
win32api.keybd_event(0x54, 0)
win32api.keybd_event(110, 0)
win32api.keybd_event(0x54, 0)
win32api.keybd_event(0x58, 0)
win32api.keybd_event(0x54, 0)
it does not work either.
This program does not accept arguments, so I cannot use:
FUNCOR2.exe test.txt
I've found something similar in here: Writing in the cmd after executing an app.exe from java, but not at all.
Any ideas?
subprocess.SendKeys) and then call it from Python. You'll encounter many of the same issues, but using a language which is closer to Windows. At the very least, you'll find more resources about running MS-DOS programs withSendKeysthen you will find about using Python.