コード例 #1
0
ファイル: AutoPlay.py プロジェクト: PlusWayne/wechat-project
def Play():
    flag = ""
    while True:
        scr = get_screenshot()
        expr = recognize(scr)
        print(expr, eval(expr))
        if flag == expr:
            continue
        else:
            flag = expr
            if eval(expr):
                os.system("adb shell input tap 300 1500")
            else:
                os.system("adb shell input tap 800 1500")
コード例 #2
0
def Play():
    m = PyMouse()
    flag = ""
    while True:
        # start = time.perf_counter()
        time.sleep(0.1)
        try:
            scr = get_screenshot()
            expr = recognize(scr)
            print(expr, eval(expr))
            if flag == expr:
                continue
            else:
                flag = expr
                if eval(expr):
                    m.click(loc['click_true_x'], loc['click_true_y'], 1)
                else:
                    m.click(loc['click_false_x'], loc['click_false_y'], 1)
        except:
            if 'scr' in vars():
                scr.save('failed.png')
            print('Error occurred: ')
            print(traceback.print_exc())
コード例 #3
0
ファイル: AutoPlayPC.py プロジェクト: jymsy/weixin
def Play():
    m = PyMouse()
    flag = ""
    while True:
        # start = time.perf_counter()
        time.sleep(0.1)
        try:
            scr = get_screenshot()
            expr = recognize(scr)
            print(expr, eval(expr))
            if flag == expr:
                continue
            else:
                flag = expr
                if eval(expr):
                    m.click(loc['click_true_x'], loc['click_true_y'], 1)
                else:
                    m.click(loc['click_false_x'], loc['click_false_y'], 1)
        except:
            if 'scr' in vars():
                scr.save('failed.png')
            print('Error occurred: ')
            print(traceback.print_exc())