Window doesn't refocus after input box closes.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
KilliK
Posts: 255
Joined: 10 Mar 2016, 21:19

Window doesn't refocus after input box closes.

12 Aug 2017, 15:26

Hello.

I have created a small loop script for the videogame Hearthstone*, to automate the purchase of multiple card packs.
I have set the script to only work while the game is active and in windowed mode.
The script asks to set the number of loops, with the below command:

Code: Select all

InputBox, times, Enter number of loops,,,280,100
When the input box appears, the game's window doesnt minimize, it simply stays in the background of the screen while the input box is in focus in front.
so far so good.

Here is the problem though:

After I insert the number and the input box closes, the game's window does not regain focus. Because of that, the script doesnt continue.
I tried to activate the game's window, with Send !Esc, Send !TAB, WinActivate ..., but none of that works. The game's window will stay inactive, or it will get minimized and some other background app will gain focus.
When the input box closes, AHK Spy gives me these values:
ahk_class
ahk_exe
Does anyone know what causes this and how to fix it? to make the game active after the input box closes?

*its WinTitle info is:

Code: Select all

Hearthstone ahk_class UnityWndClass ahk_exe Hearthstone.exe
OS: Windows 10 Pro x64
neomulemi6
Posts: 216
Joined: 30 Jun 2016, 06:01

Re: Window doesn't refocus after input box closes.

12 Aug 2017, 17:07

I had this problem once, with a different game. I solved it by sending a mouse click to the window after the input box closes.
User avatar
KilliK
Posts: 255
Joined: 10 Mar 2016, 21:19

Re: Window doesn't refocus after input box closes.

13 Aug 2017, 13:21

ok, I managed to fix it. it was a settimer which was causing the problem. I temporarily disable it before the input box appears, and all is well.
thank you all for your help.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada, jollyjoe and 137 guests