Reinhart
Reinhart

Reputation: 31

Using python to open a file from an existing running application?

Is it possible to use Python to open a file from an existing running application? For example, I have a notepad application open. If I run os.startfile(newnotepad.txt) it opened up a new notepad application. I would like it to open in the existing one.

Upvotes: 0

Views: 77

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798536

That is completely dependent on the application in question. Some applications do support a mechanism for specifying a document to open via COM or DDE, some may allow you to invoke a second copy with the file as an argument which will tell the first to open that file, and some may have no provision for this at all. You will need to check the documentation of the application in question to see which, if any, it supports.

Upvotes: 2

Related Questions