ilpersi / BHBot

A bot that automates a game called Bit Heroes
GNU General Public License v3.0
28 stars 32 forks source link

Bot causing chromium window to take focus #149

Closed mental159 closed 4 years ago

mental159 commented 4 years ago

Describe the bug It seems recently when the bot is running the chromium window takes focus, regardless of whether it is hidden or not. I believe this started with the last version.

I used to be able to run the bot in the background and do other things on my system. However, now it is impossible as the focus gets pulled to the chromium window every few seconds and any typing starts to get added to the front of the url. Hitting enter then obviously changes the site and causes the bot to crash.

To Reproduce Steps to reproduce the behavior:

Install
run BHBot.bat

Desktop (please complete the following information):

OS: windows 10
Browser Chromium
Version 44
ilpersi commented 4 years ago

We did not change anything in how the browser is managed. What you see is more or less the expected behavior and it is not possible to change it as the browser interaction is managed by a dedicated library not developed by us.

Did you have the chance to review the documentation on the Home Page? I am pasting it here.

Important

  • While bot is running, do not interfere with the Chromium window that the bot has open via chromedriver. That means don't open menus and click around since that may confuse the bot and it could fail to do its tasks (which could lead to crashing it).
  • If you want to continue using your computer while running the bot use, the 'hide' command to minimize the window. The bot clicks on certain buttons and cues and expects certain thing to pop up, and if they don't (due to user interaction), then it will fail to function properly.
  • If you are running the bot in Windows, you may want to run it under a separate account in order for it to not interfere with your work.
D3mi-God commented 4 years ago

I had the same issue and has recently found a solution for it: https://stackoverflow.com/questions/46035014/how-can-it-be-possible-to-steal-focus-so-easily Basically you need to change ForegroundLockTimeout back to its default value (200000 in decimal or 30d40 in hexa) in the registry HKCU\Control Panel\Desktop, then restart your PC. Hope it helps

mental159 commented 4 years ago

It was set to 200000 already, but changing the setting to a slightly larger number and saving seems to have corrected the issue. Thanks!

On Sat, Feb 29, 2020 at 8:01 AM D3mi-God notifications@github.com wrote:

I had the same issue and has recently found a solution for it:

https://stackoverflow.com/questions/46035014/how-can-it-be-possible-to-steal-focus-so-easily Basically you need to change ForegroundLockTimeout back to its default value (200000 in decimal or 30d40 in hexa) in the registry HKCU\Control Panel\Desktop. Hope it helps

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/ilpersi/BHBot/issues/149?email_source=notifications&email_token=AMTQRZQH3UEXW7QBB7HJLTTRFEKMRA5CNFSM4KTDQ4TKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENL22QI#issuecomment-592948545, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMTQRZWN2WOIYYSNIEXFBXTRFEKMRANCNFSM4KTDQ4TA .