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 you below too as <a href="http://stackoverflow.com/users/1832058/furas">furas</a> said. Thanks furas. :smile:</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 psutil as psutil

for proc in psutil.process_iter():
    proc_name = proc.name()
    if proc_name == 'chrome.exe':
        print('chrome is running now.')

        # open your program in this position

    else:
        print(proc_name)</code></pre>
</div>
</div>
</p>

python