Move mouse cursor and click for launching an external application

I want to move the mouse cursor to a certain coordinate and for it to click the left button to launch an external application.

I tried unsuccessfully using standard python code via inserting it to a code block in the builder:

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)

The mouse moved to the coordiane but didn’t cliick.

How do I apply It before my experiment starts?

Thanks.

1 Like