def search(): # cool down: 30 seconds methods = ('search', 'scout') pya.typewrite(f'pls {random.choice(methods)}\n', interval=ran_inter()) pya.tripleClick(search_text_location) pya.hotkey('ctrl', 'c') sleep(0.05) pya.click(textinput_box) search_string = str(pyperclip.paste()).split( ',') # 'dresser, laundromat, pantry' for i in range(len(search_string)): search_string[i] = search_string[i].replace( ' ', '').lower() # ['dresser','laundromat','pantry'] if 'dog' in search_string: pya.typewrite(f'dog\n', interval=ran_inter()) elif 'dog' in search_string: pya.typewrite(f'dog\n', interval=ran_inter()) elif 'hospital' in search_string: pya.typewrite(f'hospital\n', interval=ran_inter()) elif 'discord' in search_string: pya.typewrite(f'discord\n', interval=ran_inter()) elif 'sewer' in search_string: pya.typewrite(f'sewer\n', interval=ran_inter()) else: pya.typewrite(f'{random.choice(search_string)}\n', interval=ran_inter())
def clickT(x, y): if ON: if (0 <= int(x) <= getScale()[0] and 0 <= int(y) <= getScale()[0]): moveTo(x, y, 0) P.tripleClick() else: P.tripleClick()
def getmsg(): global x, y try: position = pt.locateOnScreen("paperclip.PNG", confidence=.6) x = position[0] y = position[1] ##pt.moveTo(x,y,duration=.5) x += 100 y -= 50 pt.moveTo(x, y, duration=.5) posXY = pt.position() try: if pt.pixelMatchesColor(int(posXY[0]), int(posXY[1]), (255, 255, 255), tolerance=10): pt.moveRel(-10, 0) pt.tripleClick() pt.moveRel(60, 80) pt.click() pt.typewrite(msg_to_send_pray, interval=.5) pt.typewrite("\n") sleep(0.5) pt.press('enter') else: print("waiting for new msg") except (Exception): print("color match failed") except (Exception): print("paperclip not found") sleep(3)
def getmessage(): p.moveTo(535, 621) p.tripleClick() p.sleep(0.5) p.hotkey('ctrl', 'c', interval=0.1) p.sleep(0.1) return (pyperclip.paste())
def take_name(): global x, y, flag pos = pt.locateOnScreen("whatsapp/search.PNG", confidence=.9) x = pos[0] y = pos[1] pt.moveTo(x - 500, y + 5, duration=.5) pt.click() sleep(2) try: pos2 = pt.locateOnScreen("whatsapp/Contact.PNG", confidence=.9) x = pos2[0] y = pos2[1] pt.moveTo(x - 40, y + 380, duration=.5) except Exception: pos2 = pt.locateOnScreen("whatsapp/Group.PNG", confidence=.8) flag = 1 # print(flag) x = pos2[0] y = pos2[1] pt.moveTo(x - 35, y + 390, duration=.5) pt.tripleClick() pt.rightClick() pt.moveRel(0, 15) pt.click() name = pyperclip.paste() pt.moveTo(x - 40, y + 10) pt.click() # print("Take name running...") return name
def triple_click(self, button='left', interval=0.0): '''Triple clicks with the specified mouse button. See documentation of ``button`` in `Click`. See documentation of ``interval`` in `Double Click`. ''' ag.tripleClick(button=button, interval=float(interval))
def go(): x = 0 while x < 5: pyautogui.click(clicks=100000, interval=0.0001) pyautogui.doubleClick() pyautogui.tripleClick() if stop == True: break
def copy_message_routine(): global x, y pt.moveTo(x, y, duration=.05) pt.moveTo(x + 40, y - 40, duration=.5) pt.tripleClick() pt.rightClick() pt.moveRel(12, 15) pt.click()
def mouse_control(): currentMouseX, currentMouseY = pyautogui.position() # 鼠标当前位置 print(currentMouseX, currentMouseY) # 控制鼠标移动,duration为持续时间 for i in range(2): pyautogui.moveTo(100, 100, duration=0.25) # 移动到 (100,100) pyautogui.moveTo(200, 100, duration=0.25) pyautogui.moveTo(200, 200, duration=0.25) pyautogui.moveTo(100, 200, duration=0.25) for i in range(2): pyautogui.moveRel(50, 0, duration=0.25) # 从当前位置右移100像素 pyautogui.moveRel(0, 50, duration=0.25) # 向下 pyautogui.moveRel(-50, 0, duration=0.25) # 向左 pyautogui.moveRel(0, -50, duration=0.25) # 向上 # 按住鼠标左键,把鼠标拖拽到(100, 200)位置 pyautogui.dragTo(100, 200, button='left') # 按住鼠标左键,用2秒钟把鼠标拖拽到(300, 400)位置 pyautogui.dragTo(300, 400, 2, button='left') # 按住鼠标左键,用0.2秒钟把鼠标向上拖拽 pyautogui.dragRel(0, -60, duration=0.2) # pyautogui.click(x=moveToX, y=moveToY, clicks=num_of_clicks, interval=secs_between_clicks, button='left') # 其中,button属性可以设置成left,middle和right。 pyautogui.click(10, 20, 2, 0.25, button='left') pyautogui.click(x=100, y=200, duration=2) # 先移动到(100, 200)再单击 pyautogui.click() # 鼠标当前位置点击一下 pyautogui.doubleClick() # 鼠标当前位置左击两下 pyautogui.doubleClick(x=100, y=150, button="left") # 鼠标在(100,150)位置左击两下 pyautogui.tripleClick() # 鼠标当前位置左击三下 pyautogui.mouseDown() # 鼠标左键按下再松开 pyautogui.mouseUp() pyautogui.mouseDown(button='right') # 按下鼠标右键 pyautogui.mouseUp(button='right', x=100, y=200) # 移动到(100, 200)位置,然后松开鼠标右键 # scroll函数控制鼠标滚轮的滚动,amount_to_scroll参数表示滚动的格数。正数则页面向上滚动,负数则向下滚动 # pyautogui.scroll(clicks=amount_to_scroll, x=moveToX, y=moveToY) pyautogui.scroll(5, 20, 2) pyautogui.scroll(10) # 向上滚动10格 pyautogui.scroll(-10) # 向下滚动10格 pyautogui.scroll(10, x=100, y=100) # 移动到(100, 100)位置再向上滚动10格 # 缓动/渐变函数可以改变光标移动过程的速度和方向。通常鼠标是匀速直线运动,这就是线性缓动/渐变函数。 # PyAutoGUI有30种缓动/渐变函数,可以通过pyautogui.ease*?查看。 # 开始很慢,不断加速 pyautogui.moveTo(100, 100, 2, pyautogui.easeInQuad) # 开始很快,不断减速 pyautogui.moveTo(100, 100, 2, pyautogui.easeOutQuad) # 开始和结束都快,中间比较慢 pyautogui.moveTo(100, 100, 2, pyautogui.easeInOutQuad) # 一步一徘徊前进 pyautogui.moveTo(100, 100, 2, pyautogui.easeInBounce) # 徘徊幅度更大,甚至超过起点和终点 pyautogui.moveTo(100, 100, 2, pyautogui.easeInElastic)
def get_click(): start_k = ui.lineEdit.text() stop_k = ui.lineEdit_2.text() while True: if key.is_pressed(start_k): auto.tripleClick() if key.is_pressed(stop_k): break
def triple_click(button="left"): """ 当前位置进行三击 button:["left", "middle", "right", "primary", "secondary"] left:左键 middle:中键 right:右键 primary:主键 secondary: 辅键 """ pyautogui.tripleClick(button=button)
def get_blog_address(): click_Blogger_tab() pyautogui.moveTo(710, 61) pyautogui.tripleClick() pyautogui.rightClick() pyautogui.press('down') pyautogui.press('down') pyautogui.press('c') # copy blog address to clipboard blog_address = pyperclip.paste() # read blog address from clipboard return blog_address
def cycle(i, log_name): smart_click(clear_position) smart_click(answer_position) smart_click(get_entry_position) auto.tripleClick(enrty_position) smart_click('') auto.hotkey('ctrl', 'c') smart_click('') buffer = get_from_buffer() result = check_answer(buffer, i) write_log(str(result), log_name) auto.click(next_position)
def human_input(self, inputaction, parameters=None): log.info("human-input: {} ({})".format(inputaction, parameters)) assert inputaction != None, "human-input: inputaction can't be None" if inputaction == "click": if parameters[0] in ["left","middle","right"]: pyautogui.click(button=parameters[0]) elif parameters[0] == "double": pyautogui.doubleClick() elif parameters[0] == "triple": pyautogui.tripleClick() elif inputaction == "type": if parameters: pyautogui.typewrite(parameters[0], interval=(0.05/len(parameters[0]))) else: log.warn("human-input: No text specified") elif inputaction == "press": if parameters: pyautogui.press(parameters) else: log.warn("human-input: No key specified") elif inputaction == "scroll": scroll_direction, scroll_amount = parameters if scroll_direction == "down": scroll_amount *= -1 # positive number is up, negative number is down pyautogui.scroll(scroll_amount) elif inputaction == "move": mouseact = None value = None for p in parameters: if p == None or p == "": continue if p in ["up","down","left","right","set","center"]: mouseact = p else: value = int(p) if mouseact != None: if mouseact in ["up","down","left","right"]: x = value if mouseact == "right" else (-value if mouseact == "left" else None) y = value if mouseact == "down" else (-value if mouseact == "up" else None) pyautogui.moveRel(x, y, duration=0.25, tween=pyautogui.easeInOutQuad) elif mouseact == "center": screenWidth, screenHeight = pyautogui.size() x, y = pyautogui.center((0,0,screenWidth,screenHeight)) pyautogui.moveTo(x, y, duration=0.25, tween=pyautogui.easeInOutQuad) else: log.warn("can't move the mouse like that") else: log.warn("can't move the mouse like that") else: log.error("human-input: inputaction {} not yet supported".format(inputaction))
def get_message(): global x, y position = pt.locateOnScreen("Whatsapp/smiley.png", confidence=.6) pt.moveTo(position, duration=.5) position = pt.position() x = position[0] y = position[1] pt.moveTo(x + 70, y - 70, duration=.5) pt.tripleClick() pt.rightClick() pt.moveRel(15, 15) pt.click() wp_msg = srtct.paste() return wp_msg
def get_message(): global x,y position = pt.locateOnScreen("Smiley_paperclip.jpg", confidence = .6) x= position[0] y= position[1] pt.moveTo(x, y, duration=.5) pt.moveTo(x+40, y-70, duration=.5) pt.tripleClick() pt.rightClick() pt.moveRel(12,15) whatsapp_message = pyperclip.paste() pt.click() print("Message Recieved: " + whatsapp_message) return whatsapp_message
def get_message(): global x, y position = pt.locateOnScreen("images/whatsapp_reference.png", confidence=0.6) x = position[0] y = position[1] pt.moveTo(x, y, duration=0.05) pt.moveTo(x + 100, y - 50, duration=0.05) pt.tripleClick() pt.rightClick() pt.moveRel(10, -140) pt.click() return pyperclip.paste()
def get_message(): global x, y position = pt.locateOnScreen("messanger/smile.png", confidence=.5) x = position[0] y = position[1] pt.moveTo(x, y, duration=.05) pt.moveTo(x + 70, y - 40, duration=0.5) pt.tripleClick() pt.hotkey('ctrl', 'c') pt.click() message = pyperclip.paste() print("message recieved " + message) return message
def get_messages(): global x, y position = pt.locateOnScreen("Smiley.png", confidence=.5) x = position[0] y = position[1] pt.moveTo(x, y, duration=.05) pt.moveTo(x + 110, y - 90, duration=.05) pt.tripleClick() pt.rightClick() pt.moveRel(20, -230) pt.click() whatsapp_message = pyperclip.paste() pt.click() print("Message Received:" + whatsapp_message) return whatsapp_message
def moveMouse_typeKBD(): pyautogui.FAILSAFE = True mouseX , mouseY = pyautogui.position() pyautogui.moveTo(mouseX + 1000, mouseY-1000, duration=1) mouseX , mouseY = pyautogui.position() time.sleep(2) pyautogui.rightClick(x=mouseX, y=mouseX) time.sleep(5) pyautogui.doubleClick(x=mouseX, y=mouseY) time.sleep(5) pyautogui.tripleClick(x=mouseX - 400, y=mouseY + 500) time.sleep(5) pyautogui.press('left') pyautogui.press('alt') time.sleep(5)
def get_message(): global x,y position=pt.locateOnScreen("smiley_clip.png",confidence=0.60) x=position[0] y=position[1] pt.moveTo(x,y,duration=.1) pt.moveTo(x+82,y-57,duration=.1) pt.tripleClick() pt.rightClick() pt.moveRel(12,-120) pt.click() message=pyperclip.paste() print("message received: "+message) return message
def insert_original_file(file_number): click_Blogger_tab() click_Edit_area() pyautogui.press('up') original_file_name = get_file_name(file_number, 'original') (x, y) = get_file_location(file_number, 'original') pyautogui.moveTo(x, y) time.sleep(0.5) pyautogui.click() time.sleep(0.5) pyautogui.dragTo(700, 957, 2) #time.sleep(7) #time.sleep(6) time.sleep(15) scroll_down() click_Edit_area() click_image(957) scroll_down() click_Super_Big_button() scroll_down() click_Add_Image_Title_button() scroll_down() click_Add_Image_Title_field() pyautogui.tripleClick() time.sleep(1) # paste file name from clipboard pyautogui.hotkey('ctrl', 'v') time.sleep(1) click_Font_Size() pyautogui.moveRel(0, 93) time.sleep(1) pyautogui.click() time.sleep(1) scroll_down() click_Edit_area() pyautogui.press('up')
def get_message(): global x, y position = pt.locateOnScreen("smile_papers.png", confidence=.6) x = position[0] y = position[1] pt.moveTo(x, y, duration=.5) pt.moveTo(x + 60, y - 55, duration=.5) pt.tripleClick() pt.rightClick() pt.moveRel(12, 15) pt.click() whatsapp_message = pyperclip.paste() pt.click() print("Mensaje recibido:" + whatsapp_message) return whatsapp_message
def get_message(): global x, y position = pt.locateOnScreen("smileLine.png", confidence=.6) x = position[0] y = position[1] pt.moveTo(x, y, duration=.5) pt.moveTo(x + 70, y - 130, duration=.5) pt.tripleClick() pt.rightClick() #pt.moveRel(12, 15) pt.moveRel(12, 90) pt.click() whatsapp_message = pyperclip.paste() pt.click() print("Messege received: " + whatsapp_message) return whatsapp_message
def _extracted_from_cra_3dmax_32(coordinate_list, program_name, program_temp): button1 = coordinate_list[0] # 申请号坐标 button2 = coordinate_list[1] # 我具有激活码坐标 tripleClick(button1[0], button1[1]) hotkey('ctrl', 'c') # 复制申请号 key_soft = Application().start( join(getcwd(), 'app_pkg', program_name, 'crack', 'xf-adsk64')) # 打开注册机 step = { 0: ["Request :Edit", paste(), 'edit', 10], # 将申请号粘贴 1: ["CButton", 'click', 6], # 按下注册机patch按钮 2: ["确定Button", 'click', 6], # 按下弹出窗口的确定按钮 3: ["GButton", 'click', 6] } # 按下注册机Gen按钮获得激活码 if simple_install(window_backend='win32', step=step, program=key_soft): _extracted_from_cra_3dmax_44(key_soft, button2, program_temp)
def get_message(): global x, y position = pt.locateOnScreen("./greenCircle.png", confidence=.7) x = position[0] x = position[1] # Apple are... Apple. so need to add duration pt.moveTo(x, y, duration=.05) pt.moveTo(x + 470, y + -45, duration=.05) pt.tripleClick() pt.rightClick() pt.moveRel(12, 15) pt.click() whatsapp_message = pyperclip.paste() # Python String Interpolation print(f"msg received: {whatsapp_message}") return whatsapp_message
def click_point(cls, points, left=True, times=1): if isinstance(points, tuple): if left: if times == 1: auto.click(*points) elif times == 2: auto.doubleClick(*points) elif times == 3: auto.tripleClick(*points) else: raise Exception("times must within 1~3.") time.sleep(0.2) else: auto.rightClick(*points) elif isinstance(points, list): for point in points: auto.click(point) time.sleep(0.2) auto.dragTo(1920, 1080)
def get_message(): global x, y position = pt.locateOnScreen("smilie.png", confidence=0.6) x = position[0] y = position[1] pt.moveTo(x, y) pt.moveTo(x + 70, y - 55) pt.tripleClick() pt.rightClick() sleep(2) pt.moveTo(527, 750) pt.moveRel(12, 15) pt.click() whatsapp_message = pyperclip.paste() pt.click() print("Message Recieved: " + whatsapp_message) return whatsapp_message
def get_message(): global x, y position = position1 = pt.locateOnScreen("whatsapp/smiley_paperclip.png", confidence=.6) x = position[0] y = position[1] pt.move(x, y, duration=.05) #duration es para MAC pero por las dudas para ubuntu pt.moveTo(x, y, duration=.5) pt.moveTo(x + 70, y - 40, duration=.5) pt.tripleClick() pt.rightClick() pt.moveRel(12, 15) pt.click() whatsapp_message = pyperclip.paste() pt.click() print("Message: " + whatsapp_message) return whatsapp_message
def startCode(clicktype="single", interval=0.5, healingtime=0.5): start = time() root.destroy() while True: if clicktype == "single": pyautogui.click(randrange(0, GetSystemMetrics(0)), randrange(0, GetSystemMetrics(1))) elif clicktype == "double": pyautogui.doubleClick(randrange(0, GetSystemMetrics(0)), randrange(0, GetSystemMetrics(1))) elif clicktype == "triple": pyautogui.tripleClick(randrange(0, GetSystemMetrics(0)), randrange(0, GetSystemMetrics(1))) end = time() if (end - start > interval): sleep(healingtime) start = time() end = time()
pyautogui.moveRel(1,1) #time.sleep(1) #pyautogui.click() #time.sleep(1) #pyautogui.mouseDown() time.sleep(1) ''' button = 'left' mouseDownUp = False if ~mouseDownUp: pyautogui.mouseDown(button=button, _pause=False) for i in range(0,50): if (i > 25): pyautogui.dragRel(-1 * (i-25),0, button=button, mouseDownUp=mouseDownUp) else: pyautogui.dragRel( 1 * i,0, button=button, mouseDownUp=mouseDownUp) if ~mouseDownUp: pyautogui.mouseUp(button=button, _pause=False) ''' print "double" pyautogui.doubleClick(); time.sleep(1) print "triple" pyautogui.tripleClick();
def dataReceived(self, data): #fetch commands from data cmds = data.split(';'); #exec each command for cmd in cmds: # cmd = object : action < :param < :param < :param ... >>> # each cmd contains atleast 'object' & 'action' splitted = cmd.split(':'); #invalid cmd? if (len(splitted)<2): continue #number of params params = len(splitted)-2 obj = splitted[0] act = splitted[1] if obj == "mouse": if act == "click": if params == 0: pyautogui.click() #click provided a parameter: number of clicks! elif params == 1: clicks = int(float(splitted[2])) pyautogui.click(clicks=clicks) elif act == "doubleclick": pyautogui.doubleClick() elif act == "tripleclick": pyautogui.tripleClick() elif act == "rightclick": pyautogui.rightClick() elif act == "scroll": if params == 2: x = int(float(splitted[2])) y = int(float(splitted[3])) pyautogui.hscroll(x); pyautogui.vscroll(y); elif act == "drag": if params == 1: # indicate that dragging is activated, but not yet started if splitted[2] == "start": self.dragActive = True # indicate that dragging in disactivated elif splitted[2] == "end": self.dragActive = False #stop dragging when active if self.dragStarted: self.dragStarted = False pyautogui.mouseUp() else: print "Unknown value for 'drag':" + splitted[2] elif params == 2: #are we already dragging? if not self.dragStarted: self.dragStarted = True pyautogui.mouseDown() #fetch x/y movement x = int(float(splitted[2])) y = int(float(splitted[3])) pyautogui.dragRel(x,y, mouseDownUp=False) elif act == "move": if params == 2: #fetch x/y movement x = int(float(splitted[2])) y = int(float(splitted[3])) #are we dragging? pyautogui.moveRel(x,y) elif obj == "key": key = splitted[2] print("keypress:" + act + " key:" + key) if (act == "press"): pyautogui.press(key) elif (act == "down"): pyautogui.keyDown(key) elif (act == "up"): pyautogui.keyUp(key)