def emailChoices(value): if value == "open mail": system("open -a Mail") elif value == "close mail": system("pkill mail") elif value == "sync mail": syncMail() elif value == "read new mail": readUnreadMail() elif value == "create draft": recipient = getUserInput("Who is the recipient?") recipient = editAddress(recipient) print(recipient) subject = getUserInput("What is the subject line?") file = getUserInput("Do you want to attach a file?") if file == "yes": file = getUserInput("What is called?") filepath = findFile(file) else: file = "" content = getUserInput("What is the content?") newEmail(subject, content, recipient, file) system('say Please check and edit. If correct say send email') elif value == "send email": sendCurrentMail() else: pass
def openFile(): found = -1 # get name of image inp = getUserInput("What is the name of the file") while inp == "" or inp == -1 or found == -1: inp = getUserInput("Try Again") if inp != "" and inp != -1: found = findOpenImage(inp) if inp == "quit" or found == 1: break
def action(com, inp): #this is the value for an unknown command if com == -1: system('say Command not classified please try again') print("Command not classified") #opening an application elif com == 0: app = appOpen.checkApp(inp) if app == -1: system('say could not find the application') return "" else: appOpen.openApp(app[0]) print(app[1]) return app[1] + '!' #closing an application elif com == 1: app = appOpen.checkApp(inp) if app == -1: system('say could not find the application') return "" else: appOpen.closeApp(app[0]) return app[1] + '!' elif com == 2: inp = getDetails( "What is the name of the folder you would like to delete?") instruct.deleteDesktopFolder(inp) elif com == 3: desc = getDetails("What description would you like for your event?") summ = getDetails("What summary would you like for your event?") cal.makeEvents(desc, summ) elif com == 4: instruct.openNotes() elif com == 5: instruct.closeNotes() elif com == 6: vol.increaseVolume() elif com == 7: vol.decreaseVolume() elif com == 8: print("Work in progress atm") elif com == 9: cal.listAllEvents() elif com == 10: inp = getDetails("What should the folder be named?") instruct.createDesktopFolder(inp) elif com == 11: previews.openImage() elif com == 12: previews.openFile() elif com == 13: findGender() elif com == 14: e_mail.syncMail() elif com == 15: e_mail.readUnreadMail() elif com == 16: recipient = getDetails("Who is the recipient?") recipient = e_mail.editAddress(recipient) subject = getDetails("What is the subject line?") file = getUserInput("Do you want to attach a file? yes or no?") if file == "yes": file = getUserInput("What is called?") filepath = findFile(file) else: file = "" content = getDetails("What is the content?") e_mail.newEmail(subject, content, recipient, file) system('say Please check and edit. If correct say send mail') elif com == 17: e_mail.sendCurrentMail() elif com == 18: instruct.systemLogOut() elif com == 19: instruct.systemRestart() elif com == 20: instruct.systemShutDown() elif com == 21: safari.closeFromLeft() elif com == 22: safari.closeFromRight() elif com == 23: safari.copyUrl() elif com == 24: safari.firstTab() elif com == 25: safari.lastTab() elif com == 26: safari.moveLeft() elif com == 27: safari.moveRight() elif com == 28: title = getDetails( "What is the title of the song you wish to listen to?") tunes.playTrack(title) elif com == 29: currentTime.getTime() elif com == 30: currentTime.getDate() elif com == 31: battery.getBatteryPercentage() elif com == 32: battery.getBatteryStatus() return inp
def getDetails(info): inp = "" while inp == "" or inp == -1: inp = getUserInput(info) print(inp) return inp
def trainCommand(com): pair = [item for item in commandList if item[0] == com] inp = getUserInput("please repeat a variation of the command" + pair[0][1]) return inp
) if (k == 't'): for num, comm in commandList: print(str(num) + " : " + comm) val = getCommandNumber() system('say Start Training') print("Start Training") for i in range(3): uinput = trainCommand(val) a.comList[val].addCommand(uinput) a.comList[val].writeToFile() system('say Training Completed') print("Training Completed") else: sys_says = "Command me" inp = getUserInput(sys_says) while inp == "" or inp == -1: inp = getUserInput("Try Again") if inp == -2: print("ddsfsdaflkasjfd") #handle quiting case if inp == "quit" or inp == "quick": break #handle the command classification val = a.getCommand(inp) print(val) #do the command sent = action(val, inp) if sent != "" and val != -1: