-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautomate.py
169 lines (142 loc) · 5.48 KB
/
automate.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
import speech_recognition as sr
import pyttsx as pys
import engineio
import datetime
import wikipedia
import os
import webbrowser
import time
from utils import *
from movie import *
from youtube import *
from sendemail import *
from google import *
from note import *
from whatsapp import *
#bot says opening words
def greet():
now = int(datetime.datetime.now().hour)
# print(now)
if now>=0 and now<12:
speak("Good Morning , waddup waddup??")
if now>=12 and now<18:
speak("Good Afternoon , waddup waddup??")
if now>=18 and now<24:
speak("Good Evening , waddup waddup??")
greet()
time.sleep(2)
#bot starts taking commands
c = 0
WAKE = "Bonjour"
print("Start")
while True:
inst = Command()
if inst.count(WAKE.lower()) > 0:
speak("I am ready! What Should I do?")
inst = Command()
def main(query):
if query!= None :
instruction = query
else :
instruction = Command()
wiki = ["open in wikipedia","browse in wikipedia","search in wikipedia","wikipedia"]
for words in wiki :
if words in instruction:
speak("Searching Wikipedia..")
inst = instruction.replace("wikipedia","")
results = wikipedia.summary(inst,sentences=2)
print(results)
speak(results)
main(None)
break
you = ["open youtube","browse in youtube","watch a video","look for a video"]
for words in you :
if words in instruction:
speak("Opening youtube..")
bot = Youtube()
query = bot.play()
main(query)
break
mov = ["movie review","imdb rating","movie rating"]
for words in mov :
if words in instruction:
speak("what is the name of the movie?")
review = Command()
bot = Movie()
rating = bot.movie_review(review)
if rating != None:
speak("The IMDB rating of this movie is" + rating)
else:
speak("The IMDB rating for this movie is not available")
main(None)
break
gog = ["open google","browse in google","search in google","open browser"]
for words in gog :
if "open google" in instruction:
speak("Opening Google..")
speak("What should I search for?")
text = Command()
Google.search(text)
break
aud = ["save my audio","take my audio","store my audio"]
for words in aud :
if words in instruction:
speak("What audio is to be saved?")
audio = Command()
saveVoice(audio)
break
cod = ["open vscode","open my favourite ide","open new code file"]
for words in cod :
if words in instruction:
speak("Opening Code..")
codePath = "C:\\Users\\Jiten\\AppData\\Local\\Programs\\Microsoft VS Code\\code.exe"
os.startfile(codePath)
main(None)
break
ema = ["send email","write an email","send mail"]
for words in ema :
if words in instruction:
try:
speak("What is the reciever's email address?")
to = Command()
speak("What should I send?")
content = Command()
# to = "[email protected]"
sendEmail.send(to,content)
speak("Email sent successfully!")
print("email sent!")
except Exception as e:
print("Error : ",e)
main(None)
break
notes = ["take a note","note this","open notepad"]
for words in notes :
if words in instruction:
speak("Opening Notepad..")
speak("What should I note?")
text = Command()
Notepad.note(text)
main(None)
break
wha = ["text him","text her","message him","send a message","message her"]
for words in wha :
if words in instruction:
speak("Opening Whatsapp..")
speak("What is the name of the contact on Whatsapp?")
to = Command()
speak("What message should I send?")
message = Command()
bot = Whatsapp
com = bot(to,message).msg()
main(com)
break
clo = ["close it","bye","turn off","shut up"]
for words in clo :
if words in instruction:
speak("Pleasure talking to you.....Byee....Have a nice day!!")
exit()
if(c>0):
speak("What should I do next?")
main(None)
main(inst)
c = c + 1