Most viable option is using winim and just searching on internet how to work with Win32 API.
Another way is using available example in rosetta code simulating keyboard and add/change some codes to
type
MouseEvent = enum
meMove = 0x0001
meLeftDown = 0x0002
meLeftUp = 0x0004
meAbsolute = 0x8000
proc initMouse: Input =
result.`type` = clong itMouse
var mouse = MouseInput(mouseData: 0, dx: 0, dy: 0,
dwFlags: meAbsolute.culong or meMove.culong)
result.hwin = InputUnion(mi: mouse)
proc main =
var mouse = initMouse()
# set mouse xy pixel position
mouse.hwin.mi.dx = clong 35_000
mouse.hwin.mi.dy = clong 35_000
# move it to intended position
sendInput(1, addr mouse, sizeof(mouse).cint)
sleep 1000
# flag to press the left mouse button
mouse.hwin.mi.dwFlags = meAbsolute.culong or meLeftDown.culong or
meLeftUp.culong
# actually pressing the left mouse button
sendInput(1, addr mouse, sizeof(mouse).cint)
main()