Пример #1
3
def temp():
    pyautogui.alert('This displays some text with an OK button.')
    pyautogui.position()  # current mouse x and y
    pyautogui.onScreen(x, y)  # True if x & y are within the screen.
    pyautogui.PAUSE = 2.5   # Pause 2.5 s
    pyautogui.dragTo(x, y, duration=num_seconds)  # drag mouse to XY
    pyautogui.dragRel(xOffset, yOffset, duration=num_seconds)  # drag mouse relative to its current position
    pyautogui.click(x=moveToX, y=moveToY, clicks=num_of_clicks, interval=secs_between_clicks, button='left') # The button keyword argument can be 'left', 'middle', or 'right'.
    pyautogui.scroll(amount_to_scroll, x=moveToX, y=moveToY)
    pyautogui.mouseDown(x=moveToX, y=moveToY, button='left')
    pyautogui.mouseUp(x=moveToX, y=moveToY, button='left')
    pyautogui.typewrite('Hello world!\n', interval=secs_between_keys)  # useful for entering text, newline is Enter
    pyautogui.typewrite(['a', 'b', 'c', 'left', 'backspace', 'enter', 'f1'], interval=secs_between_keys)
    pyautogui.hotkey('ctrl', 'c')  # ctrl-c to copy
    pyautogui.hotkey('ctrl', 'v')  # ctrl-v to paste
    pyautogui.alert('This displays some text with an OK button.')
    pyautogui.confirm('This displays text and has an OK and Cancel button.')
    pyautogui.prompt('This lets the user type in a string and press OK.')
    pyautogui.screenshot('foo.png')  # returns a Pillow/PIL Image object, and saves it to a file
    pyautogui.locateOnScreen('looksLikeThis.png')
    pyautogui.locateCenterOnScreen('looksLikeThis.png')  # returns center x and y
Пример #2
1
def navigateStartGameMenu():
    """Performs the clicks to navigate form the start screen (where the PLAY button is visible) to the beginning of the first level."""
    # Click on everything needed to get past the menus at the start of the game.

    # click on Play
    logging.debug('Looking for Play button...')
    while True: # loop because it could be the blue or pink Play button displayed at the moment.
        pos = pyautogui.locateCenterOnScreen(imPath('play_button.png'), region=GAME_REGION)
        if pos is not None:
            break
    pyautogui.click(pos, duration=0.25)
    logging.debug('Clicked on Play button.')

    # click on Continue
    pos = pyautogui.locateCenterOnScreen(imPath('continue_button.png'), region=GAME_REGION)
    pyautogui.click(pos, duration=0.25)
    logging.debug('Clicked on Continue button.')

    # click on Skip
    logging.debug('Looking for Skip button...')
    while True: # loop because it could be the yellow or red Skip button displayed at the moment.
        pos = pyautogui.locateCenterOnScreen(imPath('skip_button.png'), region=GAME_REGION)
        if pos is not None:
            break
    pyautogui.click(pos, duration=0.25)
    logging.debug('Clicked on Skip button.')

    # click on Continue
    pos = pyautogui.locateCenterOnScreen(imPath('continue_button.png'), region=GAME_REGION)
    pyautogui.click(pos, duration=0.25)
    logging.debug('Clicked on Continue button.')
Пример #3
0
def findAndClickPlatesOnBelt():
    """Find any plates on the conveyor belt that can be removed and click on them to remove them. This will get rid of excess orders."""
    for color in ('pink', 'blue', 'red'):
        result = pyautogui.locateCenterOnScreen(imPath('%s_plate_color.png' % (color)), region=(GAME_REGION[0] + 343, GAME_REGION[1] + 300, 50, 100))
        if result is not None:
            pyautogui.click(result)
            logging.debug('Clicked on %s plate on belt at X: %s Y: %s' % (color, result[0], result[1]))
 def try_locate(ref_image):
     location = None
     with self._suppress_keyword_on_failure():
         try:
             location = ag.locateCenterOnScreen(ref_image.encode('utf-8'))
         except ImageNotFoundException:
             pass
     return location
Пример #5
0
def check():

	checkBoxNumber = list(pyautogui.locateAllOnScreen('checkBox.png'))
	if checkBoxNumber:
		failedLabel.pack_forget()
		amount = len(checkBoxNumber)
		for b in range(0, amount):
			checkBox = pyautogui.locateCenterOnScreen('checkBox.png')
			pyautogui.moveTo(checkBox)
			pyautogui.click(checkBox, button='left')
			if(b == 0):
				pyautogui.click(checkBox, button='left')
		deleteBtn = pyautogui.locateCenterOnScreen('deleteBtn.png')
		print(deleteBtn)
		pyautogui.moveTo(deleteBtn, duration=0.25)
		pyautogui.click(deleteBtn, button='left')
	else:
		failedLabel.pack()
Пример #6
0
 def find_the_emulator_game(self):
     image = get_image("new-super-mario-bros-find-emu-game.png", self.emulator)
     coordinates = pyautogui.locateCenterOnScreen(image)
     if coordinates is None:  # pixels not found
         image = get_image("new-super-mario-bros-enabled.png", self.emulator)
     # activate the emulator
     x, y = coordinates[0], coordinates[1]
     pyautogui.moveTo(x, y, self.duration)
     pyautogui.click()
     time.sleep(1)
Пример #7
0
 def skip_enemy(self):
     print("Jumping over enemy ...")
     image = get_image("enemy-mushroom.png", self.emulator)
     searching = True;
     while(searching):
         coordinates = pyautogui.locateCenterOnScreen(image)
         if coordinates is not None:
             x, y = coordinates[0], coordinates[1]
             print(x, y)
             searching = False;
Пример #8
0
def put_a_day(human_number):
    pyautogui.PAUSE = 1
    number_locate = pyautogui.locateCenterOnScreen('number.png')
    pyautogui.moveTo(number_locate)
    pyautogui.click()

    pyautogui.typewrite(human_number, interval=0.25)
    query_locate = pyautogui.locateCenterOnScreen('query.png')
    pyautogui.moveTo(query_locate)
    pyautogui.click()

    com_box_locate = pyautogui.locateCenterOnScreen('com_box.png')
    pyautogui.moveTo(com_box_locate)
    pyautogui.click()

    chose_locate = pyautogui.locateCenterOnScreen('chose.png')
    pyautogui.moveTo(chose_locate)
    pyautogui.click()
    pyautogui.keyDown('pagedown')
    pyautogui.keyUp('pagedown')
Пример #9
0
def click(interfaceObject, pause=pause):
	link = interface[interfaceObject]
	if type(link) == tuple:  # coordinates
		pos = (link[0] + WINDOW_X, link[1] + WINDOW_Y)
	elif type(link) == str:  # here must be filename of element picture
		pos = pyautogui.locateCenterOnScreen(link)
		if pos == None:
			logging.info("clicking on %s is aborted - can't find image" % interfaceObject)
			return None
	logging.info('clicking on "%s", coords %s' % (interfaceObject, str(pos)))
	pyautogui.click(pos, pause=pause)
	return True
Пример #10
0
def for_image_click_center(image_path, click = 1):
	try:
		print('MOUSE: Click center on ', image_path, ' for ', click)
		x, y = gui.locateCenterOnScreen(image_path)
		mouse.moveTo(x, y)
		while(click > 0):
			print('\tclicked')
			mouse.click()
			click -= 1
		time.sleep(1)
	except Exception as e:
		gui.alert("Failed: " + str(e))
		print(e)
Пример #11
0
def send():
	createBtn = pyautogui.locateCenterOnScreen('createBtn.png')
	if createBtn:
		failedLabel.pack_forget()
		pyautogui.moveTo(createBtn, duration=0.25)
		for h in range(0,2):
			pyautogui.click(createBtn, button='left')

		def preprocess(something):
		    something = str(something)
		    output = []
		    for x in range(len(something)):
		        output.append(something[x])
		    return output

		emailAdressName = preprocess("_marek.s.newton")
		at = '@'
		emailCom = preprocess("gmail.com")
		
		for f in range(0, len(emailAdressName)):
			pyautogui.typewrite(emailAdressName[f])
		pyautogui.typewrite(at)
		for g in range(0, len(emailCom)):
			pyautogui.typewrite(emailCom[g])
		
		pyautogui.keyDown('enter')
		pyautogui.keyDown('tab')
		pyautogui.typewrite('bot message')
		pyautogui.keyDown('enter')
		pyautogui.keyDown('tab')
		pyautogui.typewrite('sent from gmailBot')

		sendBtn = pyautogui.locateCenterOnScreen('sendBtn.png')

		pyautogui.moveTo(sendBtn, duration=0.25)
		pyautogui.click(sendBtn, button='left')
	else:
		failedLabel.pack()
Пример #12
0
def ad_spotter(i):
    try:
        x,y = pyautogui.locateCenterOnScreen('jira.png')
        l,s = (int(x/2),int(y/2))
        pyautogui.moveTo(l,s)
        pyautogui.click(l,s)
        time.sleep(2)
        #pyautogui.click(l,s)
        #print(l,s)
        return(l,s)
    except:
        type=='NoneType'
        print('couldnt find play icon')
        with open('problem_b.txt', 'a') as f:
            f.write('COULDNT FIND PLAY ICON'+ i+'\n')
            return
Пример #13
0
def resume():
    try:
        #print('running resume')
        f,g = pyautogui.locateCenterOnScreen('play.png')
        r,f = (int(f/2),int(g/2))
        #print(r,f)
        pyautogui.moveTo(r,f)
        pyautogui.click(r,f)
        print(r,f)
        return(r,f)
    except:
        if type=="NoneType":
            print('couldnt find it')
            with open('problem_b.txt', 'a') as f:
                f.write('COULDNT FIND THE RESUME PLAY ICON' + i+'\n')
            return
Пример #14
0
def instream_adspot(i):
    try:
        if b_rowser == 'safari':
            l = ('in_saf.png')
        elif b_rowser == 'firefox':
            l = ('in_fire.png')
        elif b_rowser == 'chrome':
            l = ('in_chrome.png')
        x,y = pyautogui.locateCenterOnScreen(l,grayscale=True,tolerance=10)
        bottom_play = ((x),(y-50))
        pyautogui.moveTo(bottom_play)
        pyautogui.click(bottom_play)
        return bottom_play
    except:
        type == 'NoneType'
        print('no ad could be found')
        with open('problem.txt', 'a') as f:
            f.write('NO AD FOUND'+ i+'\n')
            close_tab()
            main()
Пример #15
0
def ad_spotter(i): #i may be able to change this entire function so that it uses one point of reference however I may still need to use a different point of reference for every browser
    try:
        if b_rowser == 'safari':
            l = ('saf_ad.png')
        elif b_rowser == 'firefox':
            l = ('fire_ad.png')
        elif b_rowser == 'chrome':
            l = ('chrome_ad.png')
        x,y = pyautogui.locateCenterOnScreen('play!.png')
        r,s = (int(x/2),int(y/2))
        new_center = ((r+125),(s+125))
        #print(new_center)
        pyautogui.moveTo(new_center)
        pyautogui.click(new_center)
    except:
        type == 'NoneType'
        print('no ad could be found')
        with open('problem.txt', 'a') as f:
            f.write('NO AD FOUND'+ i+'\n')
            main()
Пример #16
0
def ad_spotter(i): 
    try:
        if b_rowser == 'safari':
            l = ('saf_play.png')
        elif b_rowser == 'firefox':
            l = ('fire_play.png')
        elif b_rowser == 'chrome':
            l = ('chrome_play.png')
        x,y = pyautogui.locateCenterOnScreen(l)
        #r,s = (int(x/2),int(y/2))
        bottom_play = ((x-73),(y+309))
        #print(new_center)
        pyautogui.moveTo(bottom_play)
        pyautogui.click(bottom_play)
        return bottom_play
    except:
        type == 'NoneType'
        print('no ad could be found')
        with open('problem.txt', 'a') as f:
            f.write('NO AD FOUND'+ i+'\n')
            close_tab()
            main()
Пример #17
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# https://medium.com/@tracy_blog/pyautogui-installing-on-mac-os-x-86e397428b3#.11yltv19j
import pyautogui
import time

# take screenshot
# pyautogui.screenshot('tmp.png')

# !!! pixelperfect ( or read documentation about partial search )
# it's important to remember about different look on active/inactive state of apps
# if they looks different (even in details - pyguin won't find them)
# notice is about color for header, backgrounds, fonts etc.

# get coordinates and size of part
print(pyautogui.locateOnScreen('first_line.png'))
# get coordinates for center of part and move to
pyautogui.moveTo(pyautogui.locateCenterOnScreen('first_line.png'))
pyautogui.click()
pyautogui.typewrite('Hello into text file')
Пример #18
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul  3 21:56:12 2017

@author: Pranavtadepalli
"""


from selenium import webdriver
from bs4 import BeautifulSoup as soup
import time
import pyautogui
chromedriver = '//Users/Pranavtadepalli/Downloads/chromedriver'
browser = webdriver.Chrome(chromedriver)
browser.get('https://www.google.com/recaptcha/api2/demo')
x, y = pyautogui.locateCenterOnScreen('calc7key.png')
Пример #19
0
 def execute(self):
     super(MoveToButton, self).execute()
     button_loc = pyautogui.locateCenterOnScreen(self.button,
                                                 confidence=0.9)
     pyautogui.moveTo(button_loc[0], button_loc[1])
Пример #20
0
import pyautogui
import time

print('haha')
#pyautogui.displayMousePosition()
for i in range(1, 10):

    for pos in pyautogui.locateAllOnScreen('connect_button_image.PNG'):
        print(pos)
        x, y, w, h = pos
        pyautogui.moveTo(x, y, 2)
        pyautogui.click()
        time.sleep(2)
        try:
            sendNow_pos = pyautogui.locateCenterOnScreen('sendNow_image.PNG')
        except TypeError:
            print("send button not found!!")
        else:
            print(sendNow_pos)
            x1, y1 = sendNow_pos

            pyautogui.moveTo(x1, y1, 2)
            pyautogui.click()
            time.sleep(2)

    time.sleep(3)
    pyautogui.scroll(-300)
    time.sleep(3)

    for pos in pyautogui.locateAllOnScreen('connect_button_image.PNG'):
Пример #21
0
def click_img(imagePath):
    location = pyautogui.locateCenterOnScreen(imagePath, confidence=conf)
    x, y = location
    pyautogui.click(x, y)
Пример #22
0
# -*- coding: utf-8 -*-
# Author: Felix
# Date  : 2019-07-29 11:55
from icecream import ic
from basic_function import basic, get_use_time
import pyautogui as pyg
import random
X, Y = pyg.locateCenterOnScreen('../resource/挑战按钮.png')
use_time = get_use_time()
if __name__ == '__main__':
    # 可更改右边的数值设定要刷的次数
    for i in range(1, 1000):
        try:
            basic(x=X, y=Y, use_time=use_time + 5)
        except TypeError:
            # 多点几次跳到有挑战按钮的界面
            increment = random.choice([0.1, 0.2, 0.3, 0.4, 0.5])
            pyg.click(clicks=3, interval=1 + increment)
            continue
        # 显示已经刷了多少次
        ic(i)
Пример #23
0
def clickArrow():
    arrow = pyautogui.locateCenterOnScreen('images/arrow.png')
    if arrow:
        pyautogui.click(arrow)
        logging.info("Clicked arrow")
Пример #24
0
def startServing():
    """The main game playing function. This function handles all aspects of game play, including identifying orders, making orders, buying ingredients and other features."""
    global LAST_GAME_OVER_CHECK, INVENTORY, ORDERING_COMPLETE, LEVEL

    # Reset all game state variables.
    oldOrders = {}
    backOrders = {}
    remakeOrders = {}
    remakeTimes = {}
    LAST_GAME_OVER_CHECK = time.time()
    ORDERING_COMPLETE = {SHRIMP: None, RICE: None, NORI: None,
                         ROE: None, SALMON: None, UNAGI: None}

    while True:
        # Check for orders, see which are new and which are gone since last time.
        currentOrders = getOrders()
        added, removed = getOrdersDifference(currentOrders, oldOrders)
        if added != {}:
            logging.debug('New orders: %s' % (list(added.values())))
            for k in added:
                remakeTimes[k] = time.time() + TIME_TO_REMAKE
        if removed != {}:
            logging.debug('Removed orders: %s' % (list(removed.values())))
            for k in removed:
                del remakeTimes[k]

        # Check if the remake times have past, and add those to the remakeOrders dictionary.
        for k, remakeTime in copy.copy(remakeTimes).items():
            if time.time() > remakeTime:
                remakeTimes[k] = time.time() + TIME_TO_REMAKE # reset remake time
                remakeOrders[k] = currentOrders[k]
                logging.debug('%s added to remake orders.' % (currentOrders[k]))

        # Attempt to make the order.
        for pos, order in added.items():
            result = makeOrder(order)
            if result is not None:
                orderIngredient(result)
                backOrders[pos] = order
                logging.debug('Ingredients for %s not available. Putting on back order.' % (order))

        # Clear any finished plates.
        if random.randint(1, 10) == 1 or time.time() - PLATE_CLEARING_FREQ > LAST_PLATE_CLEARING:
            clickOnPlates()

        # Check if ingredient orders have arrived.
        updateInventory()

        # Go through and see if any back orders can be filled.
        for pos, order in copy.copy(backOrders).items():
            result = makeOrder(order)
            if result is None:
                del backOrders[pos] # remove from back orders
                logging.debug('Filled back order for %s.' % (order))

        # Go through and see if any remake orders can be filled.
        for pos, order in copy.copy(remakeOrders).items():
            if pos not in currentOrders:
                del remakeOrders[pos]
                logging.debug('Canceled remake order for %s.' % (order))
                continue
            result = makeOrder(order)
            if result is None:
                del remakeOrders[pos] # remove from remake orders
                logging.debug('Filled remake order for %s.' % (order))

        if random.randint(1, 5) == 1:
            # order any ingredients that are below the minimum amount
            for ingredient, amount in INVENTORY.items():
                if amount < MIN_INGREDIENTS:
                    orderIngredient(ingredient)

        # check for the "You Win" or "You Fail" messages
        if time.time() - 12 > LAST_GAME_OVER_CHECK:
            result = checkForGameOver()
            if result == LEVEL_WIN_MESSAGE:
                # player has completed the level

                # Reset inventory and orders.
                INVENTORY = {SHRIMP: 5, RICE: 10,
                             NORI: 10, ROE: 10,
                             SALMON: 5, UNAGI: 5}
                ORDERING_COMPLETE = {SHRIMP: None, RICE: None,
                                     NORI: None, ROE: None,
                                     SALMON: None, UNAGI: None}
                backOrders = {}
                remakeOrders = {}
                currentOrders = {}
                oldOrders = {}


                logging.debug('Level %s complete.' % (LEVEL))
                LEVEL += 1
                time.sleep(5) # give another 5 seconds to tally score

                # Click buttons to continue to next level.
                pos = pyautogui.locateCenterOnScreen(imPath('continue_button.png'), region=GAME_REGION)
                pyautogui.click(pos, duration=0.25)
                logging.debug('Clicked on Continue button.')
                pos = pyautogui.locateCenterOnScreen(imPath('continue_button.png'), region=GAME_REGION)
                if LEVEL <= 7: # click the second continue if the game isn't finished.
                    pyautogui.click(pos, duration=0.25)
                    logging.debug('Clicked on Continue button.')

        oldOrders = currentOrders
Пример #25
0
 def execute(turn):
     x, y = pyautogui.locateCenterOnScreen("pics/plan_white.png")
     x, y = Macro.vary_random(x, y)
     pyautogui.moveTo(x, y, 0.5)
Пример #26
0
    def start_saintelmore():
        laclick = Macro.locate_and_click
        rand_click = Macro.random_click
        laclick("pics/combat.png")
        laclick("pics/saintelmore/huntingrabbit.png")
        laclick("pics/saintelmore/saintelmore.png")
        laclick("pics/normal_combat.png")
        cc_x, cc_y = laclick("pics/saintelmore/saintelmore_cc.png")
        laclick("pics/decide.png")
        # laclick("pics/mission_start.png")
        rand_click(cc_x + 300, cc_y + 200)
        # turn 1
        time.sleep(3)
        while not pyautogui.locateOnScreen("pics/plan_white.png"):
            Macro.random_sleep()
            continue
        h_x, h_y = Macro.cont_find("pics/saintelmore/saintelmore_heliport_neutral.png")

        # command center
        cc_x, cc_y = h_x -220, h_y + 70

        # first move pod
        cc1_x, cc1_y = h_x - 230, h_y - 145

        # second move pod
        cc2_x, cc2_y = h_x - 335, h_y + 10

        # third move pod
        cc3_x, cc3_y = h_x - 500, h_y - 45
        laclick("pics/plan_white.png")
        rand_click(cc_x, cc_y)
        rand_click(cc1_x, cc1_y)
        laclick("pics/plan_execute.png")
        Macro.wait_plan()

        # udpate helipad
        h_x, h_y = Macro.cont_find(["pics/saintelmore/saintelmore_heliport_neutral2.png",
                                    "pics/saintelmore/saintelmore_heliport_neutral3.png"])

        # command center
        cc_x, cc_y = h_x -220, h_y + 70
        rand_click(cc_x, cc_y)
        laclick("pics/decide.png")
        laclick("pics/turn_end.png")
        Macro.wait_turn()

        # turn 2
        time.sleep(5)
        # update helipad location
        h_x, h_y = Macro.cont_find(["pics/saintelmore/saintelmore_heliport_neutral2.png",
                                    "pics/saintelmore/saintelmore_heliport_neutral3.png"])

        # command center
        cc_x, cc_y = h_x -220, h_y + 70

        # first move pod
        cc1_x, cc1_y = h_x - 230, h_y - 145

        # second move pod
        cc2_x, cc2_y = h_x - 335, h_y + 10

        # third move pod
        cc3_x, cc3_y = h_x - 500, h_y - 45

        # fourth move pod
        cc4_x, cc4_y = h_x - 210, h_y - 315

        while pyautogui.locateOnScreen("pics/plan_white.png") and not pyautogui.locateOnScreen("pics/plan_active.png"):
            laclick("pics/plan_white.png")
        rand_click(cc_x, cc_y)
        if pyautogui.locateOnScreen("pics/plan_white.png"):
            laclick("pics/plan_white.png")
        rand_click(cc2_x, cc2_y)
        rand_click(cc3_x, cc3_y)

        rand_click(cc1_x, cc1_y)
        rand_click(cc4_x, cc4_y)
        laclick("pics/plan_execute.png")
        Macro.wait_plan()
        laclick("pics/turn_end.png")
        Macro.wait_turn()

        time.sleep(3)
        epl_x, epl_y = Macro.cont_find("pics/saintelmore/enemy_pod_left.png")
        ep_x, ep_y = epl_x + 50, epl_y + 60

        m_x, m_y = ep_x + 160, ep_y + 270

        m1_x, m1_y = ep_x + 65, ep_y + 120

        m2_x, m2_y = ep_x - 150, ep_y - 70

        while pyautogui.locateOnScreen("pics/plan_white.png") and not pyautogui.locateOnScreen("pics/plan_active.png"):
            laclick("pics/plan_white.png")
        rand_click(m_x, m_y)
        if pyautogui.locateOnScreen("pics/plan_white.png"):
            laclick("pics/plan_white.png")
        rand_click(m1_x, m1_y)
        rand_click(ep_x, ep_y)
        rand_click(m2_x, m2_y)
        laclick("pics/plan_execute.png")
        Macro.wait_plan()
        if pyautogui.locateCenterOnScreen("pics/turn_end2.png"):
            laclick("pics/turn_end2.png")
        else:
            laclick("pics/turn_end.png")

        Macro.end_and_return()
        Macro.recycle()
Пример #27
0
def process_meetings():
    with open('meeting.csv', newline='') as csv_file:

        all_meetings = reader(csv_file)
        print("Meeting List:")
        for line in all_meetings:
            print(", ".join(line))
        print("\n")

    with open('meeting.csv', newline='') as csv_file:

        meetings = reader(csv_file)
        for row in meetings:
            if len(row) != 2 and len(row) != 3:
                if len(row) > 1:
                    print("\nSorry!\nInvalid Argument: " + str(row))
                continue

            if len(row) == 3:
                link, start_time, end_time = row
            else:
                link, start_time = row
                end_time = None

            if link is None or type(link) is not str:
                print("\nSorry!\nInvalid Format: link<" + str(link) + ">")
                continue

            if start_time is None or type(
                    start_time) is not str or start_time.find(":") <= 0:
                print("\nSorry!\nInvalid Format: start_time<" +
                      str(start_time) + ">")
                continue

            if end_time is not None and end_time.find(":") <= 0:
                print("\nSorry!\nInvalid Format: end_time<" + str(end_time) +
                      ">")
                continue

            link = link.strip()
            start_time = start_time.strip()
            if end_time is not None:
                end_time = end_time.strip()

            print("\nCurrent Meeting: ")
            print("Link  :\t" + link)
            print("Start :\t" + start_time)
            if end_time is not None:
                print("End   :\t" + end_time + "\n")

            try:
                start_datetime_obj = datetime.strptime(
                    datetime.now().strftime("%d/%m/%y") + " " + start_time,
                    '%d/%m/%y %H:%M')
                if end_time is not None:
                    end_datetime_obj = datetime.strptime(
                        datetime.now().strftime("%d/%m/%y") + " " + end_time,
                        '%d/%m/%y %H:%M')
            except (ValueError, TypeError):
                print("\nSorry!\nFailed to parse time!")
                continue

            if end_time is not None and datetime.now() > end_datetime_obj:
                print("Skipping Meeting: " + ", ".join(row) + "\n")
                continue

            while datetime.now() < start_datetime_obj:
                sleep(10)
                pass

            webbrowser.open(link)

            sleep(30)

            leave_button = None
            if end_time is not None and len(end_time) >= 3:
                for i in range(10):
                    if i < 3:
                        pyautogui.hotkey('alt', 'q')
                    sleep(3)
                    leave_button = pyautogui.locateCenterOnScreen(
                        'leave_button.png')
                    sleep(2)
                    if leave_button is not None:
                        break

            while datetime.now() < end_datetime_obj:
                sleep(30)
                pass

            if end_time is not None and len(
                    end_time) >= 3 and leave_button is not None:
                pyautogui.moveTo(leave_button)
                pyautogui.click()
                pyautogui.move(0, -100)
                sleep(5)
            else:
                print("Failed to detect 'Leave Meeting' button!")
                print("Please leave the meeting manually!")
import pyautogui, time

time.sleep(2)

pyautogui.click()
pyautogui.locateCenterOnScreen('1key.png')
Пример #29
0
def check():
    global hand
    sample = Image.open(R"G:\AutoPoker\data\JOKER.png")
    try:
        x, y = pgui.locateCenterOnScreen(sample, region=(35, 400, 370, 55), confidence=0.980, grayscale=True)
        hand.append([x, y, 0, 0])
        print("JOKER")
    except:
        pass

    n = 1
    for name in club:
        if len(hand) == 5:
            break
        
        sample = f"G:\AutoPoker\data\{name}.png"
        search = Image.open(sample)
        try:
            x, y = pgui.locateCenterOnScreen(search, region=(35, 400, 370, 55), confidence=0.980, grayscale=True)
            hand.append([x, y, 1, n])
            print(name)
        except:
            pass
        n += 1
            
    n = 1
    for name in diamond:
        if len(hand) == 5:
            break

        sample = f"G:\AutoPoker\data\{name}.png"
        search = Image.open(sample)
        try:
            x, y = pgui.locateCenterOnScreen(search, region=(35, 400, 370, 55), confidence=0.980, grayscale=True)
            hand.append([x, y, 2, n])
            print(name)
        except:
            pass
        n += 1

    n = 1
    for name in heart:
        if len(hand) == 5:
            break

        sample = f"G:\AutoPoker\data\{name}.png"
        search = Image.open(sample)
        try:
            x, y = pgui.locateCenterOnScreen(search, region=(35, 400, 370, 55), confidence=0.980, grayscale=True)
            hand.append([x, y, 3, n])
            print(name)
        except:
            pass
        n += 1

    n = 1
    for name in spade:
        if len(hand) == 5:
            break

        sample = f"G:\AutoPoker\data\{name}.png"
        search = Image.open(sample)
        try:
            x, y = pgui.locateCenterOnScreen(search, region=(35, 400, 370, 55), confidence=0.980, grayscale=True)
            hand.append([x, y, 4, n])
            print(name)
        except:
            pass
        n += 1
Пример #30
0
import pyautogui

createBtn = pyautogui.locateCenterOnScreen('createBtn.png')
if createBtn is None:
	print("is NONONONONONO")
elif createBtn:
	print("found")
else:
	print("failed")
Пример #31
0
def clickX():
    X = pyautogui.locateCenterOnScreen("images/X.png", confidence = 0.9, region=(1484, 935, 100, 63))
    if X: 
        pyautogui.click(X)
Пример #32
0
import cv2
import time
import pyautogui
import tempfile


#
# main
#
imagePath=tempfile.gettempdir()+r"\my_screenshot.png"
print("Tempfile:",imagePath)
while True:
    print ("Waiting for buttons....")
    while True:
        pos = pyautogui.locateCenterOnScreen('but_dismiss.png')
        if pos!=None:
            break
        time.sleep(5)
    print ("Face detection...")
    im1 = pyautogui.screenshot(imagePath)
    cascPath = "haarcascade_frontalface_default.xml"
    faceCascade = cv2.CascadeClassifier(cascPath)
    image = cv2.imread(imagePath)
    gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
    faces = faceCascade.detectMultiScale(
        gray,
        scaleFactor=1.1,
        minNeighbors=5,
        minSize=(100, 100)
    )
Пример #33
0
def checkBook(image = 'images/book.png', regions = (1762, 902, 167, 150)):
    return pyautogui.locateCenterOnScreen(image, confidence = 0.8, region=regions)
Пример #34
0
# Version 1

import pyautogui

teams_a_new_message = pyautogui.locateCenterOnScreen(
    'images\\a_new_message.png')
teams_a_new_conversation = pyautogui.locateCenterOnScreen(
    'images\\a_new_conversation.png')
teams_taskbar_icon = pyautogui.locateCenterOnScreen(
    'images\\teams_taskbar_icon.png')
message = 'test'


def initialize_again():
    print('inside initialize again')
    global teams_a_new_message
    global teams_a_new_conversation
    global teams_taskbar_icon
    teams_a_new_message = pyautogui.locateCenterOnScreen(
        'images\\a_new_message.png')
    teams_a_new_conversation = pyautogui.locateCenterOnScreen(
        'images\\a_new_conversation.png')
    teams_taskbar_icon = pyautogui.locateCenterOnScreen(
        'images\\teams_taskbar_icon.png')
    pass


def click_and_write_something(clickable, writable=None):
    pyautogui.click(clickable)
    if writable is None:
        pyautogui.write('test')
Пример #35
0
import PIL
import pyautogui as pag
import time

#screencap = pyautogui.screenshot("refresh.png")
refresh = pag.locateCenterOnScreen('refresh.png')
pag.click(refresh)
Пример #36
0
def click_img_plus_x(imagePath, pixel):
    location = pyautogui.locateCenterOnScreen(imagePath, confidence=conf)
    x, y = location
    pyautogui.click(x + pixel, y)
Пример #37
0
def graphics_test() -> None:
    from utility.constants import DATA_PATH, TEST_DATA_PATH
    import pyautogui

    # Pick Uniform Random Fill with Wave-Front
    x, y = pyautogui.locateCenterOnScreen(os.path.join(TEST_DATA_PATH,
                                                       'map.png'),
                                          confidence=0.5)
    pyautogui.click(x + 160, y + 5)
    x, y = pyautogui.locateCenterOnScreen(os.path.join(TEST_DATA_PATH,
                                                       'uniform.png'),
                                          confidence=0.9)
    pyautogui.click(x, y)
    x, y = pyautogui.locateCenterOnScreen(os.path.join(TEST_DATA_PATH,
                                                       'algorithm_new.png'),
                                          confidence=0.5)
    pyautogui.click(x + 150, y)
    x, y = pyautogui.locateCenterOnScreen(os.path.join(TEST_DATA_PATH,
                                                       'wave_front.png'),
                                          confidence=0.7)
    pyautogui.click(x, y)

    # start and end goals coordinate input
    pyautogui.click(342, 545)
    pyautogui.write('6')
    pyautogui.doubleClick(422, 545)
    pyautogui.write('1')
    pyautogui.doubleClick(502, 545)
    pyautogui.write('2')
    time.sleep(0.5)
    pyautogui.doubleClick(342, 617)
    pyautogui.write('6')
    time.sleep(0.5)
    pyautogui.doubleClick(422, 617)
    pyautogui.write('5')
    pyautogui.doubleClick(502, 617)
    pyautogui.write('5')

    x, y = pyautogui.locateCenterOnScreen(os.path.join(TEST_DATA_PATH,
                                                       'update.png'),
                                          confidence=0.5)
    pyautogui.click(x, y)

    wait_for('initialised.png')
    wait_for('traversables_new.png')

    # make traversables transparent for the RRT
    x, y = pyautogui.locateCenterOnScreen(os.path.join(TEST_DATA_PATH,
                                                       'traversables_new.png'),
                                          confidence=0.5)
    pyautogui.click(x - 120, y)

    # #run algo
    pyautogui.press('t')
    wait_for('done.png')

    # change trace color
    x, y = pyautogui.locateCenterOnScreen(os.path.join(TEST_DATA_PATH,
                                                       'trace_new.png'),
                                          confidence=0.8)
    pyautogui.click(x - 70, y)
    time.sleep(0.5)
    x, y = pyautogui.locateCenterOnScreen(os.path.join(TEST_DATA_PATH,
                                                       'colour_2.png'),
                                          confidence=0.8)
    pyautogui.click(x, y)

    take_screenshot("wave_front_3d.png")
Пример #38
0
def main(day, order):
    six = 70
    seven = six + 80
    eight = seven + 80
    nine = eight + 80
    ten = nine + 80
    eleven = ten + 80
    twelve = eleven + 100
    thirteen = twelve + 80
    fourteen = thirteen + 80
    i = 0

    for classes in order:

        if i >= 1:
            index = order.index(classes)
            sub = index - 1
            total = index - sub
            if total == -2:
                print('3333')
                time.sleep(3)
            elif total == -3:
                print('666666')
                time.sleep(6)
            elif total == -4:
                print('999999')
                time.sleep(9)

        time.sleep(5)
        x, y = gui.locateCenterOnScreen(day + '.png')
        gui.click(x, y)

        gui.move(300, 500)

        gui.scroll(20)
        gui.scroll(-9)

        if classes == 6:
            gui.move(x, y + six)
            gui.click(x, y + six, button='right')
            time.sleep(1)
        elif classes == 7:
            gui.move(x, y + six)
            gui.click(x, y + seven, button='right')
            time.sleep(1)
        elif classes == 8:
            gui.move(x, y + six)
            gui.click(x, y + eight, button='right')
            time.sleep(1)
        elif classes == 9:
            gui.move(x, y + six)
            gui.click(x, y + nine, button='right')
            time.sleep(1)
        elif classes == 10:
            gui.move(x, y + six)
            gui.click(x, y + ten, button='right')
            time.sleep(1)
        elif classes == 11:
            gui.move(x, y + six)
            gui.click(x, y + eleven, button='right')
            time.sleep(1)
        elif classes == 12:
            gui.move(x, y + six)
            gui.click(x, y + twelve, button='right')
            time.sleep(1)
        elif classes == 13:
            gui.move(x, y + six)
            gui.click(x, y + thirteen, button='right')
            time.sleep(1)
        elif classes == 14:
            gui.move(x, y + six)
            gui.click(x, y + fourteen, button='right')
            time.sleep(1)

        x, y = gui.locateCenterOnScreen('view.png')
        gui.click(x, y)
        time.sleep(5)
        x, y = gui.locateCenterOnScreen('join.png')
        gui.click(x, y)

        i += 1
        #50 minute sleep in the session
        time.sleep(10)

        #leaving the seesion
        x, y = gui.locateCenterOnScreen('leave.png')
        gui.click(x, y)

        x, y = gui.locateCenterOnScreen('calender.png')
        gui.click(x, y)
import pyautogui

#pyautogui.screenshot('C:\\Users\\E.H.PAUE\\python lessons\\test.png') # it will take screen shot and save it

print(pyautogui.screenshot())

#you can refer to chapter 17 for pilow image.

pyautogui.locateOnScreen(
    'C:\\Users\\E.H.PAUE\\python lessons\\calc_7.png'
)  # it will compair waht is in the picture and find it in the screen

print(
    pyautogui.locateOnScreen(
        'C:\\Users\\E.H.PAUE\\python lessons\\calc_7.png'))

print(
    pyautogui.locateCenterOnScreen(
        'C:\\Users\\E.H.PAUE\\python lessons\\calc_7.png')
)  # it will compair waht is in the picture and find it in the screen but in the centre

# in the above you will get None because the pixils are not 100% identical between the picture and the screen.
Пример #40
0
 def execute(self):
     super(ClickOnButton, self).execute()
     button = pyautogui.locateCenterOnScreen(self.button, confidence=0.9)
     for i in range(self.click_num):
         pyautogui.click(button[0], button[1])
Пример #41
0
#pyautogui.confirm('Shall I proceed?')

#pyautogui.confirm('Enter option.', buttons=['A', 'B', 'C'])

#pyautogui.prompt('What is your name?')

#pyautogui.password('Enter password (text will be hidden)')

#im1 = pyautogui.screenshot()
#im1.save('my_screenshot.png')
#im2 = pyautogui.screenshot('my_screenshot2.png')

# this is a test section You can also locate where an image is on the screen:

button7location = pyautogui.locateOnScreen(
    'button.png')  # returns (left, top, width, height) of matching region

buttonx, buttony = pyautogui.center(button7location)

pyautogui.click(buttonx,
                buttony)  # clicks the center of where the button was found

# The locateCenterOnScreen() function returns the center of this match region:

buttonx, buttony = pyautogui.locateCenterOnScreen(
    'button.png')  # returns (x, y) of matching region

pyautogui.click(buttonx,
                buttony)  # clicks the center of where the button was found
Пример #42
0
import os
import pyautogui
import time
from time import sleep
from datetime import datetime

try:
    # open MS Teams application
    os.startfile(r"C:\Users\shubh\AppData\Local\Microsoft\Teams\Update.exe")
    sleep(2)
    # settings
    settings = pyautogui.locateCenterOnScreen("settings.PNG")
    pyautogui.moveTo(settings)
    pyautogui.click()
    time.sleep(2)
    # manageteams.PNG
    manageteams = pyautogui.locateCenterOnScreen("manageteams.PNG")
    pyautogui.moveTo(manageteams)
    pyautogui.click()
    time.sleep(2)
except Exception as e:
    print(e)

while True:
    #DemoMeetOne
    now = datetime.now().strftime("%H:%M")
    if now < '11:00':
        DemoMeetOne = pyautogui.locateCenterOnScreen("Security.PNG")
        pyautogui.moveTo(DemoMeetOne)
        pyautogui.click()
        time.sleep(2)
Пример #43
0
import pyautogui as pa
import time
import pyperclip
# x1 = pyautogui.locateCenterOnScreen('Data/icon1.PNG')
# pyautogui.doubleClick(x1)

chrome = pa.locateCenterOnScreen('Data/chrome.PNG')
pa.doubleClick(chrome)

time.sleep(1)
pyperclip.copy('www.kpu.ac.kr')
pa.hotkey('ctrl',"v")
pa.press('enter')
time.sleep(1)
pa.hotkey('f11')
time.sleep(1)
pa.click(949,484)
time.sleep(2)
pa.click(1001,14)
time.sleep(2)
pa.click(716,299)

pa.typewrite('2016182007')
pa.press('tab')
pa.typewrite('dn97389738!')
pa.press('enter')
Пример #44
0
import pyautogui
pyautogui.PAUSE = 0.5

screenWidth, screenHeight = pyautogui.size()
pyautogui.moveTo(0, screenHeight)
pyautogui.click()
pyautogui.typewrite('putty')

while pyautogui.locateOnScreen('puttyIcon.png') == None:
	print("haven't found putty icon yet")

x, y = pyautogui.locateCenterOnScreen('puttyIcon.png')
pyautogui.click(x, y)
pyautogui.press(['tab', 'tab', 'tab', 'tab', 'down', 'down', 'enter'])

while pyautogui.locateOnScreen('loginAs.png') == None:
	print("Haven't found login field yet")

pyautogui.typewrite('blee')
pyautogui.press('enter')

while pyautogui.locateOnScreen('enterPassword.png') == None:
	print("Haven't found enter password field yet")

pyautogui.typewrite('133hammersmith133')
pyautogui.press('enter')
Пример #45
0
# 18, 13
# d17

round = time.time()
dhand = None
phand = None
p2hand = 0
p1active = True
splitted = False
action = None

logfile = open('logfile.csv', 'a')
logwriter = csv.writer(logfile, lineterminator='\n')

while True:
	anc = pyautogui.locateCenterOnScreen(get_image("anchor.png"), grayscale=True)

	# if anc:
	# 	print "anchor", anc

	if anc is not None:
		region = ( anc[0]-100, anc[1], 700, 800 )
		bregion = ( anc[0]-100, anc[1]+425, 700, 100)

	# if region:
	# 	# deal1 = (region[0]+270, region[1]+25, 20, 100)
	# 	deal1 = (region[0]+305, region[1]+290, 20, 100)
	# 	# dealer card 1
	# 	# pyautogui.screenshot('test.png', region=(region[0]+270, region[1]+25, 20, 100))
	# 	suits = ["club", "heart", "spade", "diamond"]
	# 	ranks = ["2","3","4","5","6","7","8","9","a","j","q","k"]
Пример #46
0
#WVC1	('W', 'V', 'C', '1')	.wmv
#mp4v	('m', 'p', '4', 'v')	.mov

if __name__ == '__main__':

    time.sleep(1)
    Popen('calc.exe', shell=True)
    dlg = Desktop(backend="uia")[u"電卓"]
    dlg.wait('visible')
    #spec_app = dlg.top_window()
    print(type(dlg))

    # なぜか録画ができない
    time.sleep(3)
    th_cl = TestThread(dlg)
    #th_cl = TestThread(spec_app)
    th_cl.start()
    
    for i in [0,8,0,9,6,6,7,2,2,2,2]:
        numFile = u".\\numdata\\" + str(i) + u".png"
        print( numFile )
#        p = pyautogui.locateOnScreen(numFile)
        #print(p)
        #x,y = pyautogui.center(p)
        #p = pyautogui.locateCenterOnScreen(numFile)
        x,y = pyautogui.locateCenterOnScreen(numFile)
        print(x,y)
        pyautogui.click(x,y)
        pyautogui.moveTo(0.0)
        time.sleep(2)
Пример #47
0
import os, pyautogui
os.chdir('C:\\Users\\twothree\\Desktop\\PythonGuiAuto')


ApsTab = pyautogui.locateCenterOnScreen('AP_Tab_Icon.PNG')

pyautogui.PAUSE = 5

pyautogui.click(ApsTab, 2)

Пример #48
0
import time
import pyautogui

#by Taylor Hadfield

#finds button on screen
image1 = pyautogui.screenshot()
image2 = pyautogui.screenshot('Salmonhunter.png')
x, y == pyautogui.locateCenterOnScreen('likeButton.png')
#932,598

#Thirst swipes
#100 in case your too thirsty
i=0
while (i<100):
        pyautogui.click(x,y)
        time.sleep(0.3)
        i+=1
Пример #49
0
import pyautogui, time
plu_label_location_x, plu_label_location_y=pyautogui.locateCenterOnScreen("/home/princesethi/Pictures/Gui_Automation/plu_label.png")
pyautogui.click(plu_label_location_x+60,plu_label_location_y)
pyautogui.hotkey('ctrl', 'a')
pyautogui.hotkey('ctrl', 'v')
edit_btn_location=pyautogui.locateCenterOnScreen("/home/princesethi/Pictures/Gui_Automation/edit_btn.png")
pyautogui.click(edit_btn_location)
pyautogui.moveRel(-100,250, duration=1.5)
pyautogui.click()
time.sleep(1.0)
plu_label_location_x, plu_label_location_y=pyautogui.locateCenterOnScreen("/home/princesethi/Pictures/Gui_Automation/plu_label.png")
pyautogui.moveTo(plu_label_location_x-20,plu_label_location_y+45, duration=1.5)
pyautogui.click()
product_name_label_location_x, product_name_label_location_y=pyautogui.locateCenterOnScreen("/home/princesethi/Pictures/Gui_Automation/product_name_label.png")
pyautogui.moveTo(product_name_label_location_x+100, product_name_label_location_y)
pyautogui.click()
pyautogui.hotkey('ctrl', 'a')
pyautogui.hotkey('ctrl', 'v')
category_btn_location=pyautogui.locateCenterOnScreen("/home/princesethi/Pictures/Gui_Automation/category_btn.png")
pyautogui.click(category_btn_location)
category_movies_music_dropdown_location=pyautogui.locateCenterOnScreen("/home/princesethi/Pictures/Gui_Automation/category_movies_music_dropdown.png")
pyautogui.click(category_movies_music_dropdown_location)
Пример #50
0
def full_screen(i):
    try:
        x,y = pyautogui.locateCenterOnScreen('play!.png')
        r,s = (int(x/2),int(y/2))
        r,s = ('values') #need to put in values to be added onto the point of reference (play! icon)
    '''try:
Пример #51
0
 def __init__(self):
     logging.basicConfig(format="%(asctime)s %(message)s", datefmt="%m/%d/%Y %I:%M:%S %p", level=logging.INFO)
     os_version = platform.platform().split("-")[:2]
     os_version = " ".join(os_version)
     # os_version = 'Windows 7'
     # os_version = 'Windows 10'
     osk_filepath = os.path.abspath(r"assets\osk\{}".format(os_version))
     logging.info("Looking for On-Screen Keyboard")
     osk_icon = pyautogui.locateCenterOnScreen(os.path.join(osk_filepath, "OSK_ICON.png"))
     if not osk_icon:
         sys.exit("Unable to detect On-Screen Keyboard")
     logging.info("On-Screen keyboard detected.")
     OSK_LOCATION = (osk_icon[0] - 25, osk_icon[1], 1000, 500)
     logging.info("Starting key matching")
     self.Q = pyautogui.locateCenterOnScreen(
         os.path.join(osk_filepath, "Q.png"), region=OSK_LOCATION, grayscale=True
     )
     self.W = pyautogui.locateCenterOnScreen(
         os.path.join(osk_filepath, "W.png"), region=OSK_LOCATION, grayscale=True
     )
     # Get next key's position by getting difference between keys
     pixel_space = self.W[0] - self.Q[0]
     self.E = (self.W[0] + pixel_space, self.Q[1])
     self.R = (self.E[0] + pixel_space, self.Q[1])
     self.T = (self.R[0] + pixel_space, self.Q[1])
     self.Y = (self.T[0] + pixel_space, self.Q[1])
     self.U = (self.Y[0] + pixel_space, self.Q[1])
     self.I = (self.U[0] + pixel_space, self.Q[1])
     self.O = (self.I[0] + pixel_space, self.Q[1])
     self.P = (self.O[0] + pixel_space, self.Q[1])
     #
     self.A = pyautogui.locateCenterOnScreen(
         os.path.join(osk_filepath, "A.png"), region=OSK_LOCATION, grayscale=True
     )
     self.S = (self.A[0] + pixel_space, self.A[1])
     self.D = (self.S[0] + pixel_space, self.A[1])
     self.F = (self.D[0] + pixel_space, self.A[1])
     self.G = (self.F[0] + pixel_space, self.A[1])
     self.H = (self.G[0] + pixel_space, self.A[1])
     self.J = (self.H[0] + pixel_space, self.A[1])
     self.K = (self.J[0] + pixel_space, self.A[1])
     self.L = (self.K[0] + pixel_space, self.A[1])
     #
     self.Z = pyautogui.locateCenterOnScreen(
         os.path.join(osk_filepath, "Z.png"), region=OSK_LOCATION, grayscale=True
     )
     self.X = (self.Z[0] + pixel_space, self.Z[1])
     self.C = (self.X[0] + pixel_space, self.Z[1])
     self.V = (self.C[0] + pixel_space, self.Z[1])
     self.B = (self.V[0] + pixel_space, self.Z[1])
     self.N = (self.B[0] + pixel_space, self.Z[1])
     self.M = (self.N[0] + pixel_space, self.Z[1])
     #
     self.ESC = pyautogui.locateCenterOnScreen(
         os.path.join(osk_filepath, "ESC.png"), region=OSK_LOCATION, grayscale=True
     )
     # Starting from Tilda for Windows 7 compatability
     self.TILDA = pyautogui.locateCenterOnScreen(
         os.path.join(osk_filepath, "TILDA.png"), region=OSK_LOCATION, grayscale=True
     )
     self.ONE = (self.TILDA[0] + pixel_space, self.ESC[1])
     self.TWO = (self.ONE[0] + pixel_space, self.ESC[1])
     self.THREE = (self.TWO[0] + pixel_space, self.ESC[1])
     self.FOUR = (self.THREE[0] + pixel_space, self.ESC[1])
     self.FIVE = (self.FOUR[0] + pixel_space, self.ESC[1])
     self.SIX = (self.FIVE[0] + pixel_space, self.ESC[1])
     self.SEVEN = (self.SIX[0] + pixel_space, self.ESC[1])
     self.EIGHT = (self.SEVEN[0] + pixel_space, self.ESC[1])
     self.NINE = (self.EIGHT[0] + pixel_space, self.ESC[1])
     self.ZERO = (self.NINE[0] + pixel_space, self.ESC[1])
     #
     self.ALT = pyautogui.locateCenterOnScreen(
         os.path.join(osk_filepath, "ALT.png"), region=OSK_LOCATION, grayscale=True
     )
     self.CTRL = pyautogui.locateCenterOnScreen(
         os.path.join(osk_filepath, "CTRL.png"), region=OSK_LOCATION, grayscale=True
     )
     self.SHIFT = pyautogui.locateCenterOnScreen(
         os.path.join(osk_filepath, "SHIFT.png"), region=OSK_LOCATION, grayscale=True
     )
     self.CAPS = pyautogui.locateCenterOnScreen(
         os.path.join(osk_filepath, "CAPS.png"), region=OSK_LOCATION, grayscale=True
     )
     self.TAB = pyautogui.locateCenterOnScreen(
         os.path.join(osk_filepath, "TAB.png"), region=OSK_LOCATION, grayscale=True
     )
     self.ALT = pyautogui.locateCenterOnScreen(
         os.path.join(osk_filepath, "ALT.png"), region=OSK_LOCATION, grayscale=True
     )
     #
     self.LEFT = pyautogui.locateCenterOnScreen(
         os.path.join(osk_filepath, "LEFT.png"), region=OSK_LOCATION, grayscale=True
     )
     self.RIGHT = pyautogui.locateCenterOnScreen(
         os.path.join(osk_filepath, "RIGHT.png"), region=OSK_LOCATION, grayscale=True
     )
     self.UP = pyautogui.locateCenterOnScreen(
         os.path.join(osk_filepath, "UP.png"), region=OSK_LOCATION, grayscale=True
     )
     self.DOWN = pyautogui.locateCenterOnScreen(
         os.path.join(osk_filepath, "DOWN.png"), region=OSK_LOCATION, grayscale=True
     )
     logging.info("Done matching")
Пример #52
0
def check_buff():
    buff_center = pyautogui.locateCenterOnScreen(BUFF_IMG,
                                                 confidence=0.8,
                                                 region=STATUS_BAR_REGION)
    return buff_center
Пример #53
0
def is_arrow_empty():
    arrow_slot_center = pyautogui.locateCenterOnScreen(ARROW_IMG,
                                                       confidence=0.8,
                                                       region=ARROW_REGION)
    return arrow_slot_center
Пример #54
0
def find_btn(btn, region=None):
	return pyautogui.locateCenterOnScreen(get_image(btn + ".png"), grayscale=True, region=region)
Пример #55
0
def is_ring_empty():
    ring_slot_center = pyautogui.locateCenterOnScreen(RING_IMG,
                                                      confidence=0.8,
                                                      region=RING_REGION)
    return ring_slot_center
Пример #56
0
    wait_element_view( login_path, wait_time=10, confidence=0.6)
    time.sleep(3)
    pyautogui.press('tab')
    pyautogui.press('tab')
    pyautogui.press('tab')
    pyautogui.press('tab')
    pyautogui.press('tab')
    pyautogui.press('tab')
    
    #login
    print('login')
    pyautogui.typewrite('*****@*****.**')
    pyautogui.press('tab')
    pyautogui.typewrite('cdt2018!')
    time.sleep(3)
    x,y = pyautogui.locateCenterOnScreen(login_path, confidence=0.6)
    pyautogui.click(x,y)
    
    #order
    print('Order')
    order_path = "ikeaimg\\order.png"
    #time.sleep(5)
    wait_element_view( order_path, wait_time=5, confidence=0.6)
    x,y = pyautogui.locateCenterOnScreen(order_path, confidence=0.6)
    pyautogui.click(x,y)

    #serviceorder
    print('Service Order')
    serviceorder_path = "ikeaimg\\serviceorder.png"
    time.sleep(1)
    x,y = pyautogui.locateCenterOnScreen(serviceorder_path, confidence=0.6)
Пример #57
0
    faildCapchaName = 'faildCapcha/' + str(info) + '.png'
    pyautogui.screenshot(faildCapchaName, region=windowLocation)
    logging.warning('Капча не введена {}'.format(currentDateTime()))


while True:
    dateInfo = []
    info = {}
    if pyautogui.locateOnScreen(data['title'],
                                region=windowLocation,
                                grayscale=True):
        for digit in digitsOnScreen:
            if pyautogui.locateOnScreen(data[digit],
                                        region=digitLocation,
                                        grayscale=True):
                info[digit] = pyautogui.locateCenterOnScreen(
                    data[digit], region=digitLocation, grayscale=True)
                logging.info('Знайдено цифру {0}'.format(info[digit]))

        sortedInfo = sorted(info)

        if len(sortedInfo) >= 0 and len(sortedInfo) <= 3 or len(
                sortedInfo) > 4:
            pyautogui.alert(
                'Неправильна кількість цифр \n {}'.format(sortedInfo))
            logging.warning('Неправильна кількість цифр')
            logging.warning('{}'.format(sortedInfo))
            faildCapcha(sortedInfo)
            continue
        elif len(sortedInfo) != []:
            pyautogui.moveTo(info[sortedInfo[0]][0], info[sortedInfo[0]][1])
Пример #58
0
def clickOnMap(who):
    pydirectinput.keyDown("tab")
    button = pyautogui.locateCenterOnScreen(who, confidence=.8)
    click(button.x, button.y)
    pydirectinput.keyUp("tab")
    autoit.mouse_move(1, 1)
Пример #59
0
def findButtons():
	for i in imageArray:
		foundButton = pyautogui.locateCenterOnScreen(i)#, region=(1350,1500,950,350))
		if not foundButton is None: return (foundButton[0], foundButton[1])
	return(x,y)
Пример #60
-1
def wait_element_view(img, wait_time=1, confidence=0.999):
    for it in range(1, wait_time):
        if pyautogui.locateCenterOnScreen(img, confidence=confidence) is None: 
            time.sleep(1)
            continue
        else:
            break