How can I programmatically control mouse motion and clicks with MATLAB?
Mostrar comentarios más antiguos
I am creating a demo using MATLAB and I would like to programmatically move and click the mouse to demonstrate my application.
Respuesta aceptada
Más respuestas (1)
Unfortunately, this is one area that MATLAB is behind other alternatives, such as Python. If you know how to code in Python, you can easily do it by using the following command:
import win32api, win32con
def click(x,y):
win32api.SetCursorPos((x,y))
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
click(10,10)
Categorías
Más información sobre Data Type Identification en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!