-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathoAPP.py
80 lines (67 loc) · 2.05 KB
/
oAPP.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
76
77
78
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', 170)
def speak(audio):
engine.say(audio)
engine.runAndWait()
dictapp = {"commandprompt":"cmd","notepad":"np","excel":"excel","brave": "brave"}
def openWebApp(query):
speak("Launching web...")
if ".com" in query or ".co.in" in query or ".org" in query:
query = query.replace("open","")
query = query.replace("robo open","")
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 closeWebApp(query):
speak("closing...")
if "one tab" in query or "1 tab" in query:
pyautogui.hotkey("ctrl","w")
elif "2 tab" in query:
pyautogui.hotkey("ctrl","w")
sleep(1)
pyautogui.hotkey("ctrl","w")
speak("all tab closed")
elif "3 tab" in query:
pyautogui.hotkey("ctrl","w")
sleep(1)
pyautogui.hotkey("ctrl","w")
sleep(1)
pyautogui.hotkey("ctrl","w")
speak("all tab closed")
elif "4 tab" in query:
pyautogui.hotkey("ctrl","w")
sleep(1)
pyautogui.hotkey("ctrl","w")
sleep(1)
pyautogui.hotkey("ctrl","w")
sleep(1)
pyautogui.hotkey("ctrl","w")
speak("all tab closed")
elif "5 tab" in query:
pyautogui.hotkey("ctrl","w")
sleep(1)
pyautogui.hotkey("ctrl","w")
sleep(1)
pyautogui.hotkey("ctrl","w")
sleep(1)
pyautogui.hotkey("ctrl","w")
sleep(1)
pyautogui.hotkey("ctrl","w")
speak("all tab closed")
else:
keys = list(dictapp.keys())
for app in keys:
if app in query:
os.system(f"taskkill /f /im {dictapp[app]}.exe")