Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # https://youtu.be/Vas20qurw28
- import pyaudio
- import speech_recognition as sr
- import os, sys
- import pyttsx3
- import random
- import webbrowser
- import psutil
- import time
- import subprocess as sp
- os.system("title docController")
- def closeAll():
- os.system("taskkill /f /im winword.exe")
- os.system("taskkill /f /im XLVIEW.EXE")
- os.system("taskkill /f /im excel.exe")
- os.system("taskkill /f /im powerpnt.exe")
- os.system("taskkill /f /im wordpad.exe")
- os.system("taskkill /f /im vlc.exe")
- os.system("taskkill /f /im msedge.exe")
- os.system("taskkill /f /im Microsoft.Photos.exe")
- def pidFullList(typProcess):
- a = []
- for process in psutil.process_iter():
- if process.name() == typProcess:
- a.append(process.pid)
- return a
- def pidGet(typProcess):
- global listPid
- a1 = pidFullList(typProcess)
- os.startfile("D:/ТШО курсы/сертифы/Certificate project.xlsm")
- os.startfile("D:/ТШО курсы/сертифы/Certificate project.xlsm")
- time.sleep(1)
- a2 = pidFullList(typProcess)
- listPid=list(set(a2) - set(a1))
- print(listPid)
- return listPid
- def closeByPid():
- #https://ab57.ru/cmdlist/taskkill.html
- checkVarible()
- if listPid != None:
- for element in listPid:
- print(element)
- os.system("taskkill /PID "+str(element))
- def checkVarible():
- global listPid
- try:
- listPid
- except NameError:
- print("ничего не открыто внутри")
- listPid = None
- while True:
- choice = int(input("closeAll - 0, OpenDoc - 12, CloseDoc - (-12): "))
- if choice == 0:
- closeAll();print(" +close")
- elif choice == 12:
- listPid = pidGet("EXCEL.EXE");print(" +OpenDoc")
- elif choice == -12:
- closeByPid();print(" +CloseDoc")
- else:
- print(" - no comand")
Advertisement
Add Comment
Please, Sign In to add comment