Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem 2: Bot controls mouse and keyboard. It's inconvenient #15

Open
9-9-9-9 opened this issue Aug 30, 2021 · 6 comments
Open

Problem 2: Bot controls mouse and keyboard. It's inconvenient #15

9-9-9-9 opened this issue Aug 30, 2021 · 6 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@9-9-9-9
Copy link
Owner

9-9-9-9 commented Aug 30, 2021

This bot currently using java.awt.Robot class to send mouse click and press keyboard and it's inconvenient.

I would like to migrate to use PostMessage or similar APIs so users can use their device while doing bot.

If anyone have interested in developing this bot and can help me to resolve/implement this feature, please go on.
Targets: Windows (7+) & Linux (or at least Ubuntu)

@9-9-9-9 9-9-9-9 added bug Something isn't working help wanted Extra attention is needed enhancement New feature or request and removed bug Something isn't working labels Aug 30, 2021
@9-9-9-9
Copy link
Owner Author

9-9-9-9 commented Sep 4, 2021

Bad news:
I already tested to send PostMessage to Steam client (BitHeroes.exe) on Windows but it doesn't work while the window is inactive. Only effective when window has been set to foreground window

@ilpersi
Copy link

ilpersi commented Nov 19, 2021

What you can do on Windows is to use native User32 SendMessage API via JNA.

Of course this would be windows specific and on Linux you should probably use something else. This will work even if window is running in the background. The only caveat is that the windows you want to send messages to is not minimized.

I used to do this in a proof of concept for my old BHBot and you can get a sample of the code here (clickInGame method).

@9-9-9-9
Copy link
Owner Author

9-9-9-9 commented Nov 20, 2021

What you can do on Windows is to use native User32 SendMessage API via JNA.

Of course this would be windows specific and on Linux you should probably use something else. This will work even if window is running in the background. The only caveat is that the windows you want to send messages to is not minimized.

I used to do this in a proof of concept for my old BHBot and you can get a sample of the code here (clickInGame method).

I have tried it and wrote before your comment

Bad news:
I already tested to send PostMessage to Steam client (BitHeroes.exe) on Windows but it doesn't work while the window is inactive. Only effective when window has been set to foreground window

As long as BH Client need to be foreground window, all are useless. What I want to achieve is user can interact with their PC while bot still running

@daredoes
Copy link
Collaborator

I'm thinking of trying to put together an MVP that uses Selenium Mouse/Keyboard Actions to do this:

https://www.selenium.dev/documentation/webdriver/actions_api/mouse/#alternate-button-clicks

@daredoes
Copy link
Collaborator

Nope. Taking screenshots with Selenium, or the web browser, seems to require focus. I can get mouse clicks to work without focus, but that's not enough

@jimmydiesel
Copy link

If you have Windows Pro, you can run RDP and have it logged in on the VM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants