-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdictapp.py
75 lines (68 loc) · 2.28 KB
/
dictapp.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import os
import pyautogui
import webbrowser
import pyttsx3
from time import sleep
engine = pyttsx3.init("sapi5")
voices = engine.getProperty("voices")
engine.setProperty("voice", voices[0].id)
engine.setProperty("rate",200)
def speak(audio):
engine.say(audio)
engine.runAndWait()
dictapp = {"commandprompt":"cmd","paint":"paint","word":"winword","excel":"excel","chrome":"chrome","vscode":"code","powerpoint":"powerpoint","microsoftword":"word","AdobePhotoshop2022":"Photoshop"}
def openappweb(query):
speak("Launching, sir")
if ".com" in query or ".co.in" in query or ".org" in query:
query = query.replace("open","")
query = query.replace("jarvis","")
query = query.replace("launch","")
query = query.replace(" ","")
webbrowser.open(f"https://www.{query}")
else:
keys = list(dictapp.keys())
for app in keys:
if app in query:
os.system(f"start {dictapp[app]}")
def closeappweb(query):
speak("Closing,sir")
if "one tab" in query or "1 tab" in query:
pyautogui.hotkey("ctrl","w")
speak("All tabs closed")
elif "2 tab" in query:
pyautogui.hotkey("ctrl","w")
sleep(0.5)
pyautogui.hotkey("ctrl","w")
speak("All tabs closed")
elif "3 tab" in query:
pyautogui.hotkey("ctrl","w")
sleep(0.5)
pyautogui.hotkey("ctrl","w")
sleep(0.5)
pyautogui.hotkey("ctrl","w")
speak("All tabs closed")
elif "4 tab" in query:
pyautogui.hotkey("ctrl","w")
sleep(0.5)
pyautogui.hotkey("ctrl","w")
sleep(0.5)
pyautogui.hotkey("ctrl","w")
sleep(0.5)
pyautogui.hotkey("ctrl","w")
speak("All tabs closed")
elif "5 tab" in query:
pyautogui.hotkey("ctrl","w")
sleep(0.5)
pyautogui.hotkey("ctrl","w")
sleep(0.5)
pyautogui.hotkey("ctrl","w")
sleep(0.5)
pyautogui.hotkey("ctrl","w")
sleep(0.5)
pyautogui.hotkey("ctrl","w")
speak("All tabs closed")
else:
keys = list(dictapp.keys())
for app in keys:
if app in query:
os.system(f"taskkill /f /im {dictapp[app]}.exe")