Пример #1
0
def get_app(Q):
    current = Controller()
    # master
    if Q == "time":
        print(datetime.now())
        x = datetime.now()
        voice(x)
    elif Q == "news":
        speak_news()

    elif Q == "open notepad":
        subprocess.call(['Notepad.exe'])
    elif Q == "open calculator":
        subprocess.call(['calc.exe'])
    elif Q == "open stikynot":
        subprocess.call(['StikyNot.exe'])
    elif Q == "open shell":
        subprocess.call(['powershell.exe'])
    elif Q == "open paint":
        subprocess.call(['mspaint.exe'])
    elif Q == "open cmd":
        subprocess.call(['cmd.exe'])
    elif Q == "open discord":
        subprocess.call(['discord.exe'])
    elif Q == "open browser":
        subprocess.call(['C:\Program Files\Internet Explorer\iexplore.exe'])
    # patch-1
    elif Q == "open youtube":
        webbrowser.open("https://www.youtube.com/")  # open youtube
    elif Q == "open google":
        webbrowser.open("https://www.google.com/")  # open google
    elif Q == "open github":
        webbrowser.open("https://github.com/")
    elif Q == "email to other":  # here you want to change and input your mail and password whenver you implement
        try:
            speak("What should I say?")
            r = sr.Recognizer()
            with sr.Microphone() as source:
                print("Listening...")
                r.pause_threshold = 1
                audio = r.listen(source)
            to = "*****@*****.**"
            content = input("Enter content")
            sendEmail(to, content)
            speak("Email has been sent!")
        except Exception as e:
            print(e)
            speak("Sorry, I can't send the email.")
    # =======
    #   master
    elif Q == "Take screenshot":
        snapshot = ImageGrab.grab()
        drive_letter = "C:\\"
        folder_name = r'downloaded-files'
        folder_time = datetime.datetime.now().strftime("%Y-%m-%d_%I-%M-%S_%p")
        extention = '.jpg'
        folder_to_save_files = drive_letter + folder_name + folder_time + extention
        snapshot.save(folder_to_save_files)

    elif Q == "Jokes":
        speak(pyjokes.get_joke())

    elif Q == "start recording":
        current.add('Win', 'Alt', 'r')
        speak("Started recording. just say stop recording to stop.")

    elif Q == "stop recording":
        current.add('Win', 'Alt', 'r')
        speak("Stopped recording. check your game bar folder for the video")

    elif Q == "clip that":
        current.add('Win', 'Alt', 'g')
        speak("Clipped. check you game bar file for the video")
        with keyboard.Listener(on_press=on_press,
                               on_release=on_release) as listener:
            listener.join()

    else:
        exit()

    # master

    apps = {
        "time": datetime.datetime.now(),
        "notepad": "Notepad.exe",
        "calculator": "calc.exe",
        "stikynot": "StikyNot.exe",
        "shell": "powershell.exe",
        "paint": "mspaint.exe",
        "cmd": "cmd.exe",
        "browser": "C:\Program Files\Internet Explorer\iexplore.exe"
    }