示例#1
0
def specify_program(programs_with_same_name):
    if len(programs_with_same_name) == 0:
        say.say("I cant find the application")
        return 0, 0
    elif len(programs_with_same_name) == 1:
        open_program(programs_with_same_name[0][0],
                     programs_with_same_name[0][1])
        return 0, 0
    else:

        a = 0
        c = 0
        programs_to_open = "Which one do you want to open? "
        for b in programs_with_same_name:
            a = a + 1
            programs_to_open = programs_to_open + (
                "number " + str(a) + " " + b[0].replace(".lnk", "") + ", ")

        say.say_process(programs_to_open)
        program_requested = getvoice.getvoice()

        if program_requested.startswith("open "):
            program_requested = program_requested.replace("open ", "", 1)

        return program_requested, programs_with_same_name
示例#2
0
def get_data_in_array():
    global ALL_PROGRAM
    try:
        ALL_PROGRAM = cursor.execute("SELECT * FROM program_list").fetchall()
    except sqlite3.OperationalError:
        say.say("Program database is empty")
        get_programs_to_db()
        ALL_PROGRAM = cursor.execute("SELECT * FROM program_list").fetchall()
示例#3
0
def get_programs_to_db():

    say.say("adding programs to database")
    create_db()
    create_table()
    list_main_programs_dir()
    list_user_programs_dir()
    conn.close()
    say.say("programs added to database")
示例#4
0
def open_program(program_name, program_loc):
    program_loc = program_loc.replace("\\", "\\\\")
    subprocess.Popen(program_loc,
                     stdout=subprocess.PIPE,
                     stderr=subprocess.PIPE,
                     stdin=subprocess.PIPE,
                     shell=True)
    say.say("opening " + program_name.replace(".lnk", ""))
    return "sucess"
示例#5
0
def qa_(said):

    try:
        if said.startswith("learn"):
            train(said.replace("learn", ""))
        elif said.split(" ")[0] in questions_starters:

            say.say(ask(said))
    except:
        pass
示例#6
0
def getting_specified_program(requested, program_list):

    for program in program_list:
        if requested == program[0].replace(".lnk", ""):
            open_program(program[0], program[1])
            return

    for program in program_list:
        if requested in program[0].replace(".lnk", ""):
            open_program(program[0], program[1])
            return

    say.say("failed")
示例#7
0
def talkings(said):

    if 'time' in said:
        hours, minutes = gettingtime.time()
        say.say("The time is " + hours + " " + minutes)

    elif 'date' in said:
        date, month = gettingtime.date()
        say.say("the date is " + date + " of " + month)

    elif said == 'who are you':
        say.say("Hello I am zen and i am created by ahmed shah rear")

    else:
        pass
        qa_(said)
示例#8
0
def open_program(said):

    said = said.replace("open ", "")
    said = said.replace("start ", "")

    if ".com" in said or " dot com" in said:
        said.replace(" dot com", ".com")

        os.system("explorer http://" + said)
        return

    elif "in" in said:

        said = said.replace(".com", "")
        said = said.replace("www.", "")
        said = said.replace("in", "")
        said = said.replace("browser", "")

        if "chrome" in said:
            said = said.replace("chrome", "")
            said = said.replace(" ", "")
            said = "www." + said + ".com"
            said = "start chrome " + said
            os.system(said)

        if "firefox" in said:
            said = said.replace("firefox", "")
            said = said.replace(" ", "")
            said = "www." + said + ".com"
            said = "start firefox " + said
            os.system(said)

        if "edge" in said:
            said = said.replace("edge", "")
            said = said.replace("microsoft", "")
            said = said.replace(" ", "")
            said = "https://www." + said + ".com"
            said = "start microsoft-edge:" + said
            os.system(said)

        return

    else:
        if "computer" in said or "pc" in said:
            os.system("explorer ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")
            return "sucess"
        if "document" in said:
            os.system("explorer shell:document")
            return "sucess"
        if "download" in said:
            os.system("explorer shell:downloads")
            return "sucess"
        if "desktop" in said:
            os.system("explorer shell:Desktop")
            return "sucess"
        if "music" in said:
            os.system("explorer shell:Music")
            return "sucess"
        if "video" in said:
            os.system("explorer shell:Video")
            return "sucess"

        return open_any_program.start_program(said)

    say.say("I cant find any application named " + said)