Ejemplo n.º 1
0
def RedButtonOnScreen():
    if pyautogui.pixelMatchesColor(359-372+193,1007-999+317,(255,100,100),tolerance=30) == True:
        pyautogui.click(359-372+193,1007-999+317)
        time.sleep(1)#Super pack 如果红色
        pyautogui.click(359-372+88,1007-999+418)
        time.sleep(1)
        pyautogui.click(home)
        time.sleep(1)
    if pyautogui.pixelMatchesColor(40,328,(143,67,81),tolerance=5) ==True:
        pyautogui.click(40,328)
        while pyautogui.pixelMatchesColor(356,764,(226,157,2),tolerance=5) ==False:
            continue
        time.sleep(0.3)#一朝一夕 如果红色
        pyautogui.click(356,764)
        while pyautogui.pixelMatchesColor(287,333,(140,121,137),tolerance=5) ==False:
            continue
        time.sleep(0.3)
        pyautogui.moveTo(205,409)#需要拖拽
        time.sleep(0.5)
        pyautogui.drag(100,0,1,button="left")
        time.sleep(1)
        quickreturn()
        return
    else:
        return
def begin_pan(distance):
    ag.rightClick()
    # arbitrary confidence threshold
    x, y = ag.locateCenterOnScreen('pan.png', confidence=.5)
    ag.leftClick(x, y)
    ag.drag(distance, 0, duration=.1)
    ag.drag(-distance, 0, duration=.1)
def dragMouse(xDelta, yDelta):
    screenWidth, screenHeight = pyautogui.size()
    currentMouseX, currentMouseY = pyautogui.position(
    )  # Get the XY position of the mouse.
    #print(screenWidth, screenHeight, currentMouseX, currentMouseY, xDelta, yDelta)

    moveToX = currentMouseX + xDelta
    moveToY = currentMouseY + yDelta

    if moveToX >= screenWidth:
        moveToX = screenWidth - 1

    if moveToY >= screenHeight:
        moveToY = screenHeight - 1

    if moveToX <= 0:
        moveToX = 1

    if moveToY <= 0:
        moveToY = 1

    #print("moveToX:")
    #print(moveToX)
    #print("\n")
    #print("moveToY:")
    #print(moveToY)
    #print("\n")

    print("pyautogui.drag(xDelta, yDelta, duration=0.5)")
    pyautogui.drag(xDelta, yDelta, duration=0.5)
Ejemplo n.º 4
0
def tabla(Y, Z, W, V):
    rows = Y
    column = Z
    width = W
    height = V
    k = width / column

    # tells the current positon pf cursor which is stored in u,v
    u, v = pyautogui.position()
    a = 0
    # this while loop will create the rows required

    while (a < rows):

        pyautogui.drag(width, 0)
        pyautogui.drag(0, height)
        pyautogui.drag(-width, 0)
        pyautogui.drag(0, -height)
        x, y = pyautogui.position()
        pyautogui.moveTo(x, y + height)

        a = a + 1

    m = 0
    f = 0
    # this while loop will create the columns required
    while (m < column):
        pyautogui.moveTo(u + f, v)

        pyautogui.drag(0, (rows * height))
        f = f + k
        m = m + 1
Ejemplo n.º 5
0
def main(move_type):
    BACKGROUND_APP = 'C:\WINDOWS\system32\mspaint.exe'
    APP_OPEN_WAIT_TIME = 2
    pyautogui.PAUSE = 5
    pyautogui.FAILSAFE = True
    FAILSAFE_TOPLEFT_AREA_FACTOR = 0.1
    CENTER_FACTOR = 0.333
    WANDER_RANGE_FACTOR = 0.1

    # open up process
    app_process = subprocess.Popen([BACKGROUND_APP])
    sleep(APP_OPEN_WAIT_TIME)
    pyautogui.hotkey('win', 'up')

    initial_screenWidth, initial_screenHeight = pyautogui.size()
    pyautogui.FAILSAFE_POINTS = get_failsafe_top_left_area_points(
        initial_screenWidth, initial_screenHeight,
        FAILSAFE_TOPLEFT_AREA_FACTOR)
    print("Screen Width: %s, Screen Height: %s" %
          (initial_screenWidth, initial_screenHeight))
    currentX, currentY = pyautogui.position()
    print("Current Position: (X: %s, Y: %s)" % pyautogui.position())
    try:
        while True:
            if pyautogui.size() != (initial_screenWidth, initial_screenHeight):
                initial_screenWidth, initial_screenHeight = pyautogui.size()
                print(
                    "Screen Size Changed, Current Width: %s, Current Height: %s"
                    % (initial_screenWidth, initial_screenHeight))
                pyautogui.FAILSAFE_POINTS = get_failsafe_top_left_area_points(
                    initial_screenWidth, initial_screenHeight,
                    FAILSAFE_TOPLEFT_AREA_FACTOR)
            pyautogui.moveTo(floor(initial_screenWidth * CENTER_FACTOR),
                             floor(initial_screenHeight * CENTER_FACTOR))
            print("Moved To: (X: %s, Y: %s)" % pyautogui.position())
            next_x = random.randint(
                -floor(initial_screenWidth * WANDER_RANGE_FACTOR),
                floor(initial_screenWidth * WANDER_RANGE_FACTOR))
            next_y = random.randint(
                -floor(initial_screenHeight * WANDER_RANGE_FACTOR),
                floor(initial_screenHeight * WANDER_RANGE_FACTOR))
            if move_type == 'DRAG':
                pyautogui.drag(next_x,
                               next_y,
                               duration=(random.randint(1, 2000) / 2000))
            elif move_type == 'MOVE_REL':
                pyautogui.moveRel(next_x,
                                  next_y,
                                  duration=(random.randint(1, 2000) / 2000))
            else:
                raise RuntimeError('The move type is not supported.')
            print("Dragged To: (X: %s, Y: %s)" % (next_x, next_y))

    except pyautogui.FailSafeException:
        print("Fail Safe exit")
    finally:
        pyautogui.alert(text='You are about to exit',
                        title='Confirm Exit',
                        button='OK')
        app_process.kill()
Ejemplo n.º 6
0
 def moveGraphic(imagepath,
                 dx=500,
                 dy=500,
                 delay=10,
                 confidence=1,
                 waitbetweentries=1,
                 debug=False):
     elemToClick = None
     numTries = 1
     if debug: print("    (0): locating {} ...".format(imagepath))
     while (elemToClick is None) and (numTries < delay):
         try:
             elemToClick = pyautogui.locateOnScreen(imagepath, confidence)
         except Exception as exp:
             if isinstance(exp, pyautogui.pyscreeze.ImageNotFoundException):
                 if debug:
                     print("    ({}): locating {} ...".format(
                         numTries, imagepath))
             else:
                 if debug: print(exp)
                 break
         finally:
             numTries += 1
             time.sleep(waitbetweentries)
     if elemToClick is None:
         if debug:
             print("    (x): could not locate image {}".format(imagepath))
         return False
     time.sleep(1)
     clickCenter = pyautogui.center(elemToClick)
     pyautogui.moveTo(clickCenter.x, clickCenter.y)
     pyautogui.drag(dx, dy, 1, button='left')
     if debug: print("    (✓): moved {}".format(elemToClick))
     time.sleep(1)
     return True
Ejemplo n.º 7
0
def camera(compass, screen_resolution, min_drag_time, max_drag_time):
    """
    :param compass:
    :type compass: list of int
    :param screen_resolution:
    :type screen_resolution: tuple of int
    :param min_drag_time:
    :type min_drag_time: int
    :param max_drag_time:
    :type max_drag_time: int
    :return:
    """
    amount_of_movements = random.randint(1, MAX_CAMERA_ROTATIONS)
    for i in range(amount_of_movements):
        if bool(random.randint(0, 1)):
            x_drag_destination = random.randint(SCREEN_RESOLUTION_MARGIN, screen_resolution[0] // 2 - 15)
        else:
            x_drag_destination = random.randint(screen_resolution[0] // 2 - 15,
                                                screen_resolution[0] - SCREEN_RESOLUTION_MARGIN)

        y_drag_destination = random.randint(SCREEN_RESOLUTION_MARGIN, screen_resolution[1] // 2 - 5)

        drag_time = random.randint(min_drag_time, max_drag_time)

        auto.moveTo(screen_resolution[0] // 2 - 15, screen_resolution[1] // 2 - 5, 0.5)
        auto.dragTo(x_drag_destination, y_drag_destination, drag_time, button="middle")

    auto.moveTo(compass[0], compass[1], 1)
    auto.click()
    auto.moveTo(screen_resolution[0] // 2 - 15, screen_resolution[1] // 2 - 5, 0.5)
    auto.drag(0, 100, 1, button="middle")
Ejemplo n.º 8
0
def move_mouse():
    global last_x
    global last_y
    global window_height
    global window_width
    x = int(request.args.get('x'))
    y = int(request.args.get('y'))
    is_drawing = request.args.get('isDrawing')
    if (last_x == 0 or last_y == 0):
        last_x = x
        last_y = y

    ## y is x because phone is supposed to be horizontal
    current_x = pyautogui.position()[0] + (y - last_y)
    current_y = pyautogui.position()[1] + (last_x - x)
    if (current_x < window_width and current_y < window_height
            and current_x > 0 and current_y > 0):
        if (is_drawing == "false"):
            pyautogui.moveTo(current_x, current_y)
        else:
            pyautogui.drag((y - last_y), (last_x - x))

    last_x = x
    last_y = y

    return ("Mouse moved")
Ejemplo n.º 9
0
def game_start_setup():
    "Sets all to smartcast"
    pyautogui.PAUSE = 0.05
    click_image(screenshots_folder + "ingame" + sep + "settings.png", con=0.9)
    print("click settings")

    click_image(screenshots_folder + "ingame" + sep + "hotkeys.png", con=0.9)
    print("click hotkeys")

    click_image(screenshots_folder + "ingame" + sep + "quick_cast_all.png",
                con=0.9)
    print("click quick_cast_all")
    print("set all to smartcast")

    "sets interface to minimal hud"
    click_image(screenshots_folder + "ingame" + sep + "interface.png", con=0.9)
    pyautogui.moveTo((pyautogui.position()[0] + screen_dim[0] / 10,
                      pyautogui.position()[1]))
    for i in range(20):
        pyautogui.scroll(100)
        time.sleep(0.1)
    pyautogui.mouseDown()
    pyautogui.mouseUp()
    pyautogui.drag(-1 * pyautogui.position()[0] * 1 / 12,
                   0,
                   0.5,
                   button="left")
Ejemplo n.º 10
0
def main():
    available_courses = data_handler.get_available_courses()
    print("You can choose between the following courses: ")
    for course_name in available_courses:
        print(course_name + ", ", end="")
    print("\n")
    chosen_course_name = input("Please type the name of the course you want automated: ")
    chosen_course = Course(chosen_course_name, data_handler.get_course_data(chosen_course_name))
    screen_resolution = auto.size()

    print("You have chosen " + chosen_course.name)
    desired_amount_of_loops = int(input("And how many times would you like to do this course?"))
    print("Please move to the tile in front of the last obstacle and scroll out completely."
          "Then input anything in this program which will start the course in 10 seconds...")
    input()
    time.sleep(START_DELAY)

    # Set camera position
    compass = data_handler.get_compass_pos()
    auto.moveTo(compass[0], compass[1], 1)
    auto.click()
    auto.moveTo(screen_resolution[0] // 2 - 15, screen_resolution[1] // 2 - 5, 0.5)
    auto.drag(0, 100, 1, button="middle")

    completed_loops = 0
    start = time.time()
    while (completed_loops < desired_amount_of_loops) and (time.time() - start < MAX_DURATION):
        do_course(chosen_course, compass, screen_resolution, ANTI_BOT_DETECTION_MIN_DRAG_TIME,
                  ANTI_BOT_DETECTION_MAX_DRAG_TIME)
        completed_loops += 1
Ejemplo n.º 11
0
def getEmailDate():
    utils.bringFirefoxToFront()
    clicked = utils.clickImg("verse\showMoreLabel.PNG", 30, 0)
    pyautogui.moveTo(clicked.x + 38, clicked.y - 30)
    pyautogui.drag(-150, 0, duration=0.25, button="left")
    pyautogui.hotkey("ctrl", "c")
    return convertDate(pyperclip.paste())
Ejemplo n.º 12
0
def move_turret():
    pyautogui.moveTo(750, 450)
    pyautogui.keyDown('ctrl')
    pyautogui.drag(random.randint(-1000, 1000),
                   random.randint(-300, 300),
                   2,
                   button='left')
    pyautogui.keyUp('ctrl')
Ejemplo n.º 13
0
def scrollRetire():

    path = r'D:\azurelaneauto\images\dockimages\azur'

    try:
        battleM.pglocateC('scroll', path)
        pg.drag(0, 500, 1, button='left')
    except TypeError:
        return
Ejemplo n.º 14
0
def screen(url, id):
    infoUrl = f"https://api.csgofloat.com/?url={url}"
    data = json.loads(requests.get(infoUrl).text)

    weaponType = data["iteminfo"]["weapon_type"]

    clickx = super_Var_lol["size"]["x"] * 0.80
    clicky = super_Var_lol["size"]["y"] * 0.80
    os.system(f'start {url}')
    time.sleep(2.5)

    save_path = f"{id}_playside.png"
    ImageGrab.grab().save(save_path)
    time.sleep(1)

    pyautogui.moveTo(clickx, clicky)
    pyautogui.drag(-380, 0, 2, button='left')
    save_path = f"{id}_backside.png"
    time.sleep(1)
    ImageGrab.grab().save(save_path)

    if weaponType == "Karambit" or weaponType == "Talon Knife":
        save_path = f"{id}_backside.png"
        crop_knife("play", save_path, id, ktype="tiger")
        save_path = f"{id}_playside.png"
        crop_knife("back", save_path, id, ktype="tiger")
        time.sleep(1)
        final_image(id, data)

    elif weaponType == "Bayonet" or weaponType == "Shadow Daggers" or "M9" in weaponType or "Knife" in weaponType:
        save_path = f"{id}_playside.png"
        crop_knife("play", save_path, id, ktype="all")
        save_path = f"{id}_backside.png"
        crop_knife("back", save_path, id, ktype="all")
        time.sleep(1)
        final_image(id, data)

    elif weaponType == "Sticker" or "Pin" in weaponType or "Graffiti" in weaponType:
        print("pin")
        save_path = f"{id}_playside.png"
        crop_sticker_final(save_path, id, data)

    elif "Gloves" in weaponType or "Wraps" in weaponType:
        save_path = f"{id}_playside.png"
        crop_glove("play", save_path, id)
        save_path = f"{id}_backside.png"
        crop_glove("back", save_path, id)
        time.sleep(1)
        final_image(id, data)

    else:
        save_path = f"{id}_playside.png"
        crop("play", save_path, id)
        save_path = f"{id}_backside.png"
        crop("back", save_path, id)
        time.sleep(1)
        final_image(id, data)
def load_font_into_photopea(driver):
    try:
        print("-- LOAD FONT INTO PHOTOPEA --")
        gui.moveTo(130, 176)
        gui.drag(978, 506, 2, button='left')
        gui.moveTo(1417, 456)
        gui.click()
        print("-- FONT LOADED --")
    except:
        pass
Ejemplo n.º 16
0
def dragBottomLeft():
    # Move mouse to vertical scroll bar (673, 316)
    #pawg.moveTo(673,316)
    # it clicks back up, then messes up the drag, leave out for now, reposition lower if doing
    # Drag to bottom of form
    #pawg.drag(0,200,.5)
    # Move mouse to hz scroll bar (407, 718)
    pawg.moveTo(407, 718)
    # Drag screen left to see "OK" submit btn
    pawg.drag(-100, 0, .5)
Ejemplo n.º 17
0
def divert_power():
    sliders = [(620, 780), (715, 780), (813, 780), (912, 780), (1007, 780),
               (1101, 780), (1201, 780), (1297, 780)]
    img = ImageGrab.grab(bbox=(0, 0, 1920, 1080))
    pix = img.load()
    for i in sliders:
        if pix[i][0] > 50:
            pyautogui.moveTo(i)
            pyautogui.drag(0, -100, 0.5, button='left')
            break
Ejemplo n.º 18
0
def insertEmail(username, emailCoords=(567, 557), okCoords=(442, 54)):
    # Move mouse to vertical scroll bar (673, 316)
    pawg.moveTo(673, 316)
    # Drag to bottom of form
    pawg.drag(0, 200)
    # Click "Add Email"
    pawg.click(emailCoords)
    # Write email address
    pawg.write("".join([username, '@ercsd.org']))
    # Click "OK" to enter
    pawg.click(okCoords)
Ejemplo n.º 19
0
 def _commandHarvestMoveSlider(self):
     find, point = self.engine.getAreaCoordByName("btnHarverWoodSlider")
     if find:
         isObj, autoObject = self.engine.getAutoObjectByName(
             "btnHarverWoodSlider")
         if isObj:
             area2 = areaStrToList(autoObject.area2)
             moveFX = point[0] + area2[0]
             moveFY = point[1] + area2[1]
             pyautogui.moveTo(moveFX, moveFY)
             pyautogui.drag(area2[2] - moveFX, 0, 1, button='left')
             time.sleep(0.2)
Ejemplo n.º 20
0
def insertTemplate():
    # templ Checkbox (264, 560)
    pawg.click(264, 560)
    # position of hz scroll bar (407, 718)
    pawg.moveTo(407, 718)
    # drag screen to see search button
    pawg.drag(100, 0, .5)
    # click search button (590, 585)
    pawg.click(590, 585)
    # Wait for new window to load, just to be safer
    time.sleep(2.5)
    getTemplate()
    time.sleep(2)
Ejemplo n.º 21
0
def throw(angle_deg):
    O = [470, 887]
    r = 1200 - 960
    dx = r*math.sin(math.degrees(angle_deg))
    dy = r*math.cos(math.degrees(angle_deg))

    P = [O[0] + dx, O[1] + dy]
    
    pg.moveTo(x = P[0], y = P[1])
    # time.sleep(0.2)
    pg.drag(-dx, -dy, 0.11)
    # time.sleep(0.2)
    pg.mouseUp()
Ejemplo n.º 22
0
 def makeMove(self, x, y, direction):
     (winX, winY, winW, winH) = self.getWindowDimensions()
     img = None
     areaX = 0
     areaY = 0
     w = 0
     h = 0
     while areaX == 0 or areaY == 0:
         # Sometimes, a mis-fire occurs when trying to grab the field
         # coordinates.  As a result, we should take a shot as many
         # times as needed
         img = self.getWindowShot()
         if self.moves == 0:
             # Only needed once.  Additional moves won't execute
             (areaX, areaY, w, h) = (self.x, self.y, self.w, self.h)
         else:
             (areaX, areaY, w, h) = self._getPlayingFieldCoord(img)
     self.moves += 1
     winX += areaX
     winY += areaY
     moveX = winX + 12 + (52 * (x)) + 26
     moveY = winY + 12 + (52 * (y)) + 26
     pyautogui.moveTo(moveX, moveY)
     if direction == "U":
         pyautogui.drag(0, -50)
     elif direction == "D":
         pyautogui.drag(0, 50)
     elif direction == "R":
         pyautogui.drag(50, 0)
     else:
         pyautogui.drag(-50, 0)
Ejemplo n.º 23
0
 def square():
     x = 40
     # while(x>=0):
     pyautogui.drag(x, 0)
     pyautogui.drag(0, x)
     pyautogui.drag(-x, 0)
     pyautogui.drag(0, -x)
Ejemplo n.º 24
0
def parse_command(s):
    global x, y, state, len_in_state, inactivity
    
    print("State: " + state)

    # If no hand is detected, increment inactivity
    if not s[0].isdigit():
        inactivity += 1
        if inactivity >= stall_time:
            state = "start"
        return

    ### Hand detected ###
    
    # Reset inactivity counter
    inactivity = 0
    
    # Get new state
    s = s.split()
    newx = int(s[0])
    newy = int(s[1])
    newstate = s[2]

    # Only move if remaining in same 'palm' or 'fist' state
    if state == newstate:
        x_diff = -1 * (newx - x) * sensitivity
        y_diff = (newy - y) * sensitivity
        if state == "palm":
            pyautogui.drag(x_diff, y_diff)
            print("Dragging")
        elif state == "fist":
            pyautogui.move(x_diff, y_diff)
            print("Moving")
    
    # Click if exiting palm state after being there briefly
    min_stay_time = 0
    max_stay_time = 2
    if state == "palm" and newstate == "fist":
        if len_in_state >= min_stay_time and len_in_state <= max_stay_time:
            pyautogui.click(0, 0, 1, 1, 'left')
            print("Clicked")

    # Set new state
    x = newx
    y = newy
    if state != newstate:
        len_in_state = 0
    else:
        len_in_state += 1
    state = newstate
Ejemplo n.º 25
0
 def cambiar_puerta_a_mundo(self, mundo):
     switch_gate_button_coord = imagesearch("images/switch_gate_button.jpg")
     while switch_gate_button_coord[0] == -1:
         if self.detener.is_set():
             return
         switch_gate_button_coord = imagesearch(
             'images/switch_gate_button.jpg.jpg')
     click_image("images/switch_gate_button.jpg", switch_gate_button_coord,
                 "left", 0.2)
     if mundo == "dm":
         dm_icon = imagesearch('images/dsod_world_icon.jpg')
         while dm_icon[0] == -1:
             if self.detener.is_set():
                 return
             dm_icon = imagesearch('images/dm_world_icon.jpg')
             if dm_icon[0] != -1:
                 break
             dsod_icon = imagesearch('images/dsod_world_icon.jpg')
             moveTo(dsod_icon)
             drag(0, 50, 0.5, button="left"
                  )  # arrastra para mostrar por completo el icono del mundo
         click_image("images/dsod_world_icon.jpg", dm_icon, "left", 0.2)
     elif mundo == "dsod":
         dsod_icon = imagesearch('images/dsod_world_icon.jpg')
         while dsod_icon[0] == -1:
             if self.detener.is_set():
                 return
             dsod_icon = imagesearch('images/dsod_world_icon.jpg')
         click_image("images/dsod_world_icon.jpg", dsod_icon, "left", 0.2)
     elif mundo == "gx":
         gx_icon = imagesearch('images/gx_world_icon.jpg')
         while gx_icon[0] == -1:
             if self.detener.is_set():
                 return
             gx_icon = imagesearch('images/gx_world_icon.jpg')
         click_image("images/gx_world_icon.jpg", gx_icon, "left", 0.2)
     elif mundo == "5ds":
         _5ds_icon = imagesearch('images/5ds_world_icon.jpg')
         while _5ds_icon[0] == -1:
             if self.detener.is_set():
                 return
             _5ds_icon = imagesearch('images/5ds_world_icon.jpg')
             if _5ds_icon[0] != -1:
                 break
             gx_icon = imagesearch('images/gx_world_icon.jpg')
             moveTo(gx_icon)
             drag(0, -50, 0.5, button="left"
                  )  # arrastra para mostrar por completo el icono del mundo
         click_image("images/5ds_world_icon.jpg", _5ds_icon, "left", 0.2)
Ejemplo n.º 26
0
def update():
    global ratio, name_images
    py = [[74, 998], [74, 848], [447, 377], [92, 25]]
    if ratio != [1, 1]:
        ###### closeButton ??? - #exeed limit account & bonus collected already
        center_region[0:] = update_ratio(center_region[:2]) + update_ratio(
            center_region[2:])
        watchYou[0:] = update_ratio(watchYou)
        continueYou[0:] = update_ratio(continueYou)
        skipVideo[0:] = update_ratio(skipVideo)
        lotery[0:] = update_ratio(lotery)
        closeVideo[0:] = update_ratio(closeVideo)
        restartVideo[0:] = update_ratio(restartVideo)
        cancelVideo[0:] = update_ratio(cancelVideo)
        xButton[0:] = update_ratio(xButton)
        closeButton[0:] = update_ratio(closeButton)
        errors[0:] = update_ratio(errors)

        for i in range(len(py)):
            py[i][0] = int(py[i][0] * ratio[0])
            py[i][1] = int(py[i][1] * ratio[1])

    if _if_widget[0] == False:  # present
        pyautogui.click(py[0])  # plus add widget button
        time.sleep(1)
        pyautogui.click(py[1])  # click association
        time.sleep(3)
        pyautogui.moveTo(py[2])  # corner right-down widget
        pyautogui.drag(0, 10, 1)
    elif _if_widget[1] == False:  # open
        pyautogui.click(py[0])
        time.sleep(3)

    if _if_widget[2] == False or ratio != [1, 1]:  # position or ratio
        x, y = image_on_screen(name_images[1], 0.8, True)
        refresh[0] = int((x + 261) * ratio[0])  # update refresh_x
        refresh[1] = int((y + 8) * ratio[1])  # update refresh_y
        x1, y1 = [int((x + 56) * ratio[0]), int((y + 80) * ratio[1])]
        x2, y2 = [int((x + 12) * ratio[0]), int((y + 66) * ratio[1])]
        for i in range(3):
            buttons[i] = [x1, y1]
            x1 = int((x1 + 100) * ratio[0])
            regions[i] = [x2, y2, py[3][0], py[3][1]]
            x2 = int((x2 + py[3][0] + 6) * ratio[0])

        print("refresh", refresh)
        print("regions:", regions)
        print("buttons", buttons)
Ejemplo n.º 27
0
def copy():
    time.sleep(0.2)
    pyautogui.moveTo(950, 750)
    time.sleep(0.1)
    pyautogui.drag(-295, -250, duration=0.5, button="left")
    pyautogui.keyDown("ctrl")
    pyautogui.press("c")
    pyautogui.keyUp("ctrl")

    time.sleep(0.8)
    pyautogui.click(1001, 336)
    time.sleep(0.1)
    pyautogui.press("tab")
    pyautogui.press("enter")
    time.sleep(0.1)
    pyautogui.moveTo(688, 512)
Ejemplo n.º 28
0
    def drag_slider(self, location_str):
        """
        拖动滑块
        :param location:(x,y)滑块的坐标
        :return:
        """
        #翻译坐标,将字符串转成字典
        location = self.translate_location(location_str)
        logger.info(location)
        x = location[0]['x']
        y = location[0]['y']
        logger.info('x: %d  y: %d', x, y)
        pyautogui.moveTo(926, 523, 1)
        pyautogui.drag(x - 12, 0, 2)

        return True
Ejemplo n.º 29
0
def split_furnance(type, _):
    if type == 'Inventory':
        i = 1
        pyautogui.click(1000, 623, duration=0.17)
        print_percent_done(i, 7, title="Splitting Inventory")
        i += 1
        pyautogui.click(827, 514, duration=0.17)
        print_percent_done(i, 7, title="Splitting Inventory")
        i += 1
        pyautogui.moveTo(1198, 504, duration=0.17)
        print_percent_done(i, 7, title="Splitting Inventory")
        i += 1
        pyautogui.drag(0, 100, duration=0.17)
        print_percent_done(i, 7, title="Splitting Inventory")
        i += 1
        pyautogui.moveTo(1200, 500, duration=0.17)
        print_percent_done(i, 7, title="Splitting Inventory")
        i += 1
        pyautogui.drag(-100, 100, duration=0.17)
        print_percent_done(i, 7, title="Splitting Inventory")
    if type == 'Furnance_Small':
        i = 1
        pyautogui.moveTo(1190, 620, duration=0.17)
        print_percent_done(i, 9, title="Splitting Small Furnance")
        i += 1
        pyautogui.drag(115, 105, duration=0.17)
        print_percent_done(i, 9, title="Splitting Small Furnance")
        i += 1
        pyautogui.click(1300, 720, duration=0.17)
        print_percent_done(i, 9, title="Splitting Small Furnance")
        i += 1
        pyautogui.click(827, 514, duration=0.17)
        print_percent_done(i, 9, title="Splitting Small Furnance")
        i += 1
        pyautogui.moveTo(1200, 500, duration=0.17)
        print_percent_done(i, 9, title="Splitting Small Furnance")
        i += 1
        pyautogui.drag(300, 220, duration=0.17)
        print_percent_done(i, 9, title="Splitting Small Furnance")
        i += 1
        pyautogui.moveTo(1200, 500, duration=0.17)
        print_percent_done(i, 9, title="Splitting Small Furnance")
        i += 1
        pyautogui.drag(200, 220, duration=0.17)
        print_percent_done(i, 9, title="Splitting Small Furnance")
    if type == 'exit':
        globals()['exit'] = False
Ejemplo n.º 30
0
 def drag(self, x, y, delta=False, speed_factor=1):
     if delta:
         pyautogui.drag(x,
                        y,
                        self._rnd(min=500 / speed_factor,
                                  mean=800 / speed_factor,
                                  sigma=400 / speed_factor) / 1000,
                        pyautogui.easeOutQuad,
                        button='left')
     else:
         pyautogui.dragTo(x,
                          y,
                          self._rnd(min=500 / speed_factor,
                                    mean=800 / speed_factor,
                                    sigma=400 / speed_factor) / 1000,
                          pyautogui.easeOutQuad,
                          button='left')