Skip to content

Instantly share code, notes, and snippets.

@empirefx
Last active August 29, 2015 13:57
Show Gist options
  • Save empirefx/9687074 to your computer and use it in GitHub Desktop.
Save empirefx/9687074 to your computer and use it in GitHub Desktop.
ProccessIsRunning
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");
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