Python Simulation Mouse Key

Source: Internet
Author: User

Let Python automatically manipulate the desktop or application window, click, slide the mouse, enter text, etc.

# coding=utf-8from Pymouse Import pymousefrom pykeyboard import pykeyboardimport time, Randomimport Pyautogui as PAGM = Py Mouse () K = Pykeyboard () x_dim, Y_dim = M.screen_size () # Open Browser, click Baidu Search Box M.click (282, 183) Time.sleep (0.3) # Enter keyword K.type_ String (' Cnblog ') # Enter K.tap_key (K.enter_key) # Blind inside the page while True:    i = Random.uniform ( -10, ten)    m.scroll (2 * I, None, None)    Time.sleep (2)    M.click (+ x * I, + + * i) # get mouse coordinates def GETM_XY ():    try: While        True:            print " Press Ctrl-c to end "            x, y = pag.position ()  # Returns the coordinates of the mouse            posstr =" Position: "+ str (x). Rjust (4) + ', ' + str (y). Rju St (4) Print            posstr  # Printing coordinates            time.sleep (1)            # os.system (' cls ')  # clear screen    except  Keyboardinterrupt:        print ' end .... '

It doesn't feel any use to write it, it is purely a free egg.

Python Simulation Mouse Key

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.