Python Forum
Process execution using Popen
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Process execution using Popen
#1
Hi Everyone,

Good Day!

I learn few things about how to create new process using Subprocess module in Python. Indeed, I am more curious to know if I can open new process and select more functionality of the newly created process.

e.g.

Rather opening just notepad++.exe, I'd like to open a new tab with "Language" select as C.
Also instead of open snipping tool, I'd be glad if I open SnippingTool.exe along with "new snip" option selected.

According to the manual, Subprocess module lets us spawn new processes, connect to their input/error/output pipes, and acquire their return codes.

Specific in Popen, args argument "should be a sequence of program arguments".

Is there any way that I can write my code the way I want in python? Is there any other module that helps me to execute my thoughts?

Thanks in advance!
Reply
#2
(Dec-02-2019, 01:15 PM)Shaswat Wrote: Rather opening just notepad++.exe, I'd like to open a new tab with "Language" select as C.
Ability to do this depends on how notepad++ is developed. If it allows execution via command line something like "notepad++.exe --default-language=C" (I use --default-language option as an example, I don't know anything about notepad++), then you can easily do what you want. If don't, the only way is to run notepad++ and then emulate some actions (move mouse, click on desired tab etc) to get desired result. This question doesn't related to Python and Subproces module in general, everything depends on what you want to get, and how programs are implemented (does they allow external control by design).
Reply
#3
Understood.
Many thanks for the explanation.
P.S. A little web search provide me PyAutoGUI library.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to to tie the execution of one process to another inside a loop in Python ignorant_wanderer 0 2,018 Jul-11-2020, 03:44 AM
Last Post: ignorant_wanderer
  How to sharing object between multiple process from main process using Pipe Subrata 1 3,618 Sep-03-2019, 09:49 PM
Last Post: woooee
  Graphing process execution time Temennigru 4 4,714 Nov-15-2017, 11:54 PM
Last Post: Temennigru

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020