Reputation: 59
maybe my question is stupid but I would be very happy if someone could help, I have some executable file that I got from my teacher, this executable file ask for the answer of some math problem and if you run it on CMD it's look like:
C:\Users\guyzw>solveme.exe
Hello fellow, can you solve this math problem?
2 x 7?
>
I'm run this exe file on my linux machine using wine, I want to write some of script in bash or python to insert the answer automatically, my question is how can I do so? this exe file doesn't get args so I don't now where to begin...
Any help would be appreciated.
Upvotes: 0
Views: 212
Reputation: 11
You can use the subprocess module to run external programs from within a Python script.
For example,
>>> output = subprocess.Popen("solveme.exe", stdout=subprocess.PIPE)
>>> output.communicate()[0]
'hello fellow, can you solve this math problem?\n\n2 x 7?\n'
>>>
Upvotes: 1
Reputation: 1883
Checkout xdotool: https://github.com/jordansissel/xdotool
It allows you to create fake keyboard and mouse input in linux.
Upvotes: 0