Skip to content

Instantly share code, notes, and snippets.

@sheikhaafaq
Created August 19, 2020 10:50
Show Gist options
  • Save sheikhaafaq/0c20254d987c421a1f066ae2141f733a to your computer and use it in GitHub Desktop.
Save sheikhaafaq/0c20254d987c421a1f066ae2141f733a to your computer and use it in GitHub Desktop.
import pyttsx3,os
pyttsx3.speak( " Hi i m jarvis ")
x="Chat with me for your requirements"
while True:
print(x ,end= ': ')
pyttsx3.speak(x)
p = input().lower()
A = ['run','execute','open','launch']
B = ['not ', 'donot' ,"don't"]
if ((A[0] in p ) or (A[1] in p ) or (A[2] in p ) or (A[3] in p )) and ("chrome" in p) :
if (B[0] not in p) and (B[1] not in p) and (B[2] not in p):
pyttsx3.speak("launching chrome")
os.system("chrome")
else:
print("Not launching chrome")
pyttsx3.speak("Not launching chrome")
elif ((A[0] in p ) or (A[1] in p ) or (A[2] in p ) or (A[3] in p )) and (("notepad" in p )or ("editor" in p)) :
if (B[0] not in p) and (B[1] not in p) and (B[2] not in p):
pyttsx3.speak("launching notepad")
os.system("notepad")
else:
print("Not launching chrome")
pyttsx3.speak("Not launching Notepad")
elif ((A[0] in p ) or (A[1] in p ) or (A[2] in p ) or (A[3] in p )) and ("player" in p ) and ("media" in p):
if (B[0] not in p) and (B[1] not in p) and (B[2] not in p):
pyttsx3.speak("launching windows media player")
os.system("wmplayer")
else:
print("Not launching chrome")
pyttsx3.speak("Not launching windows media player")
elif ("exit" in p ) or ("quit" in p):
pyttsx3.speak("it's been my pleasure helping you out ")
break
else :
print("Don't support")
pyttsx3.speak("Request donot support")
##
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment