AutoHotkey 1.1.33.10 Main Window Displaying Unexpectedly

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ncbrowns
Posts: 3
Joined: 03 Dec 2021, 17:07

AutoHotkey 1.1.33.10 Main Window Displaying Unexpectedly

03 Dec 2021, 17:23

[Moderator's note: Topic moved from Bug Reports.]

I have an AutoHotkey script that I run in the background that binds Win-Period to pop up a main menu:

Code: Select all

;;; Win-Period:  Pop up the root menu.
#.::
  ; Hack to try to ensure mouse focus, as described at:
  ; https://autohotkey.com/board/topic/101457-menu-loses-focus-ignores-keystrokes-sometimes/
  Sleep 250
  MouseGetPos MouseX, MouseY
  MouseMove, %MouseX%, %MouseY%, 0
  Menu Root, show, %MouseX% - 30, %MouseY% - 30
  return
What I'm seeing now is that when I hit the key sequence to show my "root" menu, it also unexpectedly opens the script's main window. When this happens, my root menu is on top, the AHK main window is below this, and my desktop and all other windows are below that. The main window stays up until I close it, even after a menu item is selected or the menu is dismissed. Also, when this happens, if I right click the AutoHotkey tray icon, it will show the main window in addition to popping up the application's context menu.

I tried using a simpler approach to popping up my menu by replacing the logic above with "Menu Root, show" but that had no effect.

This failure is intermittent, but once it starts happening, it happens 100% of the time I pop up my menu. If I close and restart my AutoHotkey script, the problem persists. This first happened to me ~2-3 months ago (on Windows 10 64-bit) and stopped happening a day or two later. It is now happening to me again on a new system using Windows 11, after my script had been working fine for nearly two months.

Any ideas what might be going on here?
Last edited by ncbrowns on 04 Dec 2021, 11:08, edited 1 time in total.
joefiesta
Posts: 497
Joined: 24 Jan 2016, 13:54
Location: Pa., USA

Re: AutoHotkey 1.1.33.10 Main Menu Displaying Unexpectedly

04 Dec 2021, 09:59

well, I can hardly test it. It shows an error at line 8. "menu does not exist."

need some more of your code apparently.
ncbrowns
Posts: 3
Joined: 03 Dec 2021, 17:07

Re: AutoHotkey 1.1.33.10 Main Menu Displaying Unexpectedly

04 Dec 2021, 11:16

joefiesta wrote:
04 Dec 2021, 09:59
well, I can hardly test it. It shows an error at line 8. "menu does not exist."

need some more of your code apparently.
I wasn't expecting anyone to test my little snippet. I run this script on four systems and it works nearly 100% of the time. Other than the surprise appearance of the main window, the menu itself was still working fine both times where I have seen this problem. So I seriously doubt that anyone would be able to just run the script once and reproduce the failure.

I was just posting the snippet to show what was being triggered when the main window appeared, in case someone had actually seen a problem like this before and had any idea what was going on.
User avatar
lmstearn
Posts: 694
Joined: 11 Aug 2016, 02:32
Contact:

Re: AutoHotkey 1.1.33.10 Main Window Displaying Unexpectedly

07 Dec 2021, 05:44

Hi @NCBrowns, and welcome to AHK. :)
If posting at the AHK Bug Report thread, they actually want an MVCE to isolate some bug in AHK code. This looks more like a request for help, know that you are very welcome to post over at Ask For Help, hopefully with a little more info describing the issue, so others can repro the issue on their own systems.
Did you bind the right, left Win keys, or both? Try binding to something else than period?
It might also boil down to something like different AHK versions in the z-order window handling in the different systems.
:arrow: itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH
ncbrowns
Posts: 3
Joined: 03 Dec 2021, 17:07

Re: AutoHotkey 1.1.33.10 Main Window Displaying Unexpectedly

07 Dec 2021, 12:22

lmstearn wrote:
07 Dec 2021, 05:44
Hi @NCBrowns, and welcome to AHK. :)
If posting at the AHK Bug Report thread, they actually want an MVCE to isolate some bug in AHK code. This looks more like a request for help, know that you are very welcome to post over at Ask For Help, hopefully with a little more info describing the issue, so others can repro the issue on their own systems.
I wasn't sure whether I should post under "Bug Reports" or "Ask for Help". I went with "Bug Reports" since it feels like the behavior I'm seeing is an AHK bug rather than some issue with my script.

Sadly, the issue is not readily reproducible, so it's difficult to file a high quality bug report. I had a consistent repro that I could have experimented with at the time I posted this Friday afternoon, but it looks like my IT organization pushed some updates over the weekend and rebooted my system. After the reboot, the problem has gone away again. Based on my prior experience it may be several months before I see anything like this again.
Did you bind the right, left Win keys, or both? Try binding to something else than period?
I did not experiment with alternate bindings. I did discover that (when I had this issue), right clicking on the AHK system tray icon would also unexpectedly bring up the main window behind the AHK context menu. (This happens even before I selected anything from the context menu.)
It might also boil down to something like different AHK versions in the z-order window handling in the different systems.
All four of my systems are using the same AHK version. I don't think the issue is related to the z-order of the windows, since the main window is not supposed to be visible at all.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Rohwedder and 239 guests