Hello ALl,
I have a compiled program "conv.exe" that works as follows:
>>conv.exe
-----------------------------
Please selection from the following options. press "h" for help, "p" for
print, "r" for readfile.
Enter your request now:
....
--------------------
Is there a way to script python using the subprocess method to start this
program "conv.exe" and then send a "r" to the command line to make it, say,
readfile.
I have tried the following but the .communicate("r) is not doing anything
import subprocess
import time
a=subprocess.Popen("c:\\mcml\\conv.exe")
time.sleep(1)
(stdout, stderr) = a.communicate("r")
Many thanks,
Bryan 3 1835
On Aug 7, 9:48 am, "mclaugb" <mcla...@nospm.yahoo.comwrote:
Hello ALl,
I have a compiled program "conv.exe" that works as follows:>>conv.exe
-----------------------------
Please selection from the following options. press "h" for help, "p" for
print, "r" for readfile.
Enter your request now:
...
--------------------
Is there a way to script python using the subprocess method to start this
program "conv.exe" and then send a "r" to the command line to make it, say,
readfile.
I have tried the following but the .communicate("r) is not doing anything
import subprocess
import time
a=subprocess.Popen("c:\\mcml\\conv.exe")
time.sleep(1)
(stdout, stderr) = a.communicate("r")
Many thanks,
Bryan
Use the sys.argv method. In the code that you have compiled, put the
following lines in:
<code>
import sys
default = sys.argv[1]
if default:
# check which option it is and run it appropriately
else:
# print your menu here
</code>
Then you should be able to do the subprocess Popen command:
subprocess.Popen("c:\\mcml\\conv.exe r")
You may need to turn the shell on...
subprocess.Popen("c:\\mcml\\conv.exe r", shell=True)
Hopefully that gives you some ideas anyway.
Mike
At the moment, I cannot figure a way of running this precompiled "conv.exe"
using commandline arguments.
Thus, I need Python to call the program, wait until it loads up, then enter
a known sequence of characters so that the function will run.
The program conv.exe I call looks like this.
--------------------------
Welcome to conv.exe
This program was written by ....
Please select from the following options: h- (help) r- (read) ...etc
Enter your request:
---------------------------------
I need Python to start the program, wait a second and then issue a few
characters to the program.
Hope this makes more sense!
Bryan
<ky******@gmail.comwrote in message
news:11**********************@e9g2000prf.googlegro ups.com...
On Aug 7, 9:48 am, "mclaugb" <mcla...@nospm.yahoo.comwrote:
>Hello ALl, I have a compiled program "conv.exe" that works as follows:>>conv.exe
----------------------------- Please selection from the following options. press "h" for help, "p" for print, "r" for readfile. Enter your request now: ... -------------------- Is there a way to script python using the subprocess method to start this program "conv.exe" and then send a "r" to the command line to make it, say, readfile.
I have tried the following but the .communicate("r) is not doing anything
import subprocess import time
a=subprocess.Popen("c:\\mcml\\conv.exe") time.sleep(1) (stdout, stderr) = a.communicate("r")
Many thanks, Bryan
Use the sys.argv method. In the code that you have compiled, put the
following lines in:
<code>
import sys
default = sys.argv[1]
if default:
# check which option it is and run it appropriately
else:
# print your menu here
</code>
Then you should be able to do the subprocess Popen command:
subprocess.Popen("c:\\mcml\\conv.exe r")
You may need to turn the shell on...
subprocess.Popen("c:\\mcml\\conv.exe r", shell=True)
Hopefully that gives you some ideas anyway.
Mike
On Aug 7, 11:07 am, "mclaugb" <mcla...@nospm.yahoo.comwrote:
At the moment, I cannot figure a way of running this precompiled "conv.exe"
using commandline arguments.
Thus, I need Python to call the program, wait until it loads up, then enter
a known sequence of characters so that the function will run.
The program conv.exe I call looks like this.
--------------------------
Welcome to conv.exe
This program was written by ....
Please select from the following options: h- (help) r- (read) ...etc
Enter your request:
---------------------------------
I need Python to start the program, wait a second and then issue a few
characters to the program.
Hope this makes more sense!
Bryan
<kyoso...@gmail.comwrote in message
news:11**********************@e9g2000prf.googlegro ups.com...
On Aug 7, 9:48 am, "mclaugb" <mcla...@nospm.yahoo.comwrote:
Hello ALl,
I have a compiled program "conv.exe" that works as follows:>>conv.exe
-----------------------------
Please selection from the following options. press "h" for help, "p" for
print, "r" for readfile.
Enter your request now:
...
--------------------
Is there a way to script python using the subprocess method to start this
program "conv.exe" and then send a "r" to the command line to make it,
say,
readfile.
I have tried the following but the .communicate("r) is not doing anything
import subprocess
import time
a=subprocess.Popen("c:\\mcml\\conv.exe")
time.sleep(1)
(stdout, stderr) = a.communicate("r")
Many thanks,
Bryan
Use the sys.argv method. In the code that you have compiled, put the
following lines in:
<code>
import sys
default = sys.argv[1]
if default:
# check which option it is and run it appropriately
else:
# print your menu here
</code>
Then you should be able to do the subprocess Popen command:
subprocess.Popen("c:\\mcml\\conv.exe r")
You may need to turn the shell on...
subprocess.Popen("c:\\mcml\\conv.exe r", shell=True)
Hopefully that gives you some ideas anyway.
Mike
Oh. I thought you had compiled the program yourself. I suppose you
could use SendKeys then. I have a couple links here: http://pythonlibrary.org/python/SendKeys
It's pretty hackneyed, but I've used the SendKeys module to automate
Firefox to some degree.
Mike This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Xah Lee |
last post by:
Python Doc Problem Example: os.system
Xah Lee, 2005-09
today i'm trying to use Python to call shell commands. e.g. in Perl
something like
output=qx(ls)
in Python i quickly located the...
|
by: Kurt B. Kaiser |
last post by:
Patch / Bug Summary
___________________
Patches : 421 open ( +3) / 3530 closed ( +8) / 3951 total (+11)
Bugs : 963 open ( +4) / 6426 closed (+21) / 7389 total (+25)
RFE : 255 open...
|
by: Jonathan Fine |
last post by:
Hello
My problem is that I want a Python 2.4 module on
a server that is running Python 2.3. I definitely
want to use the 2.4 module, and I don't want to
require the server to move to Python...
|
by: Aidan |
last post by:
Hi,
I'm having a bit of trouble with a python script I wrote, though I'm not
sure if it's related directly to python, or one of the other software
packages...
The situation is that I'm trying...
|
by: bruce |
last post by:
hi...
can someone point me to where/how i would go about calling a ruby app from a
python app, and having the python app being able to get a returned value
from the ruby script.
something...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |