# ADDING FEATURES
#Function/Features :
- Click to preview!
#Feature 1/2 is in Part-1
#Feature-3: Open chrome/website
# Import library : webbrowser
#How to get Chrome path:
- Right-click on chrome and open file location --> right-click on chrome.exe
- Or simply Press shift right-click and copy path location
- Remember to use forward-slash (/) in Pycharm
- Refer to the below image
CLICK TO VIEW! |
- def open_chrome():
- # url u want to open
- url = 'http://docs.python.org/'
- # Windows
- chrome_path = 'C:/Program Files/Google/Chrome/Application/chrome.exe %s'
- # replace chrome_path with the correct path for your platform.
- # MacOS
- # chrome_path = 'open -a /Applications/Google\ Chrome.app %s'
- # Linux
- # chrome_path = '/usr/bin/google-chrome %s'
- webbrowser.get(chrome_path).open(url)
- # call the function
Add in Main --> Nested_elif
- elif "chrome" in query: # quit to end the program
- speak("opening the Chrome")
- open_chrome()
#How to add our New Function/Feature in our Main_Function
The function should be defined before the Main_Function and in Main_Function add another Nested if-else and call the function
#Feature-4: Launch Application/software
# Import library: subprocess
The
subprocess
the module allows you to spawn new processes, connect to
their input/output/error pipes, and obtain their return codes. This
module intends to replace several older modules and functions:
Add in Main --> Nested_elif
- elif "open notepad" in query: # if open notepad in statement
- speak("opening notepad") # speak
- location = "C:/WINDOWS/system32/notepad.exe" # location
- notepad = subprocess.Popen(location) # location of a software you want tot opem
- elif "close notepad" in query:
- speak("closing notepad")
- notepad.terminate() # terminate
#Feature-5: Wikipedia search
#Add in Main --> Nested_elif
- elif "wikipedia" in query:
- speak("Searching...")
- query = query.replace("wikipedia", "")
- result = wikipedia.summary(query, sentences = 2)
- speak(result)
#Feature-6: Chrome search
# Import library: webbrowser as wb
#Add in Main --> Nested_elif
- elif "search" in query:
- speak("what should i search?")
- chromepath = "C:/Program Files/Google/Chrome/Application/chrome.exe %s" # location
- search = takeCommand().lower()
- wb.get(chromepath).open_new_tab(search + ".com")
#Feature-7: Jokes
# Import library: pyjokes
- pip install pyjokes
#Add in Main --> Nested_elif
- elif "joke" in query:
- speak(pyjokes.get_jokes())
#Feature-8: Logout/Shutdown/Restart
# library needed
- import os
- from time import sleep
- # Logout/Shutdown/Restart
- elif "logout" in query:
- speak('logging out in 5 second')
- sleep(5)
- os.system("shutdown - l")
- elif "shutdown" in query:
- speak('shutting down in 5 second')
- sleep(5)
- os.system("shutdown /s /t 1")
- elif "restart" in query:
- speak('restarting in 5 second')
- sleep(5)
- os.system("shutdown /r /t 1")
Tags:
ai-assistant-tutorial
SIR PLZ TEACH THE ARDINO,GUI AND MAIN PLZ GIVE THE COSTOM MADE VOICE FOLDER PLZ SIR
YEP
When Will You
print ("request to teach how to make web site like you sir plz")
def gamil ()
gamil=codesofdexco@gmail.com
# contact me in the gamil I gave vey unique idea and a humble request to send me the costom made voice of Jarvis folder plz
speak( "sir plz accept the requst of my owner")
Print(gamil)
elif "gmail" in query
gmail ()
#find mistake 🤣
print("funny")
hey can you please tell me how to import the webbrowser to pycharm? I'm kinda new to this and would help me out a lot if you could respond to this. I don't know how to download the source code from github and put it in pycharm basically
Emperor Casino Review | Play at an Excellent Casino
Our review 바카라 사이트 of the Emperor 바카라 사이트 casino site, bonuses, payment methods, safety and reputation. Claim your bonus today. Rating: 2.6 · Review by 제왕 카지노 Shootercasino
Hello there! I am actually having problem facing me in using Wikipedia library as it turns a lot of error to me. Does anyone know how to solve?