Latest
Loading...

Python for Ethical Hacking

Command Prompt

Featured Post

#5 Jarvis

Jarvis      Now we are going to create some functions. With the help of this functions we are going to make our Play music Open website...

#5 Jarvis

#5 Jarvis

Jarvis

    Now we are going to create some functions. With the help of this functions we are going to make our

  1. Play music
  2. Open websites
  3. Search on Google

Ok Lets Start our Code.


music()

# To play music

def music():

    music_dir = "D:\\Music"

    songs = os.listdir(music_dir)

    rd = random.choice(songs)

    os.startfile(os.path.join(music_dir, rd))


YouTube()

To interact with browser we have to import webbrowser

import webbrowser 

# To find IP address of the system

def YouTube():

    speak("Opening Youtube")

    webbrowser.open("www.youtube.com")


We can open any website with the help of this module. You can change the website inside the function to open that website.

google()

def google():

    speak("What should I search on google, sir")

    qn = takecommand().lower()

    webbrowser.open(f"https://www.google.com/search?q={qn}")


Place the above code in between the Previous code and call the function in the main block of the code

which means,



if __name__ == "__main__":

    wish()

    query = takecommand().lower()

    if "open notepad" in query:

        notepad()


    elif "open cmd" in query:

        cmd()


    elif "close notepad" in query:

        close_notepad()


    elif "ip address" in query:

        ip_address()


    elif "play music" in query:

        music()


    elif "open youtube" in query:

        YouTube()


    elif "open facebook" in query:

        FaceBook()


    elif "open google" in query:

        google()






No comments:

Post a Comment