Пример #1
2
 def call(self):
     v = self.LOCATIONS['call']
     gui.moveTo(v[0][0] + self.x + 50, v[0][1] + self.y + 10, duration = .3) 
     time.sleep(.3)
     gui.mouseDown()
     time.sleep(.2)
     gui.mouseUp()
Пример #2
1
def buscar_test():
    msg = ''
    pyautogui.PAUSE = 0.5
    pyautogui.FAILSAFE = False
    pyperclip.copy('')
    
    findTest = pyautogui.locateOnScreen('buscar-tests.png')
    if findTest is None:
        msg = 'La opcion LOGIN TO CONSOLE no esta seleccionada'
        return (False, msg)
        #exit(0)
    else:
        testPos = list(findTest)
        #print testPos
         
    centroTest = pyautogui.center(testPos)     
    print centroTest
    pyautogui.moveTo(centroTest)
    pyautogui.click(None,None,1)
    pyautogui.moveRel(10, 30)
    pyautogui.click(None,None,1)
    #pyautogui.screenshot('menu-screen2.png')
    #pyautogui.click(None,None,1)
    #pyautogui.screenshot('menu-screen1.png')
    findLogin = pyautogui.locateOnScreen('imagenx.png')
    print findLogin
    
    return (True, msg)
def buscar_campo_id():
    msg = ''
    pyautogui.PAUSE = 0.5
    pyautogui.FAILSAFE = False
    pyperclip.copy('')
    
    dondeEstaElCampoID = pyautogui.locateOnScreen('operator-id-field.png')
    if dondeEstaElCampoID is None:
        msg = 'El campo de OPERATOR-ID no fue encontrado'
        return (False, msg)
        
    else:
        campoIDPos = list(dondeEstaElCampoID)
        #print campoIDPos
         
    centrocampoID = pyautogui.center(campoIDPos)     
    #print centrocampoID
    pyautogui.moveTo(centrocampoID)
    pyautogui.click(None,None,2)
    pyautogui.typewrite('operador1')
    pyautogui.press('enter')
    pyautogui.press('enter')
    pyautogui.press('enter')
    
    
    
    return (True, msg)
Пример #4
0
def moveNClickIfFindIt (**options):

    displayMagnification = 2 if sysvar_ratina == True else 1
    pyautogui.moveTo((options.get('top')/displayMagnification) + (options.get('width')/(displayMagnification*2)),
                     (options.get('left')/displayMagnification) + (options.get('height')/(displayMagnification*2)), 2)
    pyautogui.click()
    pyautogui.moveTo(10, 10)
Пример #5
0
def episode_get_mcn_and_ref():
    # get mcn
    mcn = pyperclip.copy('na')
    pya.moveTo(424, 474, duration=0.1)
    pya.dragTo(346, 474, duration=0.1)
    pya.hotkey('ctrl', 'c')
    mcn = pyperclip.paste()
    pya.moveTo(424, 474, duration=0.1)
    pya.click(button='right')
    pya.moveTo(481, 268, duration=0.1)
    pya.click()
    
    mcn = pyperclip.paste()
    mcn = mcn.replace(' ', '')
    # get ref
    ref = pyperclip.copy('na')
    pya.moveTo(500, 475, duration=0.1)
    pya.dragRel(-8, 0, duration=0.1)
    pya.hotkey('ctrl', 'c')
    ref = pyperclip.paste()
    pya.moveRel(8, 0, duration=0.1)
    pya.click(button='right')
    pya.moveTo(577, 274, duration=0.1)
    pya.click()
    
    ref = pyperclip.paste()
    return mcn, ref
Пример #6
0
def onscreen_keyboard_input(keyboard,input_str,sleep_time =0.5):
    try:
        pyautogui.moveTo(keyboard_in["begin1"])  
        for i in list(input_str):
            
            if keyboard.has_key(i):
                pyautogui.click(keyboard[i])
                time.sleep(sleep_time)
            elif i.isupper():
                i = i.lower()
                if keyboard.has_key(i):
                    #pyautogui.click(keyboard_in["begin1"])
                    pyautogui.click(keyboard["left_shift"])
                    #pyautogui.click(keyboard_in["begin1"])
                    pyautogui.click(keyboard[i])
                    #pyautogui.click(keyboard_in["begin1"])
                    time.sleep(sleep_time)
            else:
                #pyautogui.click(keyboard_in["begin1"])
                pyautogui.click(keyboard["left_shift"])
                #pyautogui.click(keyboard_in["begin1"])
                pyautogui.click(keyboard[shift_keyboard[i]])
                #pyautogui.click(keyboard_in["begin1"])
                time.sleep(sleep_time)
          
    #except:
    except Exception,e:  
        print("have issue. exit input string")
        msg = "onscreen_keyboard_input  funcation:" + e
        print  time.ctime(),msg 
        logging.info(msg)
def enterTimetableCalculator():
	enterPlanningOffice()
	#move to Timetable Calculator
	pyautogui.moveTo(1280, 386)
	click(1)
	delay(0.5)
	return
def enterPlanningOffice():
	removeInactivityScreen()
	#move to Planning Office
	pyautogui.moveTo(1110, 1000)
	click()
	delay(1)
	return
    def move_to(self, *coordinates):
        '''Moves the mouse pointer to an absolute coordinates.

        ``coordinates`` can either be a Python sequence type with two values
        (eg. ``(x, y)``) or separate values ``x`` and ``y``:

        | Move To         | 25             | 150       |     |
        | @{coordinates}= | Create List    | 25        | 150 |
        | Move To         | ${coordinates} |           |     |
        | ${coords}=      | Evaluate       | (25, 150) |     |
        | Move To         | ${coords}      |           |     |


        X grows from left to right and Y grows from top to bottom, which means
        that top left corner of the screen is (0, 0)
        '''
        if len(coordinates) > 2 or (len(coordinates) == 1 and
                                    type(coordinates[0]) not in (list, tuple)):
            raise MouseException('Invalid number of coordinates. Please give '
                                 'either (x, y) or x, y.')
        if len(coordinates) == 2:
            coordinates = (coordinates[0], coordinates[1])
        else:
            coordinates = coordinates[0]
        try:
            coordinates = [int(coord) for coord in coordinates]
        except ValueError:
            raise MouseException('Coordinates %s are not integers' %
                                 (coordinates,))
        ag.moveTo(*coordinates)
Пример #10
0
def selectTimetableCalculatorBestRoute():
	pyautogui.moveTo(1003, 673)
	click(0.3)
	delay(0.3)
	click(0.2)
	delay(0.5)
	return
Пример #11
0
def clickAndReturnMouse(img):
    orig_x,orig_y = pyautogui.position()
    pyautogui.moveTo(img['points'][0]['center'][0],img['points'][0]['center'][1])
    pyautogui.click()
    logging.info('CLICK')
    pyautogui.moveTo(orig_x, orig_y)
    return
Пример #12
0
def cut(link, FolderName):
    global UserName
    global Password
    global WaitTime
    global ChromiumBinary
    global UserNameLocation
    global PasswordLocation
    global PrepdButtonLocation
    global FolderSelectLocation
    global CatchButtonLocation
    global FirstBool

    print "Link: " + link
    print "Folder Name: " + FolderName + "\n"

    Popen([ChromiumBinary, "--incognito", link])
    print "went to rss link"
    time.sleep(WaitTime)

    pyautogui.moveTo(PrepdButtonLocation[0], PrepdButtonLocation[1])
    pyautogui.click()
    print "clicked on prepd button"
    time.sleep(WaitTime)

    if FirstBool == True:
        #login
        time.sleep(WaitTime)

        pyautogui.moveTo(PasswordLocation[0], PasswordLocation[1])
        pyautogui.click()
        pyautogui.typewrite(Password, interval=0.05)
        print "typed password"

        pyautogui.moveTo(UserNameLocation[0], UserNameLocation[1])
        pyautogui.click()
        pyautogui.typewrite(UserName, interval=0.05)
        print "typed username"

        pyautogui.press('enter')
        print "logged in"

        time.sleep(WaitTime)

    pyautogui.moveTo(FolderSelectLocation[0], FolderSelectLocation[1])
    pyautogui.click()
    print "clicked on folder selection"

    pyautogui.typewrite(FolderName, interval=0.05)
    pyautogui.press('enter')
    print "typed into folder selection"

    pyautogui.moveTo(CatchButtonLocation[0], CatchButtonLocation[1])
    pyautogui.click()
    time.sleep(WaitTime)
    print "caught article"

    pyautogui.press("esc")

    pyautogui.hotkey('ctrl', 'w')
    print "closed tab\n"
Пример #13
0
def clickAndReturnMouseCoords(coords):
    orig_x,orig_y = pyautogui.position()
    pyautogui.moveTo(coords[0],coords[1])
    pyautogui.click()
    logging.info('CLICK')
    pyautogui.moveTo(orig_x, orig_y)
    return
Пример #14
0
def clickAndReturnMouse_point(point):
    orig_x,orig_y = pyautogui.position()
    pyautogui.moveTo(point['center'][0],point['center'][1])
    pyautogui.click()
    logging.info('CLICK')
    pyautogui.moveTo(orig_x, orig_y)
    return
Пример #15
0
    def setUp(self):
        self.oldFailsafeSetting = pyautogui.FAILSAFE
        self.center = P(*pyautogui.size()) // 2

        pyautogui.FAILSAFE = False
        pyautogui.moveTo(*self.center) # make sure failsafe isn't triggered during this test
        pyautogui.FAILSAFE = True
Пример #16
0
    def drag_to(self, name, loader=_imageLoader, offset=(0, 0)):
        if GameStatus().game_stage == GameStage.Stopped:
            return
        self.log('try drag' + name)
        p = loader.get(name)
        max_val = 0
        x, y = 0, 0
        while max_val < 0.8:
            if GameStatus().game_stage == GameStage.Stopped:
                return

            self.capture()
            res = cv2.matchTemplate(self.screen, p, cv2.TM_CCOEFF_NORMED)
            min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
            self.log(name + ' ' + str(max_val))
            x, y = max_loc
            time.sleep(self._delay)

        m, n, q = p.shape

        x += n / 2
        y += m / 2

        pyautogui.moveTo(x, y, 0)
        pyautogui.dragTo(0, 200)
Пример #17
0
    def test_moveRel(self):
        # start at the center
        desired = self.center
        pyautogui.moveTo(*desired)
        mousepos = P(*pyautogui.position())
        self.assertEqual(mousepos, desired)

        # move down and right
        desired += P(42, 42)
        pyautogui.moveRel(42, 42)
        mousepos = P(*pyautogui.position())
        self.assertEqual(mousepos, desired)

        # move up and left
        desired -= P(42, 42)
        pyautogui.moveRel(-42, -42)
        mousepos = P(*pyautogui.position())
        self.assertEqual(mousepos, desired)

        # move right
        desired += P(42, 0)
        pyautogui.moveRel(42, None)
        mousepos = P(*pyautogui.position())
        self.assertEqual(mousepos, desired)

        # move down
        desired += P(0, 42)
        pyautogui.moveRel(None, 42)
        mousepos = P(*pyautogui.position())
        self.assertEqual(mousepos, desired)

        # move left
        desired += P(-42, 0)
        pyautogui.moveRel(-42, None)
        mousepos = P(*pyautogui.position())
        self.assertEqual(mousepos, desired)

        # move up
        desired += P(0, -42)
        pyautogui.moveRel(None, -42)
        mousepos = P(*pyautogui.position())
        self.assertEqual(mousepos, desired)

        # Passing a list instead of separate x and y.
        desired += P(42, 42)
        pyautogui.moveRel([42, 42])
        mousepos = P(*pyautogui.position())
        self.assertEqual(mousepos, desired)

        # Passing a tuple instead of separate x and y.
        desired -= P(42, 42)
        pyautogui.moveRel((-42, -42))
        mousepos = P(*pyautogui.position())
        self.assertEqual(mousepos, desired)

        # Passing a sequence-like object instead of separate x and y.
        desired += P(42, 42)
        pyautogui.moveRel(P(42, 42))
        mousepos = P(*pyautogui.position())
        self.assertEqual(mousepos, desired)
Пример #18
0
def attack():  # 使用match修改
    global AttackPos
    sleep(2)
    p.click()
    # sleep(0.001)
    p.moveTo(AttackPos[0], AttackPos[1])
    p.click(clicks=50)
def buscar_campo_serial(serial_number):
    msg = ''
    pyautogui.PAUSE = 0.5
    pyautogui.FAILSAFE = False
    pyperclip.copy('')
    
    dondeEstaElCampoSerial = pyautogui.locateOnScreen('operator-id-field.png')
    if dondeEstaElCampoSerial is None:
        msg = 'El campo de SERIAL NUMBER no fue encontrado'
        return (False, msg)
        
    else:
        campoSerialPos = list(dondeEstaElCampoSerial)
        #print campoSerialPos
         
    centrocampoSerial = pyautogui.center(campoSerialPos)     
    #print centrocampoSerial
    pyautogui.moveTo(centrocampoSerial)
    pyautogui.click(None,None,2)
    #pyautogui.typewrite('C3WB4E768226230')
    pyautogui.typewrite(serial_number)
    pyautogui.press('enter')
    #pyautogui.press('enter')
    #pyautogui.press('enter')
    
    return (True, msg)
Пример #20
0
def address_scrape():
    dob = pyperclip.copy('na')
    pya.moveTo(600, 175, duration=0.1)
    pya.click(button='right')
    pya.moveRel(55, 65)
    pya.click()
    dob = pyperclip.paste()
    
    street = pyperclip.copy('na')
    pya.moveTo(500, 240, duration=0.1)
    pya.click(button='right')
    pya.moveRel(55, 65)
    pya.click()
    street = pyperclip.paste()
    
    suburb = pyperclip.copy('na')
    pya.moveTo(330, 285, duration=0.1)
    pya.click(button='right')
    pya.moveRel(55, 65)
    pya.click()
    suburb = pyperclip.paste()
    
    postcode = pyperclip.copy('na')
    pya.moveTo(474, 285, duration=0.1)
    pya.dragTo(450, 285, duration=0.1)
    pya.moveTo(474, 285, duration=0.1)
    pya.click(button='right')
    pya.moveRel(55, 65)
    pya.click()
    postcode = pyperclip.paste()

    address = street + ' ' + suburb + ' ' + postcode

    return (address, dob)
Пример #21
0
def findTarget(img):    
    template_tg = cv2.imread('template_target2.png', 0)
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    ret,th1 = cv2.threshold(gray,253,255,cv2.THRESH_TOZERO_INV)
    ret,th3 = cv2.threshold(th1,251,255,cv2.THRESH_BINARY)
    kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (20, 15))
    closed = cv2.morphologyEx(th3, cv2.MORPH_CLOSE, kernel)
    closed = cv2.erode(closed, None, iterations = 3)
    closed = cv2.dilate(closed, None, iterations = 2)
    (cnts, hierarchy) = cv2.findContours(closed,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)

    approxes = []
    hulls = []
    for cnt in cnts:
        approxes.append(cv2.approxPolyDP(cnt,0.01*cv2.arcLength(cnt,True),True))
        hulls.append(cv2.convexHull(cnt))
        left = list(cnt[cnt[:,:,0].argmin()][0])        
        right = list(cnt[cnt[:,:,0].argmax()][0])
        print 'left x' + str(left[0])+ 'y '+ str(left[1])
        print 'right x' + str(right[0])+ 'y '+ str(right[1])
        center = round((right[0]+left[0])/2)
        center = int(center)
        moveMouse(center-10,left[1]+70)
        if (findFromTargeted(template_tg, left, right)):
            autoit.mouse_click('left', center-10, left[1]+70)
            return True
        pyautogui.moveTo(center,left[1]+70)
        moveMouse(center,left[1]+70)
        if (findFromTargeted(template_tg, left, right)):
            autoit.mouse_click('left', center+10, left[1]+70)
            return True
Пример #22
0
def scrollPage (**options):

    displayMagnification = 2 if sysvar_ratina == True else 1
    pyautogui.moveTo((options.get('top')/displayMagnification) + (options.get('width')/(displayMagnification*2)),
                     (options.get('left')/displayMagnification) + (options.get('height')/(displayMagnification*2)),
                     2)
    pyautogui.click()
    pyautogui.scroll(options.get('scroll'))
Пример #23
0
def clicker(coordinate):  # generate click event on a particular coordinate
    x = coordinate
    pyautogui.keyDown('ctrlleft')
    print(x)
    pyautogui.moveTo(x[0], x[1], duration=0.1) # This duration specifies how speed the mouse travels
    pyautogui.click(x[0], x[1])
    pyautogui.keyUp('ctrlleft')
    return True
Пример #24
0
 def bet(self, n):
     v = self.LOCATIONS['textBar']
     gui.moveTo(np.random.randint(v[0][0] + self.x, v[1][0] + self.x),
                np.random.randint(v[0][1] + self.y, v[1][1] + self.y), 
                duration = .5)
     gui.click()
     gui.typewrite(str(n), interval=0.25)
     gui.press('enter')
Пример #25
0
def loadSymbolInChart(msComponents, symbol):
    pyautogui.moveTo(msComponents['symbolEntry']['x'], msComponents['symbolEntry']['y'], 0.25)
    safeClick(msComponents['symbolEntry']['x'], msComponents['symbolEntry']['y'])
    pyautogui.hotkey(platform.primary_key_modifier, 'a')
    pyautogui.press('delete')
    pyautogui.typewrite(symbol)
    pyautogui.typewrite(['enter'])
    wait(DELAY_CHART_LOAD)
Пример #26
0
Файл: gl.py Проект: vanjac/three
 def unlockMouse(self):
     if self.mouseLocked:
         global mouseMovementLock
         self.mouseLocked = False
         pyautogui.moveTo(glutGet(GLUT_WINDOW_X) + self.mouseLockX,
                          glutGet(GLUT_WINDOW_Y) + self.mouseLockY)
         mouseMovementLock = threading.Lock()
     glutSetCursor(GLUT_CURSOR_INHERIT)
Пример #27
0
    def drag_screen_region_to_screen_region(self, start_screen_region=None, end_screen_region=None, duration=1, offset=(0, 0), game=None):
        start_screen_region_coordinates = self._extract_screen_region_coordinates(start_screen_region, game=game)
        end_screen_region_coordinates = self._extract_screen_region_coordinates(end_screen_region, game=game)

        pyautogui.moveTo(*start_screen_region_coordinates)

        coordinates = (end_screen_region_coordinates[0] + offset[0], end_screen_region_coordinates[1] + offset[1])
        pyautogui.dragTo(*coordinates, duration=duration)
Пример #28
0
def setDatabaseFoodmart():
	offset = adjustXOffset()
	pyautogui.moveTo(200+offset, 300)
	pyautogui.click()
	pyautogui.moveTo(200+offset, 360)
	time.sleep(shortSleep)
	pyautogui.click()
	time.sleep(shortSleep)
Пример #29
0
def hourChime(numChimes):
    p.moveTo(UL_X, UL_Y, duration=SWEEP_TIME)
    for x in range(numChimes):
        p.moveTo(UR_X, UR_Y, duration=SWEEP_TIME)
        p.moveTo(LR_X, LR_Y, duration=SWEEP_TIME)
        p.moveTo(LL_X, LL_Y, duration=SWEEP_TIME)
        p.moveTo(UL_X, UL_Y, duration=SWEEP_TIME)
        time.sleep(1)
Пример #30
0
    def click(self):

        currentMouseX, currentMouseY = gui.position()

        left, top, right, bottom = self.box

        gui.click(((left + right)) // 2, (top + bottom) // 2)
        gui.moveTo(currentMouseX, currentMouseY)
Пример #31
0
    def on_frame(self, controller):
        global swipeLeft
        global swipeRight
        global fistTimer
        global turnDir
        global swipeDir
        global swipeFinger
        global tapFinger
        global screenTapFinger
        global pinch
        global grab
        global fingerCount
        # Get the most recent frame and report some basic information
        frame = controller.frame()
        turns = 0

        #Configurating Gesture Settings
        controller.config.set("Gesture.Swipe.MinLength", 220)
        controller.config.set("Gesture.Swipe.MinVelocity", 100)
        controller.config.save()

        controller.config.set("Gesture.KeyTap.MinDownVelocity", 40.0)
        controller.config.set("Gesture.KeyTap.HistorySeconds", .3)
        controller.config.set("Gesture.KeyTap.MinDistance", 1.0)
        controller.config.save()

        controller.config.set("Gesture.ScreenTap.MinForwardVelocity", 20.0)
        controller.config.set("Gesture.ScreenTap.HistorySeconds", .5)
        controller.config.set("Gesture.ScreenTap.MinDistance", 1.0)
        controller.config.save()

        for gesture in frame.gestures():

            #Circle Gesture
            if gesture.type == Leap.Gesture.TYPE_CIRCLE:
                circle = CircleGesture(gesture)

                if (circle.pointable.direction.angle_to(circle.normal) <=
                        Leap.PI / 2):
                    turnDir = "CW"
                    turns += circle.progress
                    if (turns > 2.5):
                        pyautogui.hotkey('volumeup')
                        #sleep(.1)
                else:
                    turnDir = "CCW"
                    turns -= circle.progress
                    if (turns < -2.5):
                        pyautogui.hotkey('volumedown')
                        #sleep(.1)

                print(turnDir + " " + str(turns))  ######SWAP WITH FUCNTION

            #Swipe Gesture
            if gesture.type is Leap.Gesture.TYPE_SWIPE:
                swipe = Leap.SwipeGesture(gesture)

                swipeDir = swipe.direction
                swipeFinger = swipe.pointable

                if (swipeDir[0] < 0):

                    pyautogui.moveTo(980, 540, 0)
                    pyautogui.click()
                    pyautogui.hotkey('left')
                    pyautogui.hotkey('alt', 'tab')
                    sleep(1.2)
                elif (swipeDir[0] > 0):

                    pyautogui.moveTo(980, 540, 0)
                    pyautogui.click()
                    pyautogui.hotkey('right')
                    pyautogui.hotkey('alt', 'tab')
                    sleep(1.2)

                print("Swipe " + str(swipeFinger) + " " + str(swipeDir[0])
                      )  ######SWAP WITH FUCNTION

            #Key-Tap Gesture
            if gesture.type is Leap.Gesture.TYPE_KEY_TAP:
                tap = Leap.KeyTapGesture(gesture)
                tapFinger = tap.pointable
                tapDir = tap.direction

                print("Tap " + str(tapDir))  ######SWAP WITH FUCNTION

            #Screen-Tap Gesture
            if gesture.type is Leap.Gesture.TYPE_SCREEN_TAP:
                screenTap = Leap.ScreenTapGesture(gesture)
                screenTapFinger = screenTap.pointable

                print("ScreenTap " + str(screenTapFinger)
                      )  ######SWAP WITH FUCNTION

        for hand in frame.hands:

            #Identifies the hand
            handType = "Left" if hand.is_left else "Right"

            grab = hand.grab_strength
            pinch = hand.pinch_strength
            #print(handType + " p:" + str(pinch) + " g:"+ str(grab)) ######SWAP WITH FUCNTION
            if grab == 1:
                if (fistTimer > 2):
                    pyautogui.hotkey('volumemute')
                    print("g" + str(grab))
                    sleep(1.2)
                    fistTimer = 0
                else:
                    fistTimer += 1
            '''elif pinch > 0.99:
Пример #32
0
def BoardFocus():
    if (pausex == -1 or pausey == -1):
        return False
    pyautogui.moveTo(pausex - 125, pausey)
    pyautogui.click()
    return True
Пример #33
0
 def iometer_start(self):
     start_btn = pyautogui.locateOnScreen(
         r'D:\tools\IOMeter\btn\start_btn.png')
     x, y = pyautogui.center(start_btn)
     pyautogui.moveTo(x, y, duration=0.5, tween=pyautogui.easeInOutQuad)
     pyautogui.click()
Пример #34
0
def droidListCard(price):
    # clicks on the "List on Transfer Market" tab
    moveX = utility.r(droidListTab[0], droidListTab[2])
    moveY = utility.r(droidListTab[1], droidListTab[3])
    pygui.moveTo(moveX, moveY, utility.r(0.3, 0.2)) # x, y, duration
    pygui.click(moveX, moveY, 1, utility.r(1, 0.2)) # x, y, number of clicks, pause

    # scrolls down to reveal price buttons
    pygui.mouseDown()
    pygui.moveTo(moveX, moveY - scroll, utility.r(0.3, 0.2)) # x, y, duration
    pygui.mouseUp()
    utility.s(0.5)

    # inputs the start price
    moveX = utility.r(droidStartPrice[0], droidStartPrice[2])
    moveY = utility.r(droidStartPrice[1], droidStartPrice[3])
    pygui.moveTo(moveX, moveY, utility.r(0.2, 0.2)) # x, y, duration
    pygui.click(moveX, moveY, 1, utility.r(0, 0.2)) # x, y, number of clicks, pause
    utility.s(0.5)
    pygui.typewrite(str(price))
    utility.s(1)

    # inputs the BIN price
    moveX = utility.r(droidBINPrice[0], droidBINPrice[2])
    moveY = utility.r(droidBINPrice[1], droidBINPrice[3])
    pygui.moveTo(moveX, moveY, utility.r(0.2, 0.2)) # x, y, duration
    pygui.click(moveX, moveY, 1, utility.r(0, 0.2)) # x, y, number of clicks, pause
    utility.s(0.5)
    pygui.typewrite(str(price))
    utility.s(1)

    # clicks on the "List Item" button
    moveX = utility.r(droidListButton[0], droidListButton[2])
    moveY = utility.r(droidListButton[1], droidListButton[3])
    pygui.moveTo(moveX, moveY, utility.r(0.2, 0.2)) # x, y, duration
    pygui.click(moveX, moveY, 1, utility.r(3, 0.2)) # x, y, number of clicks, pause
    utility.s(0.5)

    # scrolls up to reveal card
    pygui.moveTo(moveX, moveY - scroll, utility.r(0.3, 0.2)) # x, y, duration
    pygui.mouseDown()
    pygui.moveTo(moveX, moveY, utility.r(0.3, 0.2)) # x, y, duration
    pygui.mouseUp()
def Coletar_Facebook():
	global curtidas, output

	def facebooktoexcel(letra):
		global curtidas, output

		if letra == "C":
			prefix = "\\r\\n\\r\\n"
		elif letra == "B":
			prefix = "\\r\\n"
		else:
			prefix = ''



		if prefix + "Ana Beatriz Farias" in curtidas:
			output = output + letra + " \t \t \t"
		else:
			output = output + "\t \t \t" 

		if prefix + "Beatriz Mendon\\xc3\\xa" in curtidas:
			output = output + letra + " \t \t \t"
		else:
			output = output + "\t \t \t" 

		if prefix + "Bianca Felipe" in curtidas:
			output = output + letra + " \t \t \t"
		else:
			output = output + "\t \t \t" 

		if prefix + "Taynara Ramalho" in curtidas:
			output = output + letra + " \t \t \t"
		else:
			output = output + "\t \t \t" 

		if prefix + "Ernane Matheus" in curtidas:
			output = output + letra + " \t \t \t"
		else:
			output = output + "\t \t \t" 

		if prefix + "Giovanny Silva" in curtidas:
			output = output + letra + " \t \t \t"
		else:
			output = output + "\t \t \t" 

		if prefix + "Jo\\xc3\\xa3o Vin\\xc3\\xadcius Pereira" in curtidas:
			output = output + letra + " \t \t \t"
		else:
			output = output + "\t \t \t" 

		if prefix + "Pedro Paulo Pinheiro Moura" in curtidas:
			output = output + letra + " \t \t \t"
		else:
			output = output + "\t \t \t" 

		if prefix + "J\\xc3\\xbalia Caroline" in curtidas:
			output = output + letra + " \t \t \t"
		else:
			output = output + "\t \t \t" 

		if prefix + "Luiz Andr\\xc3\\xa9 Fialho Oliveira" in curtidas:
			output = output + letra + " \t \t \t"
		else:
			output = output + "\t \t \t" 

		if prefix + "Emanuelle Paiva" in curtidas:
			output = output + letra + " \t \t \t"
		else:
			output = output + "\t \t \t" 

		if prefix + "Izabele Vitoria" in curtidas:
			output = output + letra + " \t \t \t"
		else:
			output = output + "\t \t \t" 

		if prefix + "J\\xc3\\xbalia Vieira" in curtidas:
			output = output + letra + " \t \t \t"
		else:
			output = output + "\t \t \t" 

		if prefix + "Tuiza Galgani" in curtidas:
			output = output + letra + " \t \t \t"
		else:
			output = output + "\t \t \t" 

		if prefix + "Victor Duarte" in curtidas:
			output = output + letra + " \t \t \t"
		else:
			output = output + "\t \t \t" 

		output = output + '\n'


	Tudo = ''

	def alt_tab_to_chrome(a,b,c, extra, alttab):
		if alttab:
			pyautogui.keyDown('alt')
			pyautogui.press('tab')

		c_x, c_y = dar_coordenadas_cor_print(a,b,c,0)

		pyautogui.click(c_x,c_y + extra, duration = 0.2)

		pyautogui.keyUp('alt')


	def double_key(a,b):
		pyautogui.keyDown(a)
		pyautogui.press(b)
		pyautogui.keyUp(a)

	def multiple_alttab(a):
		pyautogui.keyDown('alt')
		for i in range(a):
			pyautogui.press('tab')
			time.sleep(0.5)
		pyautogui.keyUp('alt')

	def check_cor_print_limite_y(a_,b_,c,limite):

		time.sleep(2)
		a = printar_tela()
		b = np.array(a)

		j = 0

		parar = False

		a1 = np.asarray([a_,b_,c])

		for eachRow in b:
			if parar == True:
				break
			j += 1
			i = 0
			for eachPix in eachRow:
				if parar == True:
					break
				i += 1

				if (a1 == eachPix).all() and GetSystemMetrics(1)*limite > j:
					print(eachPix)
					print(' : Row = ' +  str(j) + '; Column = ' +str(i))
					x_encontrado = i
					y_encontrado = j
					parar = True

		return True

	# ABRIR CHROME

	alt_tab_to_chrome(220,76,64, 40, True)
	alt_tab_to_chrome(68,103,177, 0, False)

	# Arrastar página para o final

	pyautogui.moveTo(628, 400, 0.1)
	for aosjf in range(2):
		time.sleep(3)
		pyautogui.scroll(-10000)

	coord = {}

	if check_cor_print_limite_y(52,159,253,0.5):
		coord[0] = 731

	else:
		coord[0] = 527

	c_x, c_y = dar_coordenadas_cor_print(51 , 158 , 253,0.5)

	# Abrir Quadro de Reações

	pyautogui.moveTo(c_x+50,c_y, 0.5)
	pyautogui.click()

	# Selecionar tudo

	pyautogui.moveTo(575, 246, 2)
	pyautogui.mouseDown(button='left')
	pyautogui.moveTo(1000, 661, 0.5)
	time.sleep(2)
	pyautogui.mouseUp(button='left')

	# Dar ctl+c

	pyautogui.keyDown('ctrl')
	pyautogui.press('c')
	pyautogui.keyUp('ctrl')

	time.sleep(0.5)

	win32clipboard.OpenClipboard()
	novo = win32clipboard.GetClipboardData(win32con.CF_UNICODETEXT)
	Tudo = Tudo + ' ComecouCurtidas: ' + novo 
	win32clipboard.CloseClipboard()


	# Fechar janela de reações

	pyautogui.click(1136,600, duration = 0.5)

	# Abrir compartilhamentos e ir até o final

	pyautogui.moveTo(c_x+330,c_y, 0.5)
	pyautogui.click()

	time.sleep(1)

	pyautogui.scroll(-10000)
	time.sleep(1)
	pyautogui.scroll(-10000)
	time.sleep(1)
	pyautogui.scroll(-10000)

	# Selecionar compartilhamentos


	if coord[0] == 731:
		pyautogui.moveTo(1056,757, 0.5)
		pyautogui.mouseDown(button='left')
		pyautogui.moveTo(524, 77, 0.5)
		time.sleep(5)
		pyautogui.mouseUp(button='left')
	else:
		pyautogui.moveTo(1056,725, 0.5)
		pyautogui.mouseDown(button='left')
		pyautogui.moveTo(520, 725, 0.5)
		pyautogui.moveTo(520, 250, 0.5)
		time.sleep(5)
		pyautogui.mouseUp(button='left')


	# Copiar compartilhamentos

	pyautogui.keyDown('ctrl')
	pyautogui.press('c')
	pyautogui.keyUp('ctrl')

	time.sleep(0.5)

	win32clipboard.OpenClipboard()
	novo = win32clipboard.GetClipboardData(win32con.CF_UNICODETEXT)
	Tudo = Tudo + ' ComecouCompartilhamentos: ' + novo 
	win32clipboard.CloseClipboard()


	# Fechar compartilhamentos


	pyautogui.click(1160,700, duration = 0.5)

	time.sleep(1)

	pyautogui.scroll(-10000)

	time.sleep(1)

	# Abrir caixa de comentários

	c_x, c_y = dar_coordenadas_cor_print(51 , 158 , 253,0.5)


	pyautogui.click(c_x + 270,c_y, duration = 0.5)

	time.sleep(1)

	pyautogui.scroll(-10000)

	# Expandir caixa de comentários

	if coord[0] == 731:
		pyautogui.click(478,778, duration = 0.5)
	else:
		pyautogui.click(425,714, duration = 0.5)

	pyautogui.scroll(-10000)
	time.sleep(2)
	pyautogui.scroll(-10000)

	# Copiar comentários

	if coord[0] == 731:
		pyautogui.moveTo(841,790,0.5)
		time.sleep(2)
		pyautogui.mouseDown(button='left')
		pyautogui.moveTo(343, 790, 0.5)
		pyautogui.moveTo(343, 79, 0.5)
		time.sleep(5)
	else:
		pyautogui.moveTo(800,686,0.5)
		time.sleep(2)
		pyautogui.mouseDown(button='left')
		pyautogui.moveTo(317, 686, 0.5)
		pyautogui.moveTo(317, 86, 0.5)
		time.sleep(5)

	pyautogui.mouseUp(button='left')

	pyautogui.keyDown('ctrl')
	pyautogui.press('c')
	pyautogui.keyUp('ctrl')

	time.sleep(0.5)

	win32clipboard.OpenClipboard()
	novo = win32clipboard.GetClipboardData(win32con.CF_UNICODETEXT)
	Tudo = Tudo + 'ComecouComentarios' + novo
	win32clipboard.CloseClipboard()

	## Convertendo tudo para uma linguagem aceitavel pelo python (sem emojis).

	Tudo = Tudo.encode('utf-8')

	Tudo = str(Tudo)

	print(Tudo)


	### PARTE 2
	### EXTRAÇÃO DE INFORMAÇÕES DA STRING


	curtidas = Tudo[:Tudo.index('ComecouCompartilhamentos')]



	output = ''

	facebooktoexcel('A')

	curtidas = Tudo[Tudo.index('ComecouComentarios'):]



	facebooktoexcel('B')

	curtidas = Tudo[Tudo.index('ComecouCompartilhamentos'):Tudo.index('ComecouComentarios')]

	print('\n\n' + curtidas + '\n\n')

	facebooktoexcel('C')



	win32clipboard.OpenClipboard()
	win32clipboard.EmptyClipboard()
	win32clipboard.SetClipboardData(win32con.CF_UNICODETEXT, output)
	win32clipboard.CloseClipboard()

	print(output)

	double_key('alt','tab')


	return output
Пример #36
0
import pyautogui as ptg
'''
import PIL as pl
import playsound as play
#setting fail safes
ptg.FAIL_SAFE=True
ptg.PAUSE=1
#moving the pointer to screen center
screenWidth, screenHeight = ptg.size()
ptg.moveTo(screenWidth / 2, screenHeight / 2)
ptg.click() #click!!
ptg.PAUSE = 10
#moving mouse like in staircase pattern
distance=20
for i in range(0,20):
 if i%2==0:
  ptg.moveRel(0,-distance,0.5)
 else :
  ptg.moveRel(distance,0,0.5)

#ptg.screenshot('foo.png')
#locaaion= ptg.locateOnScreen('start.png')

#locaaion=ptg.locateCenterOnScreen('click button.png')
#print(locaaion)
#print(locaaion.x)

#ptg.moveTo(locaaion)
#ptg.PAUSE = 5
#ptg.click(locaaion)
def moveAndClick(location):
    gui.moveTo(location)
    gui.leftClick()
Пример #38
0
curses.halfdelay(1)
screen.keypad(True)
curses.start_color()
curses.use_default_colors()
curses.init_pair(1, curses.COLOR_RED, -1)
curses.init_pair(2, curses.COLOR_GREEN, -1)
curses.init_pair(3, curses.COLOR_BLUE, -1)

xmbase, ymbase = pyautogui.size()
xmbase = xmbase / 2
ymbase = ymbase / 2

d_one = 150  #distance from shoulder to elbow
d_two = 150  #distance from elbow to wrist

pyautogui.moveTo(xmbase, ymbase, duration=.1)

while True:  #to end loop if 'q' is hit
    key = screen.getch()
    screen.clear()
    xread, yread = pyautogui.position()
    x = xread - xmbase
    y = yread - ymbase
    sqd_one = math.pow(d_one, 2)
    sqd_two = math.pow(d_two, 2)

    d_three = math.sqrt(
        math.pow(y, 2) +
        math.pow(x, 2))  # determining distance from shoulder to wrist ^
    screen.addstr(1, 1, "Press q to quit")
Пример #39
0
    # Open the file in read only mode
    with open(file_name, 'r') as read_obj:
        # Read all lines in the file one by one
        for line in read_obj:
            # For each line, check if line contains the string
            if string_to_search in line:
                return True
    return False


time.sleep(2)

list_of_working = []

for each in range(445, 10000):
    bot.moveTo(450, 50, .2)
    time.sleep(.1)
    bot.click()
    time.sleep(.1)
    bot.hotkey('ctrl', 'a')
    time.sleep(.1)
    bot.press('backspace')
    time.sleep(.1)
    bot.typewrite('poway.instructure.com/courses/' + str(each) + ' ')
    time.sleep(.1)
    bot.press('enter')
    time.sleep(.75)
    bot.moveTo(650, 350)
    time.sleep(.1)
    bot.click()
    time.sleep(.1)
Пример #40
0
import pyautogui
pyautogui.moveTo(100, 150)
pyautogui.moveRel(0, 10)  # move mouse 10 pixels down
pyautogui.dragTo(100, 150)
pyautogui.dragRel(0, 10)  # drag mouse 10 pixels down

pyautogui.click(100, 100)

pyautogui.click(100, 100)
def open_card(point):
    if (point == None):
        return
    gui.moveTo(point)
    gui.leftClick()
Пример #42
0
def adjustCursor(x, y):
    width, height = pyautogui.size();
    wrongKeyAttempts = 3;
    print('x-axis: ' + str(x) + '% from the left');
    print('y-axis: ' + str(y) + '% from the bottom');

    print('Adjust the cursor using your arrow keys (do not hold down or press too fast). Press \'c\' to cancel.\n');
    while(True):
        # Update cursor and get user key press
        pyautogui.moveTo(width * x/100, height * (100 - y)/100, duration=0.1);
        key = readchar.readkey();

        # Map keyboard press to cursor movement, cancel, or continue
        if (key == readchar.key.UP):
            wrongKeyAttempts = 3;

            if (y < 100):
                y = y + 1;
            else:
                print("Can not move any further up!");

        elif (key == readchar.key.DOWN):
            wrongKeyAttempts = 3;

            if (y > 0):
                y = y - 1;
            else:
                print("Can not move any further down!");

        elif (key == readchar.key.LEFT):
            wrongKeyAttempts = 3;

            if (x > 0):
                x = x - 1;
            else:
                print("Can not move any further left!");

        elif (key == readchar.key.RIGHT):
            wrongKeyAttempts = 3;

            if (x < 100):
                x = x + 1;
            else:
                print("Can not move any further right!");

        elif (key == readchar.key.ENTER):
            print("New x-axis val: " + str(x) + "% from the left");
            print('New y-axis val: ' + str(y) + '% from the bottom');
            break;

        elif (key == 'c'):
            print("Configuration cancelled.");
            return -1, -1;

        else:
            print("Invalid key pressed! Please enter a valid key. ")
            wrongKeyAttempts = wrongKeyAttempts - 1;
            print("Wrong key attempts left: " + str(wrongKeyAttempts));

            if (wrongKeyAttempts <= 0):
                print("Clearly this is too complicated for you to handle...");
                break;

    return x, y;
Пример #43
0
def click_image(image, pos, action, timestamp, offset=5):
    img = cv2.imread(image)
    height, width, channels = img.shape
    pyautogui.moveTo(pos[0] + r(width / 2, offset),
                     pos[1] + r(height / 2, offset), timestamp)
    pyautogui.click(button=action)
Пример #44
0
def active_eve():
    pyautogui.moveTo(*active_eve_pos, duration=1.0)
    pyautogui.click()
for file in files:
	n=1
	filename = file
	methodpaste = Methods_dict[file]
	n+=1




	#pyautogui.click(Analystlocations['NeutralLeft'])
	#pyautogui.hotkey('ctrl', 's')


	#save as new file
	pyautogui.click('file.png')
	pyautogui.moveTo(45, 266, duration=1, tween=pyautogui.easeInOutQuad)
	pyautogui.click()
	pyautogui.typewrite(filename)
	pyautogui.press('enter')
	time.sleep(0.5)
	pyautogui.press('left')
	pyautogui.press('enter')

	#change method
	SetMethod_MRM()

	time.sleep(10)


	pyautogui.hotkey('ctrl', 's')
Пример #46
0
def click_pos(click_target_pos, duration=0.5, pause=0.1):
    pyautogui.moveTo(*click_target_pos, duration=duration)
    pyautogui.click(pause=pause)
Пример #47
0
    def run(self):
        for action in self._actions:
            if not self._running:
                self.sbMessage.emit(["Program stopped.", 4000])
                self.finished.emit()
                break
            if action[0] == "Delay":
                delay = int(action[2])
                sleep(delay / 1000)
# =============================================================================
#                 loop = QEventLoop()
#                 QTimer.singleShot(delay, loop.quit)
#                 loop.exec_()
# =============================================================================
##ÿQTest.qWait(delay)

# MOUSE
            if action[0] == "Move To":
                x, y, duration = int(action[2]), int(action[4]), float(
                    action[6])
                pyautogui.moveTo(x, y, duration)
            if action[0] == "Move Relative":
                x, y, duration = int(action[2]), int(action[4]), float(
                    action[6])
                pyautogui.moveRel(x, y, duration)
            if action[0] == "Drag To":
                x, y, duration = int(action[2]), int(action[4]), float(
                    action[6])
                pyautogui.dragTo(x, y, duration)
            if action[0] == "Drag Relative":
                x, y, duration = int(action[2]), int(action[4]), float(
                    action[6])
                pyautogui.dragRel(x, y, duration)
            if action[0] == "Click To":
                x, y, button, clicks, interval, duration = int(action[2]), int(
                    action[4]), action[6], int(action[8]), float(
                        action[10]), float(action[12])
                pyautogui.click(x=x,
                                y=y,
                                button=button,
                                clicks=clicks,
                                interval=interval,
                                duration=duration)
            if action[0] == "Click":
                button, clicks, interval, duration = action[2], int(
                    action[4]), float(action[6]), float(action[8])
                pyautogui.click(button=button,
                                clicks=clicks,
                                interval=interval,
                                duration=duration)
            if action[0] == "Scroll":
                clicks = int(action[2])
                pyautogui.scroll(clicks=clicks)

            # KEYBOARD
            if action[0] == "Write":
                interval, text = float(action[2]), action[4]
                pyautogui.typewrite(text, interval=interval)
            if action[0] == "Press":
                presses, interval, text = int(action[2]), float(
                    action[4]), action[6]
                pyautogui.press(text, interval=interval, presses=presses)
            if action[0] == "Hotkey":
                hotkey = action[2].split()
                pyautogui.hotkey(*hotkey)
            if action[0] == "Key Down":
                hotkey = action[2]
                pyautogui.keyDown(hotkey)
            if action[0] == "Key Up":
                hotkey = action[2]
                pyautogui.keyUp(hotkey)

            # SCREEN
            if action[0] == "Screenshot":
                overwrite, dir_path, file_name = action[2], action[4], action[
                    6]
                if overwrite == "yes":
                    path = os.path.join(dir_path, file_name) + ".png"
                    pyautogui.screenshot(path)
                if overwrite == "no":
                    path = os.path.join(dir_path, file_name)
                    path = self.notOverwrite(path)
                    pyautogui.screenshot(path)

            if action[0] == "Find Image":
                cb1, cb2, cb3, wait, path = action[2], action[4], action[
                    6], float(action[8]), action[10]

                if cb1 == "yes":
                    while self._running:
                        a = None
                        try:
                            if cb3:
                                a = pyautogui.locateCenterOnScreen(
                                    path, grayscale=True)
                            else:
                                a = pyautogui.locateCenterOnScreen(path)
                        except:
                            pass
                        if a:
                            break
                        sleep(wait)
                    if cb2 == "yes" and a:
                        pyautogui.click(a[0], a[1])
                if cb1 == "no":
                    a = None
                    try:
                        if cb3:
                            a = pyautogui.locateCenterOnScreen(path,
                                                               grayscale=True)
                        else:
                            a = pyautogui.locateCenterOnScreen(path)
                    except:
                        pass
                if cb2 == "yes" and a:
                    pyautogui.click(a[0], a[1])
Пример #48
0
def run():
    # print("ok")Hello.
    # plt.switch_backend('Agg')

    global showvid

    gg = gest.States(5)
    hands = gest.MH(buffer_size=100)
    plt.switch_backend('Agg')
    try:
        # print("hi bithc")
        cap = cv2.VideoCapture(0)
        # print("hi ok")
        while cap.isOpened():
            success, image = cap.read()
            if not success:
                print("Ignoring empty")
                continue
            # print("hi sigh")
            res = hands.run(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
            hshape = ""
            if hands.his:
                hshape = gest.Train(
                    "/Users/leonachen/mediapipe/CmdSpaceOX/Interface/data_folder"
                ).getshape(hands.his[-1])
                gg.run(hshape, hands.his[-1], hands.his)
                print(f"state={gg.state}, click={gg.ic}, shape={hshape}")
                if gg.state == "cursor":
                    point = hands.his[-1][gest.LM.INDEX_FINGER_TIP]
                    point = gest.np.mean(hands.his[-1], axis=0)
                    SENSE = 1.5
                    relativeX = int(point[0] * pag.size()[0] * SENSE)
                    relativeY = int(point[1] * pag.size()[1] * SENSE)
                    pag.FAILSAFE = False
                    pag.moveTo(relativeX, relativeY, _pause=False)
                if gg.ic:
                    pag.click()
                    gg.ic = False
                # if gd.state == "ctrlw":
                #     gui.hotkey('command','w', _pause=False)
                if gg.state == "audio":
                    try:
                        speech_input.from_mic()
                    except AssertionError as e:
                        print(
                            "Speech recognition currently not available because "
                            + str(e))
                    gg.state = "none"

                # if gd.state == "volume":
                #     if gd.scroll_height > 0.5:
                #         pag.press('volumeup',  _pause=False)
                #     else:
                #         pag.press('volumedown', _pause=False)
                # if gd.state == "scroll":
                #     SCROLLSENSE = 15
                #     gd.ic=False
                #     if gd.scroll_height > 0.5:
                #         pag.scroll(
                #             int(gd.scroll_height * SCROLLSENSE), _pause=False)
                #     else:
                #         pag.scroll(int(gd.scroll_height * -
                #                     SCROLLSENSE), _pause=False)

            if showvid:
                # Overlaying the mediapipe "skeleton"
                # print("hi lmfaooooo")
                img = hands.drawlol(image, res)
                # plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
                # plt.show()
                cv2.imshow('KEK XD LMFAO', img)
                # print("hi bro sigh")

            if cv2.waitKey(5) & 0xFF == 27:
                break
    except:
        cv2.destroyAllWindows()
        hands.close()
        cap.release()
        print("\n>>> Error caught. Program closed gracefully. <<<\n")
        raise
Пример #49
0
def set_expedition_path(expedition_pos):
    pyautogui.moveTo(*expedition_pos, duration=0.5)
    pyautogui.click(button='right')

    pyautogui.moveRel(25, 30, duration=0.2)
    pyautogui.click()
Пример #50
0
import pyautogui

pyautogui.PAUSE = 2
pyautogui.moveTo(300, 300)
#pyautogui.click(300, 300)
while 1:
    #for i in range(200):
    # print(i)
    #pyautogui.scroll(-100)

    pyautogui.moveTo(300, 300, duration=0.75)
    pyautogui.moveTo(300, 400, duration=0.75)
#
#
# pyautogui.click(500, 200)
# pyautogui.typewrite('Hello world!',0.25)

# for i in range(10):
#       pyautogui.moveTo(300, 300, duration=0.25)
#       pyautogui.moveTo(400, 300, duration=0.25)
#       pyautogui.moveTo(400, 400, duration=0.25)
#       pyautogui.moveTo(300, 400, duration=0.25)

# from PIL import ImageGrab
#
# im = ImageGrab.grab()
#
# im.save("E:\\a.jpg",'jpeg')

# coding=utf-8
import time
Пример #51
0
def jump_through_gate():
    pyautogui.moveTo(*travel_title_pos, duration=0.5)
    pyautogui.click(button='right')

    pyautogui.moveRel(25, 10, duration=0.2)
    pyautogui.click()
Пример #52
0
import pyautogui

# take ss
pyautogui.screenshot("example.png")

# locate png on screen
print(pyautogui.locateOnScreen("examplegmailicon.png"))

# locate center of png
print(pyautogui.locateCenterOnScreen("examplegmailicon.png"))

pyautogui.moveTo((62, 19), duration=1)
Пример #53
0
def output_sys_tokatsu(cntr):
    time.sleep(3)
    print('#--------------【利用システムをクリックしました】-------------------#')
    pyautogui.moveTo(1121, 434, 0.5)
    pyautogui.click(1121, 434)
    time.sleep(2)

    print('#--------------【システム選択をクリックしました】-------------------#')
    pyautogui.moveTo(1105, 496, 0.5)
    pyautogui.click(1105, 496)
    time.sleep(1)

    print('#--------------【選択をクリックしました】-------------------#')
    pyautogui.moveTo(903, 525, 0.5)
    pyautogui.click(903, 525)
    time.sleep(1)

    print('#--------------【新規作成をクリックしました】-------------------#')
    pyautogui.moveTo(643, 269, 0.5)
    pyautogui.click(643, 269)
    time.sleep(1)

    if cntr == 1:  #1回目だけ
        print('#--------------【●●をクリックしました】-------------------#')
        pyautogui.moveTo(643, 269, 0.5)
        pyautogui.click(643, 269)
        time.sleep(1)

        print('#--------------【●●をクリックしました】-------------------#')
        pyautogui.moveTo(666, 117, 0.5)
        pyautogui.click(666, 117)
        time.sleep(1)

        print('#--------------【請求年月をクリックしました】-------------------#')
        pyautogui.click(894, 393)
        pyperclip.copy(denpyo_hiduke7)
        print("denpyo_hiduke7:", denpyo_hiduke7)
        #pyperclip.copy("2019/06")
        pyautogui.hotkey('ctrl', 'v')
        time.sleep(1)

        print('#--------------【部署コードをクリックしました】-------------------#')
        pyautogui.click(907, 428)
        pyautogui.typewrite("1036")  #固定
        time.sleep(1)

    print('#--------------【OKをクリックしました】-------------------#')
    pyautogui.moveTo(954, 473, 0.5)
    pyautogui.click(954, 473)
    time.sleep(2)

    print('#--------------【●●をクリックしました】-------------------#')
    pyautogui.moveTo(1360, 222, 0.5)
    pyautogui.click(1360, 222)
    time.sleep(2)

    print('#--------------【請求日付を入力しました】-------------------#')
    pyautogui.click(1366, 218)
    pyperclip.copy(denpyo_hiduke10)
    print("kanri_bango:", kanri_bango)
    #pyperclip.copy("2019/05/31")
    pyautogui.hotkey('ctrl', 'v')
    time.sleep(1)

    print('#--------------【●●をクリックしました】-------------------#')
    pyautogui.moveTo(1338, 170, 0.5)
    pyautogui.click(1338, 170)
    time.sleep(1)

    print('#--------------【●●をクリックしました】-------------------#')
    pyautogui.click(995, 120)
    pyautogui.typewrite(str(kanri_bango))  #管理番号
    print("kanri_bango:", kanri_bango)
    #pyautogui.typewrite("103635001")
    time.sleep(1)

    print('#--------------【●●をクリックしました】-------------------#')
    pyautogui.moveTo(1409, 121, 0.5)
    pyautogui.click(1409, 121)
    time.sleep(1)

    print('#--------------【●●をクリックしました】-------------------#')
    pyautogui.moveTo(1405, 122, 0.5)
    pyautogui.click(1405, 122)
    time.sleep(1)

    print('#--------------【●●をクリックしました】-------------------#')
    pyautogui.moveTo(974, 616, 0.5)
    pyautogui.click(974, 616)
    time.sleep(1)

    print('#--------------【●●をクリックしました】-------------------#')
    pyautogui.click(897, 387)
    pyautogui.dragTo(480, 387, 2, button='left')
    pyperclip.copy(tekiyo)  #適用
    #pyperclip.copy("恋するには遅すぎると言われる私でも、遠い昔に・・・")
    pyautogui.hotkey('ctrl', 'v')
    time.sleep(1)

    print('#--------------【●●をクリックしました】-------------------#')
    pyautogui.moveTo(640, 174, 0.5)
    pyautogui.click(640, 174)
    time.sleep(1)

    print('#--------------【●●をクリックしました】-------------------#')
    pyautogui.moveTo(896, 452, 0.5)
    pyautogui.click(896, 452)
    time.sleep(1)

    print('#--------------【●●をクリックしました】-------------------#')
    pyautogui.moveTo(920, 610, 0.5)
    pyautogui.click(920, 610)
    time.sleep(1)

    print('#--------------【●●をクリックしました】-------------------#')
    pyautogui.moveTo(964, 609, 0.5)
    pyautogui.click(964, 609)
    time.sleep(2)

    print('#--------------【●●をクリックしました】-------------------#')
    pyautogui.moveTo(974, 612, 0.5)
    pyautogui.click(974, 612)
    time.sleep(4)
Пример #54
0
for i in range(4):
    print(x)
    time.sleep(1)
    x -= 1
print('Executing!')
pyautogui.click(773, 1051)
random_key = ['w', 'a', 's', 'd']

pyautogui.hotkey('enter')
pyautogui.hotkey('enter')
pyautogui.hotkey('e')
while True:
    sq = pyautogui.locateAllOnScreen('square1.png', confidence=0.5)
    sq = list(sq)
    for i in range(0, len(sq), 25):
        pyautogui.moveTo(pyautogui.center(sq[i]))
        #pyautogui.moveTo(pyautogui.center(i))
    if len(sq) == 0:
        x = choice(random_key)
        y = choice(random_key)
        z = choice(random_key)
        a = choice(random_key)
        pyautogui.keyDown(x, 4)
        pyautogui.keyDown(y, 5)
        pyautogui.keyDown(z, 3)
        pyautogui.keyDown(a, 2)
        pyautogui.keyUp(x)
        pyautogui.keyUp(y)
        pyautogui.keyUp(z)
        pyautogui.keyUp(a)
    upgrade_button_1 = pyautogui.locateOnScreen('Upgrade1.png', confidence=0.7)
import pyautogui
import time

pyautogui.FAILSAFE = False
while True:
    time.sleep(15)
    for i in range(0, 100):
        pyautogui.moveTo(0, i * 5)
    for i in range(0, 3):
        pyautogui.press('shift')
Пример #56
0
 def click(self, button=MouseButton.LEFT, y=None, x=None, duration=0.25):
     if self.game_is_focused:
         pyautogui.moveTo(x, y, duration=duration)
         pyautogui.click(button=self.mouse_buttons.get(button.name, "left"))
Пример #57
0
def moveMouseToPosition(pos, gameWindow):
    newPosX = pos[0]
    newPosY = pos[1]
    newPosX += gameWindow[0]
    newPosY += gameWindow[1]
    pyautogui.moveTo(newPosX, newPosY)
Пример #58
0
        (x, y, w, h) = frame(scpt.call('lastchild'))
        if abs(w - pw) > 5:
            while x + w > Px + Pw:
                pyautogui.hscroll(-10)
                (x, y, w, h) = frame(scpt.call('lastchild'))
            pyautogui.moveTo(x + w - 1, y + h / 2)
            pyautogui.dragTo(x + pw - 1, y + h / 2, button='left')

    if lastforce != force:
        scpt.call('setforce', force)

    lastforce = force
    lastw = pw


scpt.call('brint_to_front')
scpt.call('setxzoom')  #so that we have a fixed width
time.sleep(1)
(Px, Py, Pw,
 Ph) = frame(scpt.call('parentframe'))  #we now know which part are shown now
pyautogui.moveTo(Px + Pw / 2, Py + Ph / 2)
deleteall()

p = getP()
idx = 1
while p != False:
    print 'insert', p
    insertP(p, idx)
    idx += 1
    p = getP()
Пример #59
0
import pyautogui

pyautogui.moveTo(1372, 670)  # move mouse to the window
pyautogui.dragTo(1372, 670, button='left')  # focus the window
pyautogui.click(1372, 670, button='left')  # simulate left click
def move_screen_centre():
    w = gui.size().width
    h = gui.size().height
    gui.moveTo(w / 2, h / 2, 1)
    return