示例#1
0
def write():
    while True:
        command = sp.gstt()
        tts.say(command)
        #tts.say('give your command')
        #time.sleep(4)
        if command == "stop writing" or command == 'likhna band karo':
            tts.say('writing stopped')
            break
        elif command == "new line" or command == 'nayi rekha':
            new_line()
        elif command == "caps lock" or command == 'bade akshar':
            tts.say('capslock pressed')
            caps_lock()

        elif command == "full stop" or command == 'purnviram':
            keyboard.type(".")
        elif command == "comma":
            keyboard.type(",")
        elif command == "hyphen":
            keyboard.type("-")
        elif command:
            keyboard.type(command + " ")
        #tts.say('give your command')
        #time.sleep(4)
        else:
            tts.say('error in speech recognition')
        time.sleep(4)
    def main():
        #while True:
        co.activatesystemcommandset()
        #google speech to text recognition
        command = sp.gstt()
        #tts.say('give your command')
        #time.sleep(5)
        #command = 'msword khole'
        tts.say(command)
        if command:
            #analize given command
            command = al.analize(command)
            print(command)
            if command == "open msword" or command == 'msword khole':
                tts.say('msword opened successfully')
                wordmain.main()
            elif command == "start mousehover" or command == 'mousehover khole':
                mousehover.main()
            elif command == "stop mousehover" or command == 'mousehover band karo':
                mousehover.stop_mousehover()
            elif command == "open chrome" or command == 'chrome kholo':
                ChromeMain.main()
            elif command == "find file" or command == 'file khojo':
                fs.type()
            elif command == "send mail":
                gmail2.gmailer()

            #elif command == "exit" or command == 'smapat karo':
            #break

        else:
            tts.say('Check settings again')
            print('Check settings again')
示例#3
0
 def write():
     command = sp.gstt()
     if command == "stop writing":
         return
     elif command:
         keyboard.type(command)
     else:
         tts.say('error in speech recognition')
     chromelib.write()
示例#4
0
def background():
    while (True):
        print("in background thread\n")
        command = sp.gstt()
        #tts.say('give your command')
        #time.sleep(4)
        #command = 'suno'
        if command == "listen" or command == 'suno':
            t = Thread(target=assistant, args="")
            t.start()
            t.join()
示例#5
0
def wordcommander():
    while True:
        command = sp.gstt()
        #tts.say('give your command')
        #time.sleep(4)
        #command = 'likho'

        if command:
            command = al.analize(command)
            if command:
                try:
                    #print(command)
                    if command == 'close msword' or command == 'msword band karo':
                        tts.say('msword closed successfully')
                        break

                    elif command == "read" or command == 'padho':
                        with keyboard.pressed(Key.ctrl):
                            keyboard.press('a')
                            keyboard.release('a')
                        with keyboard.pressed(Key.alt):
                            keyboard.press('s')
                            keyboard.release('s')

                    elif command == "write" or command == 'likho':
                        writing.write()

                    #tts.say('give your command')
                    #time.sleep(4)
                    #command = 'msword band karo'

                    elif len(bc.mswordcommandsdict[command]) is 1:
                        operate.output1(bc.mswordcommandsdict[command][0])

                    elif len(bc.mswordcommandsdict[command]) is 2:
                        operate.output2(bc.mswordcommandsdict[command][0],bc.mswordcommandsdict[command][1])

                    elif len(bc.mswordcommandsdict[command]) is 3 :
                        operate.output3(bc.mswordcommandsdict[command][0],bc.mswordcommandsdict[command][1],bc.mswordcommandsdict[command][2])

                    time.sleep(1)

                except ValueError:
                    print('ValueError: key is a string, but its length is not 1')
                    tts.say('ValueError: key is a string, but its length is not 1')

            else:
                print('analizer doesnot work, Check its settings')
                tts.say('analizer doesnot work, Check its settings')
        else:
            print('error in google speech recognition')
            tts.say('error in google speech recognition')
    #stop msword
    stopword()
示例#6
0
def background():
    while (True):
        print("in background thread\n")
        #x=input("do you want to change\n")
        #if x=="yes":
        #co.activatesystemcommandset()
        command = sp.gstt()
        if command == "listen":

            t = Thread(target=assistant, args="")
            t.start()
            t.join()
def chromecommander():
    while True:
        command = sp.gstt()
        if command:
            command = al.analize(command)
            if command:
                try:
                    print(command)

                    if command == "write" or command == 'likho':
                        chromelib.write()
                    elif command == "quit chrome" or command == 'chrome band karo':
                        tts.say('chrome closed successfully')
                        with keyboard.pressed(Key.ctrl):
                            with keyboard.pressed(Key.shift):
                                keyboard.press('q')
                                keyboard.release('q')
                        break
                    elif command == 'start mousehover' or command == 'mousehover shuru karo':
                        mousehover.main()
                    elif (command == 'stop mousehover'
                          ) or command == 'mousehover band karo':
                        mousehover.stop_mousehover()
                    elif command == "go" or command == 'khojo':
                        keyboard.press(Key.enter)
                        keyboard.release(Key.enter)
                        tts.say('page loaded successfully')

                    elif len(bc.browsercommandsdict[command]) is 2:
                        operate.output2(bc.browsercommandsdict[command][0],
                                        bc.browsercommandsdict[command][1])

                    elif len(bc.browsercommandsdict[command]) is 3:
                        operate.output3(bc.browsercommandsdict[command][0],
                                        bc.browsercommandsdict[command][1],
                                        bc.browsercommandsdict[command][2])

                    time.sleep(1)

                except ValueError:
                    print(
                        'ValueError: key is a string, but its length is not 1')
                    tts.say(
                        'ValueError: key is a string, but its length is not 1')

            else:
                print('analizer doesnot work, Check its settings')
                tts.say('analizer doesnot work, Check its settings')
        else:
            print('error in google speech recognition')
            tts.say('error in google speech recognition')
示例#8
0
def gmailer():
    # creates SMTP session
    s = smtplib.SMTP('smtp.gmail.com', 587)

    # start TLS for security
    s.starttls()

    # Authentication
    s.login("your_emailid @gmail.com", "your_password")

    tts.say("give me reciever email id")
    recieveremail = str(sp.gstt())
    recieveremail = recieveremail + '@gmail.com'
    print('*****@*****.**')

    # message to be sent
    tts.say("start writing mail")
    message = ''

    while True:
        text = sp.gstt()
        text = str(text)
        print(text)
        if text.lower() == 'stop writing':
            break
        text = text + " "
        message = message + text
    print(message)

    # sending the mail
    s.sendmail("*****@*****.**", "*****@*****.**",
               message)

    x = "mail sent successfully to" + recieveremail
    tts.say(x)
    # terminating the session
    s.quit()
示例#9
0
 def write():
     while True:
         command = sp.gstt()
         if command == "stop writing":
             break
         elif command == "new line":
             wordlib.new_line()
         elif command == "caps lock":
             wordlib.caps_lock()
         elif command == "period":
             keyboard.type(".")
         elif command:
             keyboard.type(" " + command)
         else:
             tts.say('error in speech recognition')
示例#10
0
def mainloop():
    if internet_on():
        #activate system commandset
        co.activatesystemcommandset()
        command = sp.gstt()
        if command:
            command = al.analize(command)
            if command:
                #print(command)
                status = commander.main(command)
                if (status == -1):
                    return -1
            else:
                mainloop()
        else:
            tts.say('Check settings again')
            print('Check settings again')

    else:
        raise Exception('check internet connection and try again')
def chromecommander():
    while True:
        command = sp.gstt()
        if command:
            command = al.analize(command)
            if command:
                try:
                    print(command)

                    if (command == "write"):
                        chromelib.write()

                    elif (command == "open new window"):
                        chromelib.OpenNewWindow()

                    elif (command == "open new incognito window"):
                        chromelib.OpenNewIncognitoWindow()

                    elif (command == "open new tab"):
                        chromelib.OpenNewTab()

                    elif (command == "reopen last closed tab"):
                        chromelib.ReopenLastClosedTab()

                    elif (command == "jump to next open tab"):
                        chromelib.JumpToNextOpenTab()

                    elif (command == "jump to previous open tab"):
                        chromelib.JumpToPreviousOpenTab()

                    elif (command == "minimize current window"):
                        chromelib.MinimizeCurrentWindow()

                    elif (command == "close current window"):
                        chromelib.CloseCurrentWindow()

                    elif (command == "close current tab"):
                        chromelib.CloseCurrentTab()

                    elif (command == "quit chrome"):
                        chromelib.QuitChrome()
                        break

                    elif (command == "stop loading page"):
                        chromelib.StopLoadingPage()

                    elif (command == "print current page"):
                        chromelib.PrintCurrentPage()

                    elif (command == "save current page"):
                        chromelib.SaveCurrentPage()

                    elif (command == "reload current page"):
                        chromelib.ReloadCurrentPage()

                    elif (command == "everything on page bigger"):
                        chromelib.EverythingOnPageBigger()

                    elif (command == "everything on page smaller"):
                        chromelib.EverythingOnPageSmaller()

                    elif (command == "everything on page of default size"):
                        chromelib.EverythingOnPageDefaultSize()

                    elif (command == "delete previous word"):
                        chromelib.DeletePreviousWord()

                    elif (command == "go to top of page"):
                        chromelib.GoToTopOfPage()

                    elif (command == "go to end of page"):
                        chromelib.GoToEndOfPage()

                    elif (command == "open chrome menu"):
                        chromelib.OpenChromeMenu()

                    elif (command == "open find bar"):
                        chromelib.OpenFindBar()

                    elif (command == "jump to next match of find bar search"):
                        chromelib.JumpToNextMatchOfFindBarsearch()

                    elif (command ==
                          "jump to previous match of find bar search"):
                        chromelib.JumpToPreviousMatchOfFindBarsearch()

                    elif (command == "clear browsing data option"):
                        chromelib.ClearBrowsingDataOption()

                    time.sleep(1)

                except ValueError:
                    print(
                        'ValueError: key is a string, but its length is not 1')
                    tts.say(
                        'ValueError: key is a string, but its length is not 1')

            else:
                print('analizer doesnot work, Check its settings')
                tts.say('analizer doesnot work, Check its settings')
        else:
            print('error in google speech recognition')
            tts.say('error in google speech recognition')
示例#12
0
def type():
    tts.say('enter file name')
    faltu=sp.gstt()
    #filename=input('enter file name')
    fs.find('use.txt')
def wordcommander():
    while True:
        command = sp.gstt()
        if command:
            command = al.analize(command)
            if command:
                try:
                    print(command)
                    if(command == "read"):
                        wordlib.read()

                    elif(command == "write"):
                        wordlib.write()

                    elif(command == "save"):
                        wordlib.save()

                    elif(command == "select all"):
                        wordlib.select_all()

                    elif(command == "deselect"):
                        wordlib.deselect()

                    elif(command == "bold"):
                        boldActivator = True
                        wordlib.bold()

                    elif(command == "italic"):
                        italicActivator = True
                        wordlib.italic()

                    elif(command == "remove bold"):
                        if boldActivator is True:
                            wordlib.bold()
                            boldActivator = False

                    elif(command == "remove italic"):
                        if italicActivator is True:
                            wordlib.italic()
                            italicActivator = False

                    elif(command == "underline"):
                        underlineActivator = True
                        wordlib.underline()

                    elif(command == "remove underline"):
                        if underlineActivator is True:
                            wordlib.underline()
                            underlineActivator = False

                    elif(command == "close exit quit"):
                        wordlib.close()

                    elif(command == "copy"):
                        wordlib.copy()

                    elif(command == "paste"):
                        wordlib.paste()

                    elif(command == "decrease font size"):
                        wordlib.decrease_font_size()

                    elif(command == "increase font size"):
                        wordlib.increase_font_size()

                    elif(command == "cut text"):
                        wordlib.cut_text()

                    elif(command == "undo"):
                        wordlib.undo()

                    elif(command == "redo"):
                        wordlib.redo()

                    elif(command == "left align text"):
                        wordlib.left_align_text()

                    elif(command == "right align text"):
                        wordlib.right_align_text()

                    elif(command == "create new document"):
                        wordlib.create_new_document()

                    elif(command == "split document window"):
                        if(splitDocumentWindowActivator == False):
                            splitDocumentWindowActivator = True
                            wordlib.split_document_window()
                        else:
                            tts.say('split document window is already activated')

                    elif(command == "remove split document window"):
                        if(splitDocumentWindowActivator == True):
                            wordlib.split_document_window()

                    elif(command == "print document"):
                        wordlib.print_document()

                    elif(command == "double underline"):
                        if (doubleUnderlineActivator == False):
                            doubleUnderlineActivator = True
                            wordlib.double_underline()
                        else:
                            tts.say('double underline is already activated')

                    elif(command == "remove double underline"):
                        if doubleUnderlineActivator is True:
                            wordlib.double_underline()
                            underlineActivator = False

                    elif(command == "apply subscript"):
                        if (subscriptActivator == False):
                            subscriptActivator = True
                            wordlib.subscript()
                        else:
                            tts.say('subscript is already activated')

                    elif(command == "remove subscript"):
                        if subscriptActivator is True:
                            wordlib.subscript()
                            subscriptActivator = False

                    elif(command == "apply superscript"):
                        if (superscriptActivator == False):
                            superscriptActivator = True
                            wordlib.superscript()
                        else:
                            tts.say('superscript is already activated')

                    elif(command == "remove superscript"):
                        if superscriptActivator is True:
                            wordlib.superscript()
                            superscriptActivator = False

                    elif(command == "one character right"):
                        wordlib.one_char_right()

                    elif(command == "one character left"):
                        wordlib.one_char_left()

                    elif(command == "one word left"):
                        wordlib.one_word_left()

                    elif(command == "one word right"):
                        wordlib.one_word_right()

                    elif(command == "one paragraph up"):
                        wordlib.one_para_up()

                    elif(command == "one paragraph down"):
                        wordlib.one_para_down()

                    elif(command == "one line up"):
                        wordlib.one_line_up()

                    elif(command == "one line down"):
                        wordlib.one_line_down()

                    elif(command == "go to end of line"):
                        wordlib.end_of_line()

                    elif(command == "go to beginning of line"):
                        wordlib.beg_of_line()

                    elif(command == "go to end of document"):
                        wordlib.end_of_document()

                    elif(command == "go to beginning of document"):
                        wordlib.beg_of_document()

                    elif(command == "delete one left character"):
                        wordlib.delete_one_char_left()

                    elif(command == "delete one right character"):
                        wordlib.delete_one_char_right()

                    elif(command == "delete one left word"):
                        wordlib.delete_one_word_left()

                    elif(command == "delete one right word"):
                        wordlib.delete_one_word_right()

                    elif(command == 'close msword'):
                        break
                except ValueError:
                    print('ValueError: key is a string, but its length is not 1')
                    tts.say('ValueError: key is a string, but its length is not 1')

            else:
                print('analizer doesnot work, Check its settings')
                tts.say('analizer doesnot work, Check its settings')
        else:
            print('error in google speech recognition')
            tts.say('error in google speech recognition')
    #stop msword
    stopword()