Skip to content Skip to sidebar Skip to footer

Python3 Move Mouse In Directx Games

I'm trying to build create a script that does a few action inside an DirectX game. I've got everything working exept for moving the mouse. Is there any module avalable that can mov

Solution 1:

I used pynput once in Python 2.7. I just checked under Python 3.7 and it moves the cursor alright. Sample code from linked source:

from pynput.mouse import Button, Controller

mouse = Controller()

# Read pointer positionprint('The current pointer position is {0}'.format(
    mouse.position))

# Set pointer position
mouse.position = (10, 20)
print('Now we have moved it to {0}'.format(
    mouse.position))

# Move pointer relative to current position
mouse.move(5, -5)

# Press and release
mouse.press(Button.left)
mouse.release(Button.left)

# Double click; this is different from pressing and releasing# twice on Mac OSX
mouse.click(Button.left, 2)

# Scroll two steps down
mouse.scroll(0, 2)

Edit: Just successfully tested in a DirectX game.

Solution 2:

Use a freeware App called sikulix. It will do wonders for you

Post a Comment for "Python3 Move Mouse In Directx Games"