autopilot-rs / autopy

A simple, cross-platform GUI automation module for Python and Rust.
https://www.autopy.org/
Apache License 2.0
846 stars 88 forks source link

More keys #63

Open Jah-On opened 3 years ago

Jah-On commented 3 years ago

Hi, Thanks for making this super fast module! I did notice a few keys were missing in the API reference such as num keys. Could you please add support for all 101 keys? Thanks!

wvupike2006 commented 3 years ago

I second this request, as I am making a tool that plays the game we make at work. I just started programming in Rust, but come from a decent foundation in c++ so I may try implement it myself, and submit a PR. It doesn't look to terribly difficult to add some extra keys.

Jah-On commented 3 years ago

Thanks dude!

wvupike2006 commented 3 years ago

@Jah-On Were you using this for a rust program as well as python, or only on python?

I figured out a solution but if you are in a hurry i figured i could just tell you. If it is python, use pydirectinput for keyboard functions as pyautogui fails if you are having your bot play a game with directx. Autopy is the best solution for image recognition, so use both and only import the function for keys and it should work great.

As for rust, I have a workaround as well as a solution that i would like to integrate into this project, but it may be a few days. I can give you the workaround if you need it for rust, just let me know.

One last bit of advice that i wish i had came to right away, is if you need your program to work on multiple monitors, consistently, use get_color() on unique pixels and then take the max of the 3 rgb values to account for slight variance. return true if pixel colors match to check your screen state and minimize the amount of photos needed.

Jah-On commented 3 years ago

I need it for python. It looks like pydirectinput is Windows only. I'm using it to make a cross platform remote desktop app, not a game bot ha ha. When do you think you could add the rust code? I would appreciate it if it could be done within 2-3 weeks but would still be grateful if it ended up being longer than that. Thanks!

Jah-On commented 3 years ago

@wvupike2006