Simulate mouse movement in Ubuntu

前端 未结 2 750
南旧
南旧 2021-02-04 07:22

Problem

Am looking to automatically move the mouse cursor and simulate mouse button clicks from the command-line using an external script. Am not lookin

2条回答
  •  Happy的楠姐
    2021-02-04 07:48

    1. Download xaut for Python
    2. Follow the README instructions
    3. Run:
      sudo apt-get install swig x11proto-xext-dev libx11-dev libxtst-dev
      cd /usr/local/src
      tar zxf xaut-0.2.0.tar.gz
      ./configure
      
    4. Edit src/Makefile
    5. Change the CFLAGS line as follows:
      CFLAGS = -Wall -fPIC -fno-stack-protector
    6. Run:
      make
      
    7. Copy /usr/local/src/xaut-0.2.0/python/build/lib/* to a new directory.
    8. Change to that new directory.
    9. Copy and paste the following script into mm.py:
      import xaut
      mouse = xaut.mouse()
      delay mouse.move_delay( 100 )
      mouse.move( 500, 500 )
      
    10. Run the script:
      python mm.py

提交回复
热议问题