Example #1
0
def step_click_ans_input():
    mouse_click(GetSystemMetrics(0) - 910, 500)
    text_position = qzm_tools.until_get_element('text_flag.png',
                                                fun=mouse_wheel_down)
    click_position_x, click_position_y = text_position[0] - 300, text_position[
        1] - 80
    mouse_click(click_position_x, click_position_y, delay=0.5)
    time.sleep(0.5)
Example #2
0
def step_see_add_button():
    global elements
    # 将鼠标移动于不会有弹出文字的地方
    win32api.SetCursorPos([GetSystemMetrics(0) - 240, 360])
    add_ans_position = qzm_tools.until_get_element('add_ans.png',
                                                   index=-1,
                                                   fun=mouse_wheel_down)
    elements['totop.png'] = get_element('totop.png', index=-1)
    before_average_gray = qzm_tools.get_last_screen_gray()
    return (add_ans_position, before_average_gray)
Example #3
0
def step_check_ans_input():
    if not qzm_tools.until_get_element('ans_flag.png', attempts=10):
        return False
    # 不需要转人工话术
    # finder = qzm_tools.ImgFinder('artificial_flag.png')
    # try:
    #     finder.get_element()
    # except qzm_tools.FindImgError:
    #     pass
    # else:
    #     raise NeedArtificalAddError('需要转人工')
    return True
Example #4
0
def main():
    global import_finish_list
    global bot_height
    global elements
    # start
    set_wind_pos()
    time.sleep(0.5)
    for wind in get_top_windows():
        if win32gui.GetClassName(wind) == 'Shell_TrayWnd':
            bot_height = win32gui.GetWindowRect(
                wind)[3] - win32gui.GetWindowRect(wind)[1]
    # 进入时效页
    # website_edit_input('https://alphax.taobao.com/commercialize.html?appkey=23542470#/knowledge/knowledgeActivity')
    mouse_click(*get_element('knowledge_activity.png'))
    time.sleep(2)
    mouse_click(GetSystemMetrics(0) - 350, 420)
    time.sleep(0.3)

    # 获取时效
    get_time_active()
    print(time_active_list)

    # 进入问法页
    # website_edit_input('https://alphax.taobao.com/commercialize.html?appkey=23542470#/knowledge/knowledgeSolution')
    time.sleep(0.5)
    mouse_click(*get_element('knowledge_solution.png'))
    time.sleep(2)
    mouse_click(GetSystemMetrics(0) - 350, 420)
    time.sleep(0.3)
    # 关闭行业高频问题推荐框,关闭这个框之后回答问题不会出现推荐框
    try:
        mouse_click(*get_element('recommend_cross.png'), delay=0.2)
        time.sleep(0.5)
    except Exception as e:
        print('没有推荐框')

    # qa_list   class_list   q_list     a_list  single_ans   ans     pic   id_list     tac
    #    [        [        [问题合集] ,   [        [       答案内容,pic, [ 商品id ], tac  ]  ] ] ]

    qa_list = get_excel_content()

    # 记录excel取数据到第几行,删除用
    get_excel_row = 2
    for i, single_qa_list in enumerate(qa_list):
        try:
            step_search_ques(single_qa_list[0])  # 搜索问题
            import_finish_ans = add_all_ans(single_qa_list)  # 添加答案
        except NotFindQuestionError as e:
            print(e)
            error_handle_not_find_ques(single_qa_list)
            continue
        except NeedArtificalAddError as e:
            print(e)
            error_handle_need_artifical_add(single_qa_list)
            continue
        except MultiFindQuestionError as e:
            print(e)
            error_handle_multi_find(single_qa_list)
            continue
        else:
            import_finish_list.append([single_qa_list[0], import_finish_ans])
            # 到达页面顶部
            # win32api.mouse_event(win32con.MOUSEEVENTF_WHEEL, 0, 0, 10000)
            mouse_click(*get_element('totop.png'))
            qzm_tools.until_get_element('top_flag.png')

        # 导入后或处理错误后
        # get_excel_row += len(single_qa_list[1])
        #  每十条问题保存进excel,删除原文件10个问题,
        #  或完成所有问题则保存(不包括完成最后一条标志结束记录)
        # if i %10 == 9 or i == len(qa_list)-2:
        #     save_to_excel('结果表格/已导入答案.xlsx', import_finish_list, max_col=5)
        #     import_finish_list = []
        #     save_to_excel('结果表格/未导入答案.xlsx', import_error_list, max_col=6)
        #     import_error_list = []
        #     clear_excel_rows('结果表格/QA表.xlsx', 2, get_excel_row-1)
        #     get_excel_row = 2

        get_excel_row += len(single_qa_list[1])
        if i % 10 == 9 or i == len(qa_list) - 2:
            finish_save_excel(import_finish_list)
            import_finish_list = []
            clear_excel_rows('结果表格/QA表.xlsx', 2, get_excel_row - 1)
            get_excel_row = 2

    # 关闭取消置顶窗口
    time.sleep(1)
    clear_wind_pos()
Example #5
0
def step_check_result():
    qzm_tools.until_get_element('import_finish_flag.png')
    mouse_click(*qzm_tools.until_get_element('import_finish.png'), delay=0.1)
    # 等待答案框消失
    qzm_tools.until_get_element('import_dis_flag.png')
    time.sleep(0.3)
Example #6
0
def step_click_upload_txt():
    mouse_click(*get_element('import_commodity.png'), delay=0.1)
    mouse_click(*qzm_tools.until_get_element('upload_text.png'), delay=0.1)
    while not qzm_tools.until_get_element('upload_flag.png'):
        mouse_click(*qzm_tools.until_get_element('upload_text.png'), delay=0.1)
Example #7
0
def step_click_spe_item():
    mouse_click(*qzm_tools.until_get_element('designated_commodity.png',
                                             fun=mouse_wheel_down))
    while not qzm_tools.until_get_element('import_commodity.png', attempts=5):
        mouse_click(*qzm_tools.until_get_element('designated_commodity.png',
                                                 fun=mouse_wheel_down))
Example #8
0
def step_click_pic_input():
    mouse_click(*get_element('add_pic.png'), delay=0.2)
    while not qzm_tools.until_get_element('upload_flag.png', attempts=2):
        mouse_click(*get_element('add_pic.png'))