def linux_key_tap(k, m=0): print "hello linux key tap", k, m if k in shifted: key.tap(unshifted[k], m | key.MOD_SHIFT) else: key.tap(k, m) keysup()
def delete_events( self, frequency=2, repetitions=5, image_file="delete_events.png" ): ##Frequency is how many seconds to erase every time. Repetitions is how many times to erase """Constructor""" self._windowMgr.retake_screenshot() try: self._windowMgr.find_button_coordinates( os.path.join(self.image_directory, image_file)) #path to the image except IOError: logging.warning('Image file Delete Events not found. Quitting..') return if self._windowMgr._pos == None: logging.warning( 'Could not delete events. Button not found on screen') else: time.sleep(15) for i in range(repetitions): time.sleep(frequency) position = (self._windowMgr._pos[0] + 32, self._windowMgr._pos[1] + 15) #add position offset mouse.move(position[0], position[1]) time.sleep(0.1) mouse.click() time.sleep(0.4) key.tap(key.K_RETURN)
def main_loop(self): while self._running: start = time.time() if self.watching_vitals: self.watch_vitals() exec_list = [] for k, v in self._current_sequences.items(): q = v.query(self._i) if q: exec_list.append(q) for e in exec_list: if len(e.key) > 1: if e.key in self.f_dict: key.tap(self.f_dict[e.key]) else: if e.condition != None and not e.condition(): continue key.tap(e.key) time.sleep(0.05) # print(str(len(self._current_sequences))) # print(self._i) while time.time() - self._t < self.pace: time.sleep(self._p) print(f'Time of cycle{self._i}: {time.time() - start}') self._t = time.time() self._i += 1
def letra1(self): a = 0 while a == 0: #levantamos la posision del puntero en el visor1 y la usamos en el emisor con = psycopg2.connect(DSN) cur = con.cursor() query = "select letra from sesion where id = 1;" cur.execute(query) con.commit() for linea in cur.fetchall(): # estas lineas hay que cambiarlas por las que van # recuperar los valores de las coordenadas letra = linea[0].replace('-','') print letra if letra <> '-': key.tap(letra) #Actualiza letra a nada con = psycopg2.connect(DSN) cur = con.cursor() query_letra = "update sesion set letra = '-' where id = 1;" cur.execute(query_letra) con.commit() cur.close() cur.close() time.sleep(0.5)
def open_eclipse(): """Open eclipse typing string 'eclipse' in menu search.""" open_main_menu() key.type_string("eclipse", 0) key.tap(long(key.K_RETURN)) wait_target(ECLIPSE_OPEN_PERSPECTIVE_IMG)#is better than 'time.sleep' to wait eclipse to be ready. time.sleep(1)
def click_ad(pos): delta = 100 mouse.smooth_move(pos[0] + delta, pos[1] + delta) mouse.click() mouse.smooth_move(pos[0], 0) # move mouse away #"find the спечели билет button" pos = None while True: time.sleep(1) # wait for the ads page to load 1s pos = findBitmapOnScreen('yatoto_specheli.png') if pos: break mouse.smooth_move(pos[0] + 10, pos[1] + 10) mouse.click() mouse.smooth_move(pos[0], 0) # move mouse away pos = None #"wait 2 seconds and look for вземи билета. if absent repeat" while True: time.sleep(2) # wait for the ads page to load 6s pos = findBitmapOnScreen('yatoto_specheli.png') if pos: break mouse.smooth_move(pos[0] + 10, pos[1] + 10) mouse.click() mouse.smooth_move(pos[0], 0) # move mouse away #"close the current tab with ctrl+W" time.sleep(2) key.tap('w', key.MOD_CONTROL) time.sleep(2)
def ecl_jboss_clear(): """Clicks on tab 'Servers' in the eclipse, and clean all published resources on JBOSS container.""" ecl_servers() wait_target_click(ECLIPSE_JBOSS_LOGO_IMG, RIGHT_BUTTON) time.sleep(1) key.type_string("c", 0) time.sleep(1) key.tap(long(key.K_RETURN))
def type_text(pos, text): moveclick(*pos) if isinstance(text, int): text = str(text) for i in range(10): key.tap(key.K_BACKSPACE) for k in text: key.tap(k)
def enterCode(): click(int(.3806734992*GetSystemMetrics (0)),int(.85286458333*GetSystemMetrics (1))) time.sleep(1) key.toggle( key.K_CONTROL, True) time.sleep(.1) key.tap( 'v' ) key.toggle( key.K_CONTROL, False) time.sleep(1) click(int(.68008784773*GetSystemMetrics (0)),int(.571614583*GetSystemMetrics (1)))
def simkey_type_words(pos, words, interal=0.1): mouse.move(*pos) mouse.click() for word in words: time.sleep(interal) key.tap('a', key.MOD_CONTROL) time.sleep(interal) key.type_string(word) key.tap(key.K_RETURN)
def paste_cmd_current(one_cmd): try: setText(one_cmd) key.toggle(key.K_CONTROL,True) key.tap("v") key.toggle(key.K_CONTROL,False) return True except Exception: return False
def find_water_bottle(): key.tap('i') # open inventory time.sleep(1) pos = findBitmapOnScreen('MC_fullBottle.png') mouse.smooth_move(pos[0], pos[1]) # point the bottle time.sleep(3) key.tap('i') # close inventory time.sleep(1)
def consume(index = 9): print("in consume") key.tap( str(index) ) time.sleep(0.3) mouse.toggle(True, mouse.RIGHT_BUTTON) time.sleep(4) mouse.toggle(False, mouse.RIGHT_BUTTON) time.sleep(0.3) key.tap('1') # sword is at 1 print("end consume")
def useTalents(): print("useTalents") x = width / 2 y = height / 2 for char in ['q', 'w', 'e', 'r', 'd', '1', '2', '3', '4', '5']: mouse.smooth_move(x - randint(-300, 300), y - randint(200, 200)) key.tap(char) mouse.click() time.sleep(0.5) key.tap(char) mouse.click(mouse.RIGHT_BUTTON)
def useTalents(): print ("useTalents") x = width/2 y = height/2 for char in ['q', 'w', 'e', 'r', 'd', '1', '2', '3', '4', '5']: mouse.smooth_move(x-randint(-300,300), y-randint(200,200)) key.tap(char) mouse.click() time.sleep(0.5) key.tap(char) mouse.click(mouse.RIGHT_BUTTON)
def ecl_show_view(search): """Uses a series of shortcuts to search functionality in eclipse and selects then.""" key.tap(long(ord('w')),long(key.MOD_ALT)) key.tap(long(ord('v'))) key.tap(long(ord('o'))) time.sleep(1) key.tap(long(key.K_DELETE)) key.type_string(search, 0) time.sleep(1) move_middle_bottom() mouse.click(LEFT_BUTTON) #to gain focus key.tap(long(key.K_RETURN)) time.sleep(1)
def export(self): # self._windowMgr.maximize_window() ##REMOVE key.tap(key.K_RETURN) time.sleep(0.1) key.tap(key.K_ALT) time.sleep(0.1) for i in range(9): key.tap(key.K_DOWN) time.sleep(0.1) key.tap(key.K_RETURN) time.sleep(0.3) key.tap(key.K_RETURN) time.sleep(1)
def login(): # key.tap(key.Code.SPACE, [key.Modifier.META]) # print('star sleep') # time.sleep(1) # print('end sleep') # key.tap('t', delay=1) # time.sleep(2) # key.tap(key.Code.RETURN) # time.sleep(5) key.type_string('3y7z6qmc') key.tap(key.Code.RETURN) time.sleep(5) key.tap(key.Code.RETURN)
async def heal_combo_sequence(self): try: i = 0 l = len(self.heal_seq) while True: if self.heal_cor: await asyncio.sleep(self.heal_seq[i][1]) cmd = self.heal_seq[i][0] if cmd == 'LMC': mouse.click() else: key.tap(cmd) i = (i + 1) % l except asyncio.CancelledError: raise
def save(self): # It needs to have been saved once already!! """Constructor""" # self._windowMgr.maximize_window() ##REMOVE key.tap(key.K_RETURN) time.sleep(0.1) key.tap(key.K_ALT) time.sleep(0.1) for i in range(3): key.tap(key.K_DOWN) time.sleep(0.1) key.tap(key.K_RETURN) time.sleep(2)
def watch_vitals(self): data = self.vision.read_bars() # print('watching', data) if data[1] < 0 or data[0] < 0: return cycle_time = time.time() for k, v in list(self.quick_watch_cooldowns.items()): if cycle_time - v > 1: del ([self.quick_watch_cooldowns[k]]) if data[0] < .9 and '1' not in self.quick_watch_cooldowns: key.tap('1') self.quick_watch_cooldowns['1'] = time.time() time.sleep(0.05) if data[1] < .7 and '3' not in self.quick_watch_cooldowns: key.tap('3') self.quick_watch_cooldowns['3'] = time.time()
def end_level(): key.tap(' ') sleep(0.5) key.tap(' ') sleep(0.5) key.tap(' ') sleep(2)
def refillHotbar(row): grid_step = 36 #open inventory key.tap('i') time.sleep(1) #find the first pos of the hot bar pos = findBitmapOnScreen('MC_cornerBottle.png') cornerpos = (pos[0] + grid_step/2, pos[1] + grid_step/2) mouse.smooth_move(cornerpos[0], cornerpos[1]) for col in range(9): mouse.smooth_move(cornerpos[0] + (col*grid_step), cornerpos[1] - (row * grid_step)) time.sleep(0.3) key.tap(str(col + 1)) time.sleep(0.3) print(str(col + 1)) #close inventory global drink_counter #reset the drink counter drink_counter = 0 key.tap('i') time.sleep(1)
def delete_events( self, frequency=2, repetitions=5, image_file="delete_events.png" ): ##Frequency is how many seconds to erase every time. Repetitions is how many times to erase """Constructor""" self._windowMgr.retake_screenshot() try: self._windowMgr.find_button_coordinates(os.path.join(self.image_directory, image_file)) # path to the image except IOError: logging.warning("Image file Delete Events not found. Quitting..") return if self._windowMgr._pos == None: logging.warning("Could not delete events. Button not found on screen") else: time.sleep(15) for i in range(repetitions): time.sleep(frequency) position = (self._windowMgr._pos[0] + 32, self._windowMgr._pos[1] + 15) # add position offset mouse.move(position[0], position[1]) time.sleep(0.1) mouse.click() time.sleep(0.4) key.tap(key.K_RETURN)
def click_ad(pos): delta = 100 mouse.smooth_move(pos[0]+delta, pos[1]+delta) mouse.click() mouse.smooth_move(pos[0], 0) # move mouse away #"find the спечели билет button" pos = None while True: time.sleep(1) # wait for the ads page to load 1s pos = findBitmapOnScreen('yatoto_specheli.png') if pos: break mouse.smooth_move(pos[0]+10, pos[1]+10) mouse.click() mouse.smooth_move(pos[0], 0) # move mouse away pos = None #"wait 2 seconds and look for вземи билета. if absent repeat" while True: time.sleep(2) # wait for the ads page to load 6s pos = findBitmapOnScreen('yatoto_specheli.png') if pos: break mouse.smooth_move(pos[0]+10, pos[1]+10) mouse.click() mouse.smooth_move(pos[0], 0) # move mouse away #"close the current tab with ctrl+W" time.sleep(2) key.tap('w', key.MOD_CONTROL) time.sleep(2)
def play(): print '# switch to Hurdles 2012 in your browser (you have 3 seconds)' time.sleep(3) s = time.time() while time.time() - s < 15: for _ in range(15): key.tap(key.K_LEFT) key.tap(key.K_RIGHT) key.tap(' ') time.sleep(0.1)
def m(dir, n = 1, delay = 0.10): delay += random.random()/10 # adds random 0 to 0.1 delay if dir == "L": for i in range(n): key.tap(key.K_LEFT) sleep(delay) elif dir == "R": for i in range(n): key.tap(key.K_RIGHT) sleep(delay) elif dir == "U": for i in range(n): key.tap(key.K_UP) sleep(delay) elif dir == "D": for i in range(n): key.tap(key.K_DOWN) sleep(delay)
def doublemove(queryParams, content_type): content = "OK" if queryParams.has_key('direction') and queryParams.has_key('distance'): direction = int(queryParams['direction']) distance = int(queryParams['distance']) n = int(distance / 50) print(direction, distance) if direction == MOVE_LEFT: for i in range(n): key.tap(key.K_LEFT) elif direction == MOVE_RIGHT: for i in range(n): key.tap(key.K_RIGHT) elif direction == MOVE_UP: for i in range(n): key.tap(key.K_UP) elif direction == MOVE_DOWN: for i in range(n): key.tap(key.K_DOWN) else: content = "no direction" return content_type, content
def doublemove(queryParams,content_type): content = "OK" if queryParams.has_key('direction') and queryParams.has_key('distance'): direction = int(queryParams['direction']) distance = int(queryParams['distance']) n = int(distance/50) print(direction,distance) if direction==MOVE_LEFT: for i in range(n): key.tap(key.K_LEFT) elif direction==MOVE_RIGHT: for i in range(n): key.tap(key.K_RIGHT) elif direction==MOVE_UP: for i in range(n): key.tap(key.K_UP) elif direction==MOVE_DOWN: for i in range(n): key.tap(key.K_DOWN) else: content = "no direction" return content_type,content
def make_avalanche(): ct = 0 relogin = False while True: # if not relogin and datetime.now().hour == 5 and datetime.now().minute > 25: # print('\n\n--------------\nRELOGIN\n\n\n') # login() # relogin = True ct += 1 print(f'Round {ct}:') for i in range(4): print('Eating mushroom') key.tap(key.Code.F2) time.sleep(random.random() / 2) for i in range(7): if ct == 1: continue print('Making avalanche') key.tap(key.Code.F1) time.sleep(3 + random.random()) print('...') key.tap(key.Code.F3) time.sleep(5) print('Using Dummy...') key.tap(key.Code.F4) time.sleep(1) mouse.smooth_move(870.0, 61.0) mouse.click() time.sleep(1) mouse.smooth_move(random.random() * 1000, random.random() * 1000) wait_time = 10 * 60 / 2 # wait_time = wait_time print(f'Waiting {wait_time} seconds') time.sleep(wait_time)
def goFight(): print ("goFight") ###move back and forth # x = width/2 # y = height/2 # mouse.smooth_move(x-randint(100,300)*direction, y-randint(0,100)) #ahead # mouse.click(mouse.RIGHT_BUTTON) # time.sleep(5) # mouse.smooth_move(x+randint(50,100)*direction, y-randint(0,100)) # back # mouse.click(mouse.RIGHT_BUTTON) ###use mini map x = width-((230+250)/2) # mid btw all maps and HM y = height+50-((155+235)/2) # mid btw all maps and HM #unmount key.tap('z') direction = 1 for i in range(3): chooseTalent() direction = direction * (-1) # toggle directions x1 = x - 70 * direction y1 = y - randint(-10,10) # surely within maps #y = y - randint(0,1)*(235-155) # haunted mines offset mouse.smooth_move(x1, y1) # pos on minimap #ALT callout key.toggle(key.K_ALT, True) mouse.click() key.toggle(key.K_ALT, False) #mount key.tap('z') time.sleep(1.5) key.tap('a') # attack move mouse.click() time.sleep(18) # time to cross half the map useTalents()
def goFight(): print("goFight") ###move back and forth # x = width/2 # y = height/2 # mouse.smooth_move(x-randint(100,300)*direction, y-randint(0,100)) #ahead # mouse.click(mouse.RIGHT_BUTTON) # time.sleep(5) # mouse.smooth_move(x+randint(50,100)*direction, y-randint(0,100)) # back # mouse.click(mouse.RIGHT_BUTTON) ###use mini map x = width - ((230 + 250) / 2) # mid btw all maps and HM y = height + 50 - ((155 + 235) / 2) # mid btw all maps and HM #unmount key.tap('z') direction = 1 for i in range(3): chooseTalent() direction = direction * (-1) # toggle directions x1 = x - 70 * direction y1 = y - randint(-10, 10) # surely within maps #y = y - randint(0,1)*(235-155) # haunted mines offset mouse.smooth_move(x1, y1) # pos on minimap #ALT callout key.toggle(key.K_ALT, True) mouse.click() key.toggle(key.K_ALT, False) #mount key.tap('z') time.sleep(1.5) key.tap('a') # attack move mouse.click() time.sleep(18) # time to cross half the map useTalents()
def login(self): for k, v in self.config.items(): if k == 'qq_path': continue self.open_qq() time.sleep(7) self.double_click_qq_input_text_box() time.sleep(1) key.tap(key.K_SHIFT) key.type_string(k) key.type_string('\t') self.double_click_passwd_input_text_box() key.tap(key.K_SHIFT) time.sleep(1) key.type_string(v) key.tap(key.K_RETURN) time.sleep(7)
def delete(): mouse.click_to(TITLE) key.tap("a", key.MOD_CONTROL) # Ctrl+A key.tap(key.K_DELETE) # Del sleep(0.1)
def openURL(): """opens website automatically if the resolution of the screen is usual ( HD or FHD ), else asks the user to open it manually""" width, heigth = screen.get_size() if heigth == 1080: mouse.smooth_move(200, 60) mouse.click(mouse.LEFT_BUTTON) mouse.click(mouse.LEFT_BUTTON) mouse.click(mouse.LEFT_BUTTON) elif heigth == 768: mouse.smooth_move(200, 60) mouse.click(mouse.LEFT_BUTTON) mouse.click(mouse.LEFT_BUTTON) mouse.click(mouse.LEFT_BUTTON) else: print 'Please open http://www.nytimes.com/interactive/science/rock-paper-scissors.html then type OK' if 'ok'.lower() == raw_input(): print 'TY' time.sleep(1) speed = 0 key.type_string('http',speed) key.tap('.', key.MOD_SHIFT) key.tap('6', key.MOD_SHIFT) key.tap('6', key.MOD_SHIFT) key.type_string('www.nytimes.com',speed) key.tap('6', key.MOD_SHIFT) key.type_string('interactive',speed) key.tap('6', key.MOD_SHIFT) key.type_string('science',speed) key.tap('6', key.MOD_SHIFT) key.type_string('rock-paper-scissors.html',speed) key.tap('6', key.MOD_SHIFT) key.tap(key.K_RETURN)
def paste(): mouse.click_to(TITLE) key.tap("v", key.MOD_CONTROL) # Ctrl+V sleep(0.1)
def _do_action_by_key(self, action): key.tap(action.key_binding)
drink_counter += 1 return drink_counter < water_supplies #eof drink #"presume minecraft is open" autopy.alert.alert("Aim at your XP farm and start") #"-main loop-" start = time.time() stop_flag = True while stop_flag: for i in range(600): # 600 attack() eat() end = time.time() if (end - start) > 2*6*60: # 2*6*60 every 6 min we lose 1 point thirst stop_flag = drink(3) start = end #"-end of main loop-" print ("You are out of water, enough farming!") key.tap(key.K_F4, key.MOD_ALT) # close the game
def consume(index = 9): key.tap( str(index) ) mouse.toggle(True, mouse.RIGHT_BUTTON) # press down time.sleep(4) mouse.toggle(False, mouse.RIGHT_BUTTON) # release key.tap('1') # sword is at 1
#"-main loop-" for count in range(1, 3+1): start = time.time() hotbar_empty = False while not hotbar_empty: for i in range(600): # 600 attack() eat() end = time.time() if (end - start) > 2*6*60: # 2*6*60 every 6 min we lose 1 point thirst has_more_water = drink(8) hotbar_empty = not has_more_water start = end #eof while not hotbar_empty try: refillHotbar(count) except: print ("Something unexpected happened: %s" % sys.exc_info()[0]) #"-end of main loop-" else: print ("You are out of water, enough farming!") key.tap(key.K_F4, key.MOD_ALT)
def initUP(): key.tap(key.K_ALT) key.tap(key.K_RIGHT) for x in range(5): key.tap(key.K_DOWN) key.tap(key.K_RETURN)
done = False #"-main loop-" while not done: #find the search area and click a little to the left pos = findBitmapOnScreen('yatoto_search.png') mouse.smooth_move(pos[0]-350, pos[1]+0) mouse.click() time.sleep(12) # wait for the ads page to load 30s #scroll down one row tap_count_to_scroll_one_row = 10 for i in range(tap_count_to_scroll_one_row): key.tap(key.K_DOWN) time.sleep(0.1) coords = findBitmapOnScreen('yatoto_done.png') if coords != None: done = True coords = findBitmapOnScreen('yatoto_ad_corner.png') if coords != None: click_ad(coords) #"-end of main loop-" #close yatoto key.tap('w', key.MOD_CONTROL) print ("All ads clicked. Exiting")
def on_tap(self, key, modifiers=None, msg=None): key = self._get_key(key) modifiers = self._get_modifiers(modifiers) K.tap(key, modifiers)
time.sleep(3) key.tap('i') # close inventory time.sleep(1) #eof find_water_bottle #"presume minecraft is open" autopy.alert.alert("Aim at your XP farm and start") #"-main loop-" start = time.time() stop_flag = True while stop_flag: for i in range(40): attack() eat() end = time.time() if (end - start) > 6*60: # every 6 min we lose 1 point thirst stop_flag = drink(3) start = end #"-end of main loop-" print ("You are out of water, enough farming!") key.tap(key.K_F4, key.MOD_ALT) # close the game
def run(): print "starting job... WEST" moveMouse(MY_GUILD_TAB) moveMouse(RANKING_TAB) leftClick() time.sleep(10) personalRankingImageFirst = captureImageAsBase64Str(IMAGE_TL, IMAGE_BR) moveMouse(SCROLL_START) leftClickStart() moveMouse(SCROLL_END) leftClickEnd() time.sleep(1) moveMouse(GUILD_BUTTON) personalRankingImageSecond = captureImageAsBase64Str(IMAGE_TL, IMAGE_BR) leftClick() time.sleep(10) guildRankingImageFirst = captureImageAsBase64Str(IMAGE_TL, IMAGE_BR) moveMouse(SCROLL_START) leftClickStart() moveMouse(SCROLL_END) leftClickEnd() moveMouse(MY_GUILD_TAB) time.sleep(1) guildRankingImageSecond = captureImageAsBase64Str(IMAGE_TL, IMAGE_BR) leftClick() saveResults(personalRankingImageFirst, personalRankingImageSecond, guildRankingImageFirst, guildRankingImageSecond, "WEST") print "starting job... EAST" key.tap("\t", key.MOD_ALT) moveMouse(MY_GUILD_TAB) moveMouse(RANKING_TAB) leftClick() time.sleep(10) personalRankingImageFirst = captureImageAsBase64Str(IMAGE_TL, IMAGE_BR) moveMouse(SCROLL_START) leftClickStart() moveMouse(SCROLL_END) leftClickEnd() time.sleep(1) moveMouse(GUILD_BUTTON) personalRankingImageSecond = captureImageAsBase64Str(IMAGE_TL, IMAGE_BR) leftClick() time.sleep(10) guildRankingImageFirst = captureImageAsBase64Str(IMAGE_TL, IMAGE_BR) moveMouse(SCROLL_START) leftClickStart() moveMouse(SCROLL_END) leftClickEnd() moveMouse(MY_GUILD_TAB) time.sleep(1) guildRankingImageSecond = captureImageAsBase64Str(IMAGE_TL, IMAGE_BR) leftClick() saveResults(personalRankingImageFirst, personalRankingImageSecond, guildRankingImageFirst, guildRankingImageSecond, "EAST") key.tap("\t", key.MOD_ALT)
def startPrint(): key.tap('p', key.MOD_CONTROL)
def openFile(): key.tap('o', key.MOD_CONTROL) time.sleep(1) key.type_string("test.stl") key.type_string(string) key.tap(key.K_RETURN)
def maintainUP(): key.tap(key.K_ALT) key.tap(key.K_RIGHT) for x in range(6): key.tap(key.K_DOWN) key.tap(key.K_RETURN) time.sleep(1) for x in range(8): key.tap('\t') key.type_string("130") time.sleep(1) key.tap('\t',key.MOD_SHIFT) time.sleep(1) key.tap(key.K_RETURN)
key.tap(key.Code.F2) time.sleep(random.random() / 2) for i in range(7): if ct == 1: continue print('Making avalanche') key.tap(key.Code.F1) time.sleep(3 + random.random()) print('...') key.tap(key.Code.F3) time.sleep(5) print('Using Dummy...') key.tap(key.Code.F4) time.sleep(1) mouse.smooth_move(870.0, 61.0) mouse.click() time.sleep(1) mouse.smooth_move(random.random() * 1000, random.random() * 1000) wait_time = 10 * 60 / 2 # wait_time = wait_time print(f'Waiting {wait_time} seconds') time.sleep(wait_time) key.tap(key.Code.TAB, [key.Modifier.META]) make_avalanche() key.tap(key.Code.TAB, [key.Modifier.META])
def useHeartStone(): key.tap('b') time.sleep(7)
def chooseTalent(): print ("chooseTalent") for i in range(3): key.tap(str(randint(1,5)), key.MOD_CONTROL)
done = False #"-main loop-" while not done: #find the search area and click a little to the left pos = findBitmapOnScreen('yatoto_search.png') mouse.smooth_move(pos[0] - 350, pos[1] + 0) mouse.click() time.sleep(12) # wait for the ads page to load 30s #scroll down one row tap_count_to_scroll_one_row = 10 for i in range(tap_count_to_scroll_one_row): key.tap(key.K_DOWN) time.sleep(0.1) coords = findBitmapOnScreen('yatoto_done.png') if coords != None: done = True coords = findBitmapOnScreen('yatoto_ad_corner.png') if coords != None: click_ad(coords) #"-end of main loop-" #close yatoto key.tap('w', key.MOD_CONTROL) print("All ads clicked. Exiting")
def delete(): mouse.click_to(TITLE) key.tap('a', key.MOD_CONTROL) # Ctrl+A key.tap(key.K_DELETE) # Del sleep(.1)
def paste(): mouse.click_to(TITLE) key.tap('v', key.MOD_CONTROL) # Ctrl+V sleep(.1)
def tap(self, key_to_tap, *modifiers): """Wraps autopy.key.tap, for reporting reporting""" if self._is_mouse_on_the_right(): key.tap(key_to_tap, *modifiers)