-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathopenApps.py
More file actions
33 lines (28 loc) · 921 Bytes
/
Copy pathopenApps.py
File metadata and controls
33 lines (28 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import pyttsx3,os
dictapp = {"cmd":"cmd","paint":"paint","word":"winword",
"excel":"excel","chrome":"chrome","vscode":"code",
"powerpoint":"powerpnt","calculator":"calc","powershell":"powershell"
}
def speak(text):
engine=pyttsx3.init()
voices=engine.getProperty('voices')
engine.setProperty('voices',voices[0].id)
print("")
print(f"==> MY AI : {text}")
print("")
engine.say(text=text)
engine.runAndWait()
def openApp(query):
query = query.replace('open',"")
speak("Launching {query}")
keys=list(dictapp.keys())
for app in keys:
if app in query:
os.system(f"start {dictapp[app]}")
def closeApp(query):
query = query.replace('close',"")
speak("Closing {query}...")
keys = list(dictapp.keys())
for app in keys:
if app in query:
os.system(f"taskkill /f /im {dictapp[app]}.exe")