2424
2525# importing the pyttsx3 library
2626import pyttsx3
27+ import webbrowser
2728
2829# initialisation
2930engine = pyttsx3 .init ()
3031
32+
33+ def sendEmail (do , content ):
34+ server = smtplib .SMTP ('smtp.gmail.com' , 587 )
35+ server .ehlo ()
36+ server .starttls ()
37+ server .login ('youremail@gmail.com' , 'yourr-password-here' )
38+ server .sendmail ('youremail@gmail.com' , to , content )
39+ server .close ()
40+
41+
3142# obtain audio from the microphone
3243r = sr .Recognizer ()
3344with sr .Microphone () as source :
@@ -68,6 +79,27 @@ def get_app(Q):
6879 subprocess .call (['cmd.exe' ])
6980 elif Q == "browser" :
7081 subprocess .call (['C:\Program Files\Internet Explorer\iexplore.exe' ])
82+ patch - 1
83+ elif Q == "open youtube" :
84+ webbrowser .open ("https://www.youtube.com/" ) # open youtube
85+ elif Q == "open google" :
86+ webbrowser .open ("https://www.google.com" ) # open google
87+
88+ elif Q == "email to other" : # here you want to change and input your mail and password whenver you implement
89+ try :
90+ speak ("What should I say?" )
91+ r = sr .Recognizer ()
92+ with sr .Microphone () as source :
93+ print ("Listening..." )
94+ r .pause_threshold = 1
95+ audio = r .listen (source )
96+ to = "abc@gmail.com"
97+ sendEmail (to , content )
98+ speak ("Email has been sent!" )
99+ except Exception as e :
100+ print (e )
101+ speak ("Sorray i am not send this mail" )
102+ == == == =
71103 master
72104 elif Q == "Take screenshot"
73105 snapshot = ImageGrab .grab ()
@@ -81,6 +113,7 @@ def get_app(Q):
81113 elif Q == "Jokes" :
82114 print (pyjokes .get_joke ())
83115
116+ master
84117 else :
85118 engine .say ("Sorry Try Again" )
86119 engine .runAndWait ()
0 commit comments