reggx / pydirectinput_rgx Goto Github PK
View Code? Open in Web Editor NEWThis project forked from learncodebygaming/pydirectinput
Python mouse and keyboard input automation for Windows using Direct Input.
License: Other
This project forked from learncodebygaming/pydirectinput
Python mouse and keyboard input automation for Windows using Direct Input.
License: Other
Methods like move(), moveTo() and moveRel() have duration param, which doesn't seem to work correctly. Whenever it is set to 0, then the cursor is moved immediately, but whenever I pass any value to it, it always moves in the same fast way. What is more, whenever the cursor is close to the edge of the screen, the duration parameter starts to be respected and the cursor just moves to the planned direction for the given amount of duration seconds.
Windows 10, tried Python 3.7 and 3.11
Please, tell me if I can provide you more info about my system, thanks
Even just importing press from pydirectinput_rgx or core pydirectinput from @learncodebygaming like in the following example:
from pydirectinput import press
import pyautogui
pyautogui.moveTo(1, 5, 0)
causes:
Traceback (most recent call last):
File "C:\Users\admin\Desktop\pyautogui_test.py", line 6, in <module>
pyautogui.moveTo(1, 5, 0)
File "C:\Program Files\Python\Lib\site-packages\pyautogui\__init__.py", line 593, in wrapper
failSafeCheck()
File "C:\Program Files\Python\Lib\site-packages\pyautogui\__init__.py", line 1733, in failSafeCheck
if FAILSAFE and tuple(position()) in FAILSAFE_POINTS:
^^^^^^^^^^
File "C:\Program Files\Python\Lib\site-packages\pyautogui\__init__.py", line 767, in position
posx, posy = platformModule._position()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python\Lib\site-packages\pyautogui\_pyautogui_win.py", line 344, in _position
ctypes.windll.user32.GetCursorPos(ctypes.byref(cursor))
ctypes.ArgumentError: argument 1: TypeError: expected LP__POINT instance instead of pointer to POINT
Apparently years ago this was a bug in pyautogui (pywinauto/pywinauto#788), but according to the issue ticket it was fixed, somehow importing pydirectinput_rgx in that specific way "unfixes" it and I'm not sure why.
using py pyautogui Version: 0.9.54
and pydirectinput_rgx Version: 2.0.7
on python 3.11.2 with Windows 11 - x64 bit
Edit: According to this issue moses-palmer/pystray#93 (comment) you need to create a new instance of windll or something ๐คท๐ผ
write() doesn't recognise shifted characters.
if you need to write ABCD
or !@#$
, you're supposed to make your own def with like:
def key_write(text, delay=default_delay):
for each in text:
key_press_for_write(each, timer=0.02, delay=0)
time.sleep(delay)
def key_press_for_write(key, timer=0.1, delay=default_delay):
shift_flag = False
if key in "~!@#$%^&*()_+" or string.isupper(key):
shift_flag = True
if shift_flag:
hold_shift(0)
key_down(key, 0)
time.sleep(timer)
key_up(key, 0)
if shift_flag:
unhold_shift(0)
time.sleep(delay)
(some methods are customised for my personal uses, but I am sure you can recognise what these are for)
Hello,
I would like to have some feedback on the following questions:
All these questions because I've tried some quick examples and never got the primary / left clicks working with Python 3.11.2 on Windows 10. Running the code with admin privileges did not help. The examples (mouse moves and clicks) worked fine for everything but games with either PyAutoGUI, PyDirectInput and PyDirectInput-RGX.
Thanks and regards,
Mac
Hi thanks so much for your work updating pydirectinput and I was excited to find it on PyPi.
I submitted a PR to this project, wingman-ai, to implement pydirectinput-rgx (pyautogui is still used in the alternative for mac users of the project), and encountered unexpected behavior with relative mouse movement. Wondering if this is user error or a bug.
You can see the most recent PR here: ShipBit/wingman-ai@3569bff
I was having an issue where using the move(x,y) or move(x,y,duration=[duration]) functions were not using relative movement. If, for example, the current mouse position was 900,600, and x,y was 0, 100, the cursor would move to 0,100 not 900,700. I tested by running print statements of the current mouse position (position()), ensuring x, y were integers, and then printing the final mouse postion, and with 0,-100; 100,0; -100,0; 0,100 and each had the same issue when running move(x,y) or move(x,y,duration) with putting the cursor up at the top left corner of the screen with various offsets. I also tried setting duration to 0.5, 1, and 2 and although I could see the cursor moving slower, it still went to the same place.
As you can see in the PR, I reverted by calculating a new absolute position manually and then using the moveTo function instead, and that works fine.
Is this a bug or user error? Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.