Advertisement
Guest User

leaguescript.py

a guest
Aug 1st, 2012
446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. #(C) Kim Lindgren, 2012. Feel free to modify to your hearts content! I can not guarantee that this will work perfectly for everyone
  2.  
  3. #!/usr/bin/python
  4.  
  5. from subprocess import Popen, PIPE, STDOUT
  6.  
  7. command = 'ps ax | grep League'
  8. process = Popen(command, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)
  9. output = process.stdout.read()
  10.  
  11. splitout = output.splitlines()
  12.  
  13. for lines in splitout:
  14.     for words in lines.split(' '):
  15.         for word in words.split('/'):
  16.             #print(word)
  17.            
  18.             if word == 'LolClient.exe':
  19.                 pid = lines.split(' ')[0]
  20.                 print('\nfound it: ' + pid)
  21.                
  22.                 taskset = Popen('taskset -p 1 ' + pid, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)
  23.                
  24.                 out = taskset.stdout.read()
  25.                
  26.                 for line in out.splitlines():
  27.                     print('-----> ' + line)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement