WinGet,,List missing visible windows (Minecraft)

Ask gaming related questions (AHK v1.1 and older)
TotalSchnurz
Posts: 3
Joined: 05 Apr 2021, 11:28
Contact:

WinGet,,List missing visible windows (Minecraft)

05 Apr 2021, 12:35

I'm working on a small AHK client script for parental controls [1]. The idea is to query all window titles and send them to a server, which tracks time spent and asks the client to close a window if the budget is used up.

This works fine for all programs I've tried, except for Minecraft. I'm using this:

Code: Select all

DetectHiddenWindows, On ; should not be necessary, the Minecraft window is visible
WinGet, ids, List
This call returns all windows but not the Minecraft window. It doesn't even return some other/generic window instead. It's like the Minecraft window is invisible to AHK.

I suspect that this is because Minecraft is an "app", not a regular program. But then again, other apps, like calculator or weather work fine. They do have the problem that they're all run by the ApplicationFrameHost.exe process, but I only (mainly) care about the window title.

Is this a known problem? Is there a workaround, or do I need to switch to C#? :shock:

-Jörg

[1] https://github.com/zieren/kids-freedom-control/blob/master/ahk/kfc.ahk
Last edited by BoBo on 07 Apr 2021, 10:33, edited 1 time in total.
Reason: Moved to Gaming section.
User avatar
mikeyww
Posts: 27118
Joined: 09 Sep 2014, 18:38

Re: WinGet,,List missing visible windows (Minecraft)

05 Apr 2021, 13:34

How do you know that your window is not being found? Is there more to your script?
TotalSchnurz
Posts: 3
Joined: 05 Apr 2021, 11:28
Contact:

Re: WinGet,,List missing visible windows (Minecraft)

07 Apr 2021, 09:59

Yes, the script is longer (see here: https://github.com/zieren/kids-freedom-control/blob/master/ahk/kfc.ahk#L283), I'm showing a Gui with the results. I can see all the other windows but not the Minecraft window.
User avatar
mikeyww
Posts: 27118
Joined: 09 Sep 2014, 18:38

Re: WinGet,,List missing visible windows (Minecraft)

07 Apr 2021, 12:08

Try the following.

Code: Select all

MsgBox, % winTitles()

winTitles() {
 WinGet, win, List
 Loop, %win% {
  WinGetTitle, wTitle, % "ahk_id " win%A_Index%
  list .= wTitle > "" ? "`n" wTitle : ""
 }
 Return SubStr(list, 2)
}
TotalSchnurz
Posts: 3
Joined: 05 Apr 2021, 11:28
Contact:

Re: WinGet,,List missing visible windows (Minecraft)

07 Apr 2021, 12:49

The problem does not seem to be with retrieving the window data, because that works for all other windows. I've added the process name to your code, result is attached. You can see the Minecraft window in the task bar, and it's missing in the AHK output.
Attachments
ahk-screenshot.png
ahk-screenshot.png (285.54 KiB) Viewed 1029 times
User avatar
mikeyww
Posts: 27118
Joined: 09 Sep 2014, 18:38

Re: WinGet,,List missing visible windows (Minecraft)

07 Apr 2021, 13:04

Although I have never used Minecraft, I did open it today for the first time to test this, and was unable to reproduce your issue. Perhaps others here on the forum will have more ideas, as Minecraft is so widely used among forum readers. You could try running the script in admin mode; I do not know whether that will change the results, but it could be worth a go.
n0thing
Posts: 2
Joined: 26 Jul 2022, 16:52

Re: WinGet,,List missing visible windows (Minecraft)

26 Jul 2022, 17:08

mikeyww wrote:
07 Apr 2021, 13:04
Although I have never used Minecraft, I did open it today for the first time to test this, and was unable to reproduce your issue. Perhaps others here on the forum will have more ideas, as Minecraft is so widely used among forum readers. You could try running the script in admin mode; I do not know whether that will change the results, but it could be worth a go.
I have a problem similar to OP, but not with Minecraft.

I've had success implementing an alt-tab replacement (https://stackoverflow.com/a/36008086) in my script. The problem comes when I try to 'alt-tab' into a tab that is within a (Stardock) Groupy group. `WinGet, id, list` can only find the active tab/window in a group but not every window that's within the group. Normal alt-tab works fine of course.
User avatar
mikeyww
Posts: 27118
Joined: 09 Sep 2014, 18:38

Re: WinGet,,List missing visible windows (Minecraft)

27 Jul 2022, 04:24

Welcome to this AutoHotkey forum!

Since you have some Continue lines, you can determine whether those conditions are being met. If they are, you can trace the condition to a specific line, to understand which style the "missing" window has. Adding a few MsgBox lines to your script can accomplish this in a few minutes. You can add a line to detect hidden windows.

Instead of posting a link to your script, you can post your script in this forum, to ease the work that is required here, while improving the readability of this thread.
n0thing
Posts: 2
Joined: 26 Jul 2022, 16:52

Re: WinGet,,List missing visible windows (Minecraft)

28 Jul 2022, 15:10

mikeyww wrote:
27 Jul 2022, 04:24
Adding a few MsgBox lines to your script can accomplish this in a few minutes. You can add a line to detect hidden windows.
Tried, there are some windows with id but non-existent wintitle. Not sure if that's the issue...
Same deal with the other script I tried (https://www.autohotkey.com/boards/viewtopic.php?t=99157)
mikeyww wrote:
27 Jul 2022, 04:24
Instead of posting a link to your script, you can post your script in this forum, to ease the work that is required here, while improving the readability of this thread.
I'll do both next time

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 33 guests