You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
import psutilimport pyautogui as send_inputimport subprocessimport osCLICKER_START_COM = os.path.expandvars('"%userprofile%\Documents\clickerP.exe" 20')class clicker_manager: def __init__(self): self.proc_id = None for process in psutil.process_iter(): if process.name() == 'clickerP.exe': self.proc_id = process.pid break print(self.proc_id) if self.proc_id is None: self.proc_id = subprocess.Popen(CLICKER_START_COM).pid self.on = False def toggle(self): send_input.press('tab') self.on = not self.on
def turn_off(self): if self.on: self.toggle()
def turn_on(self): if not self.on: self.toggle()
def kill(self): try: proc = psutil.Process(self.proc_id) for sub_proc in proc.children(recursive=True): sub_proc.kill() proc.kill() except psutil.NoSuchProcess: passif __name__ == "__main__": test = clicker_manager()
|