Last active
August 29, 2015 13:57
-
-
Save empirefx/9687074 to your computer and use it in GitHub Desktop.
ProccessIsRunning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import subprocess | |
def is_running(process): | |
s = subprocess.Popen(["ps", "axw"],stdout=subprocess.PIPE) | |
for x in s.stdout: | |
if re.search(process, x): | |
print process | |
print "Se encontro" | |
return True | |
#print "No encontrado..." | |
return False | |
processList = ['firefox', 'bash'] | |
is_running("firefox"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def iTunesRunning(): | |
import win32ui | |
# may need FindWindow("iTunes", None) or FindWindow(None, "iTunes") | |
# or something similar | |
if FindWindow("iTunes", "iTunes"): | |
print "Found an iTunes window" | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment