Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pyautogui install

pip3 install pyautogui
Comment

pyautogui install

#type:
py -m pip install pyautogui
#in the terminal
Comment

pyautogui

>>> pyautogui.rightClick(x=moveToX, y=moveToY)
>>> pyautogui.middleClick(x=moveToX, y=moveToY)
>>> pyautogui.doubleClick(x=moveToX, y=moveToY)
>>> pyautogui.tripleClick(x=moveToX, y=moveToY)
Comment

pyautogui

>>> pyautogui.locateOnScreen('looksLikeThis.png')  # returns (left, top, width, height) of first place it is found
(863, 417, 70, 13)
Comment

pyautogui

>>> import pyautogui
>>> pyautogui.FAILSAFE = True
Comment

install pyautogui

 >>> import pyautogui
    >>> screenWidth, screenHeight = pyautogui.size() # Returns two integers, the width and height of the screen. (The primary monitor, in multi-monitor setups.)
    >>> currentMouseX, currentMouseY = pyautogui.position() # Returns two integers, the x and y of the mouse cursor's current position.
    >>> pyautogui.moveTo(100, 150) # Move the mouse to the x, y coordinates 100, 150.
    >>> pyautogui.click() # Click the mouse at its current location.
    >>> pyautogui.click(200, 220) # Click the mouse at the x, y coordinates 200, 220.
    >>> pyautogui.move(None, 10)  # Move mouse 10 pixels down, that is, move the mouse relative to its current position.
    >>> pyautogui.doubleClick() # Double click the mouse at the
    >>> pyautogui.moveTo(500, 500, duration=2, tween=pyautogui.easeInOutQuad) # Use tweening/easing function to move mouse over 2 seconds.
    >>> pyautogui.write('Hello world!', interval=0.25)  # Type with quarter-second pause in between each key.
    >>> pyautogui.press('esc') # Simulate pressing the Escape key.
    >>> pyautogui.keyDown('shift')
    >>> pyautogui.write(['left', 'left', 'left', 'left', 'left', 'left'])
    >>> pyautogui.keyUp('shift')
    >>> pyautogui.hotkey('ctrl', 'c')
Comment

pyautogui

>>> pyautogui.hotkey('ctrl', 'c')  # ctrl-c to copy
>>> pyautogui.hotkey('ctrl', 'v')  # ctrl-v to paste
Comment

pyautogui

>>> pyautogui.typewrite(['a', 'b', 'c', 'left', 'backspace', 'enter', 'f1'], interval=secs_between_keys)
Comment

pyautogui

>>> import pyautogui
>>> pyautogui.PAUSE = 2.5
Comment

pyautogui

>>> pyautogui.typewrite('Hello world!
', interval=secs_between_keys)  # useful for entering text, newline is Enter
Comment

pyautogui

>>> 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
Comment

pyautogui

>>> pyautogui.position()  # current mouse x and y
(968, 56)
>>> pyautogui.size()  # current screen resolution width and height
(1920, 1080)
>>> pyautogui.onScreen(x, y)  # True if x & y are within the screen.
True
Comment

pyautogui

>>> pyautogui.keyDown(key_name)
>>> pyautogui.keyUp(key_name)
Comment

pyautogui

>>> pyautogui.moveTo(x, y, duration=num_seconds)  # move mouse to XY coordinates over num_second seconds
>>> pyautogui.moveRel(xOffset, yOffset, duration=num_seconds)  # move mouse relative to its current position
Comment

pyautogui

>>> pyautogui.scroll(amount_to_scroll, x=moveToX, y=moveToY)
Comment

pyautogui

>>> pyautogui.mouseDown(x=moveToX, y=moveToY, button='left')
>>> pyautogui.mouseUp(x=moveToX, y=moveToY, button='left')
Comment

pyautogui

>>> pyautogui.alert('This displays some text with an OK button.')
>>> pyautogui.confirm('This displays text and has an OK and Cancel button.')
'OK'
>>> pyautogui.prompt('This lets the user type in a string and press OK.')
'This is what I typed in.'
Comment

pyautogui

>>> pyautogui.screenshot()  # returns a Pillow/PIL Image object
<PIL.Image.Image image mode=RGB size=1920x1080 at 0x24C3EF0>
>>> pyautogui.screenshot('foo.png')  # returns a Pillow/PIL Image object, and saves it to a file
<PIL.Image.Image image mode=RGB size=1920x1080 at 0x31AA198>
Comment

pyautogui

>>> for i in pyautogui.locateAllOnScreen('looksLikeThis.png')
...
...
(863, 117, 70, 13)
(623, 137, 70, 13)
(853, 577, 70, 13)
(883, 617, 70, 13)
(973, 657, 70, 13)
(933, 877, 70, 13)
Comment

pyautogui

>>> list(pyautogui.locateAllOnScreen('looksLikeThis.png'))
[(863, 117, 70, 13), (623, 137, 70, 13), (853, 577, 70, 13), (883, 617, 70, 13), (973, 657, 70, 13), (933, 877, 70, 13)]
Comment

pyautogui

>>> pyautogui.locateCenterOnScreen('looksLikeThis.png')  # returns center x and y
(898, 423)
Comment

pyautogui

>>> pyautogui.click(x=moveToX, y=moveToY, clicks=num_of_clicks, interval=secs_between_clicks, button='left')
Comment

PREVIOUS NEXT
Code Example
Python :: convert c++ code to python 
Python :: elevando numero ao quadrado em python 
Python :: Now, we will first look at the simplest way to scan ports with Python 
Python :: how to pull images from android device from usb in python 
Python :: ipython widget display 
Python :: what is norways politics 
Python :: increment numper in python 
Python :: pandas join tables based on column of different length 
Python :: lllll 
Python :: Feature Importance 
Python :: genskill bootcamp amazing python program 
Python :: factors of a number with memoization 
Python :: logarithmic 2d histogram 
Python :: check cudann 
Python :: How to estimate memory of dataset using python command 
Python :: types of methods in oop python 
Python :: générer des valeurs de 0 à n python liste 
Python :: how to find the medium, first, second and third quartile in a pandas data frame 
Python :: leer video con opencv 
Python :: Python String to array using list comprehension 
Python :: logartim normalization python pandas 
Python :: if condition in python 1 
Python :: python arithmetic operation with list 
Python :: how to catch stop itteration in generator as None 
Python :: Python - Cómo cruda la cuerda 
Python :: get opnly second part of multiindex 
Python :: youtube view bot python code pastebin 
Python :: python directed graph 
Python :: moviepy not able to read the image file format 
Python :: precondition error tensorflow predict 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =