|
| 1 | +import pip |
| 2 | +import os |
| 3 | +import pyttsx3 |
| 4 | + |
| 5 | +engine = pyttsx3.init() |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | +engine.say("Hello there..how are you..") |
| 11 | +engine.say("Please tell me your name by typing ") |
| 12 | +engine.runAndWait() |
| 13 | +user = input("Please Enter Your name : ") |
| 14 | +engine.say("Hello {0}".format(user)) |
| 15 | +engine.runAndWait() |
| 16 | + |
| 17 | + |
| 18 | +voices = engine.getProperty('voices') |
| 19 | +engine.setProperty('voice', voices[1].id) |
| 20 | + |
| 21 | + |
| 22 | +engine.say("If you are a boy then simply type b and for girl please type g") |
| 23 | +engine.runAndWait() |
| 24 | +gender = input(str("please write here b for boy or g for girl : ")) |
| 25 | + |
| 26 | +if( gender == "B" or gender =="b"): |
| 27 | + voices = engine.getProperty('voices') |
| 28 | + engine.setProperty('voice', voices[0].id) |
| 29 | + engine = pyttsx3.init() |
| 30 | + engine.say("Thank you you are ready to go..") |
| 31 | + engine.runAndWait() |
| 32 | + engine.stop() |
| 33 | + |
| 34 | +elif( gender =="F" or gender =="f"): |
| 35 | + voices = engine.getProperty('voices') |
| 36 | + engine.setProperty('voice', voices[1].id) |
| 37 | + engine = pyttsx3.init() |
| 38 | + engine.say("Thank you you are ready to go..") |
| 39 | + engine.runAndWait() |
| 40 | + engine.stop() |
| 41 | + |
| 42 | +else: |
| 43 | + engine = pyttsx3.init() |
| 44 | + engine.say("please enter a character g or b according to your gender") |
| 45 | + engine.runAndWait() |
| 46 | + engine.stop() |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | +os.system("color 0e") |
| 51 | + |
| 52 | +def install(package): |
| 53 | + os.system("color 5f") |
| 54 | + engine = pyttsx3.init() |
| 55 | + engine.say("keep working meanwhile i am checking your voice dependencies") |
| 56 | + engine.runAndWait() |
| 57 | + if hasattr(pip, 'main'): |
| 58 | + pip.main(['install', package]) |
| 59 | + else: |
| 60 | + pip._internal.main(['install', package]) |
| 61 | + engine.say("All dependencies are update and working") |
| 62 | + engine.runAndWait() |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | +engine.say("This is a Modern command line Interface created by Anand Prabhakar") |
| 67 | +engine.runAndWait() |
| 68 | + |
| 69 | +print("==========================================================================") |
| 70 | +print("\n||\tCommand Line Interface CLI 1.0 By Anand Prabhakar,Bihar,India\t||\n||\tPowered by Python. \t\t\t\t\t\t||\n||\tjust learning..no commercial use.. \t\t\t\t||\n") |
| 71 | +print("==========================================================================") |
| 72 | +def main(): |
| 73 | + engine = pyttsx3.init() |
| 74 | + engine.say("Please Enter the command you want to run") |
| 75 | + engine.runAndWait() |
| 76 | + command = input("\n\tEnter the command you want to execute : ") |
| 77 | + |
| 78 | + print("Output after execution : \n") |
| 79 | + print("============================================================") |
| 80 | + commanding(command) |
| 81 | + print("============================================================") |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | +def commanding(i): |
| 87 | + os.system("color 0e") |
| 88 | + engine = pyttsx3.init() |
| 89 | + engine.say("You have entered the following command") |
| 90 | + engine.say(i) |
| 91 | + engine.runAndWait() |
| 92 | + a = os.system(i) |
| 93 | + engine.say("Here is output for the command you entered") |
| 94 | + engine.runAndWait() |
| 95 | + print("\n\t\tDo you want to Enter Command again\n") |
| 96 | + print("-------------------------------------------------------------") |
| 97 | + main() |
| 98 | + return a |
| 99 | + |
| 100 | +if __name__ == "__main__": |
| 101 | + install('pyttsx3') |
| 102 | + main() |
| 103 | + |
| 104 | + |
0 commit comments