Python 3.5.2 - How to detect a program running i.e "chrome.exe" using stock modules
<p>If I wanted to have a program that detects program running such as 'chrome.exe' then opens a program <code>message.txt</code> in this case</p>

<p>Psuedocode:</p>

<pre><code>import os
if "chrome.exe" is running:
   os.startfile("message.txt")
</code></pre>

<p>You could use wmi package to check running process in windows like below snippet.</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>import wmi

c = wmi.WMI()

for process in c.Win32_Process():
    if process.Name == 'chrome.exe':
        print('chrome is running now.')

        # open your program in this position
        
    else:
        print(process.Name)</code></pre>
</div>
</div>
</p>

python