[apologies for top post]
All there is to know about os.startfile() is in Python's docs. The only way to achieve the effect you desire is to do what the "Start Menu..." action does - explicitly open an instance of the application (and not all applications will open new instances; some will always open an existing instance if one exists). You don't state what version of Python you're using. Assuming it is at least 2.6, you may wish to investigate the subprocess module and possibly the multiprocessing module. You will have to explicitly identify the application required to open the file, as you would with os.system(). If the application you wish to run supports COM (such as MS Word/Excel etc do), you could try PythonWin or comtypes, either of which will give much more control such as saving the file and exiting cleanly. Other than COM, application automation on Windows requires Windows API programming to send the necessary messages to application windows - this is what AutoIt does. I believe that people have written Python code to do this; googling "python application automation" might give you some ideas. -------------------------> "These thoughts are mine alone!" <--------- Andrew MacIntyre Operations Branch tel: +61 2 6219 5356 Communications Infrastructure Division fax: +61 2 6253 3277 Australian Communications & Media Authority email: andrew.macint...@acma.gov.au http://www.acma.gov.au/ From: python-win32-bounces+andrew.macintyre=acma.gov...@python.org [mailto:python-win32-bounces+andrew.macintyre=acma.gov...@python.org] On Behalf Of Tony Cappellini Sent: Friday, 4 February 2011 7:52 AM To: python-win32@python.org Subject: [python-win32] Using os.startfile() for automation On Windows XP, I'm able to launch the application associated with file1.xxx. os.startfile("file1.xxx") I want to start more instances of the application, so that I can process several files at the same time. calling os.startfile("file2.xxx") causes the instance of the application to also open file2.xxx. The problem with this is- I have to wait until file1 has finished processing, before I can start file2. If, after opening the first instance for file1, I can use the Start Menu, Program Files, open another instance of the application, I can then start processing file2 at the same time as file1, but using a separate instance. Is there any other way to invoke startfile() or other function- to force a new instance of the application to open? How would I close the application from Python, that was started with os.startfile()? Once the application is open, I just want to use File Save As Text, to get the data into a text file. Python's app-automation capabilities are kinda weak and not well documented, so I may resort to AutoIt3. Thanks NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
_______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32