def FindFileSystemUsage(output): try: print(output) entities = output['entities'] if len(entities) > 0: for entity in entities: if entity["entity"].lower() == "windows": print("Getting File System Usage of Windows Server") winspeech.say_wait( "Getting File System Usage of Windows Server") FindServerAndRunScript("windows") elif entity["entity"].lower() == "linux": print("Getting File System Usage of Linux Server") winspeech.say_wait( "Getting File System Usage of Linux Server") FindServerAndRunScript("linux") else: print("Please provide the server name.") winspeech.say_wait("please provide the server name") speechResult = GSTT.getSpeechToText() print(output["query"]) luisOutput = luis.AnalyseIntent( str(output['query']) + " of " + speechResult) FindFileSystemUsage(luisOutput) except Exception as e: print("Error in FileSystemUsageDialog " + str(e))
def AskForInput(message): WTF.ChangeHeaderOnly(message) print(message) winspeech.say_wait(message) userInput = GSTT.getSpeechToText().lower() return userInput
def CreateForwardLoop(previousText, queryText): print(queryText) winspeech.say_wait(queryText) if config.voiceEnable == True: reminderAdditionalInput = GSTT.getSpeechToText() else: reminderAdditionalInput = input(" : ") luisOutput = luis.AnalyseIntent(previousText + reminderAdditionalInput) return CreateReminder(luisOutput)
def CreateEmail(output): try: entities = output['entities'] #print(len(entities)) if len(entities) > 0: print("Entitites") else: print("Please provide the recipient email") winspeech.say_wait("Please provide the recipient email") userInputMailId = GSTT.getSpeechToText() recipient = OCH.CheckEmailMatch(userInputMailId) print(recipient) print("Please prove the Subject of the email") winspeech.say_wait("Please provide the Subject of the email") userEmailSubject = GSTT.getSpeechToText() print("Okay, opening new email") winspeech.say("Please wait while opening new email") OCH.CreateEmail(recipient["email"],userEmailSubject) except Exception as e: print("Error in show create mail "+str(e))
def OpenApplicationParser(output): entities = output['entities'] applicattionNameInput = "" if len(entities) > 0: entity = entities[0]["entity"].lower() applicattionNameInput = entity else: print("Please provide the application name: ") winspeech.say_wait("Please provide the application name: ") if config.voiceEnable == True: speechResult = GSTT.getSpeechToText() else: speechResult = input(" : ") applicattionNameInput = speechResult OpenApplication(applicattionNameInput, installedApplicationMaps)
def CreateReminderDialog(output): reminder = CreateReminder(output) print(reminder) winspeech.say_wait("your reminder text is " + reminder["reminderText"] + ", reminder is set on " + reminder["reminderDateTime"] + " .") print("please say confirm to save it and say cancel to dismiss.") winspeech.say_wait( "please say confirm to save it and say cancel to dismiss.") if config.voiceEnable == True: userInput = GSTT.getSpeechToText() else: userInput = input(" : ") if userInput == "confirm": WF.AppendToFile(reminder) else: print("Ok, dismissing it") winspeech.say_wait("ok, dismissing it")
else: sayString = f"Authentication successful. Welcome {authenticationOutput}." LoginSuccess = True winspeech.say_wait(sayString) winspeech.say_wait("Please wait") WTF.OpenUiApplication() print(sayString) WTF.ChangeLogOnly(sayString) winspeech.say_wait("How can I help you today") #LoginSuccess = True #WTF.OpenUiApplication() #winspeech.say_wait("Hi I am Buddy, How can I help you today") while LoginSuccess: WTF.WriteToCurrentJson("How can I help you?", "", []) if config.voiceEnable == True: speechResult = GSTT.getSpeechToText() else: speechResult = input(" : ") if speechResult != "": output = luis.AnalyseIntent(speechResult) if str(output ) == "{'statusCode': 404, 'message': 'Resource not found'}": print("Luis error") output = luis.AnalyseIntent(speechResult) else: print(output) ParseIntent(output)