AutoHotkey Help does not remember being opened maximized Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
A Keymaker
Posts: 454
Joined: 31 May 2022, 13:46
Location: Donjon du Château de Mérovingien

AutoHotkey Help does not remember being opened maximized

Post by A Keymaker » 04 Feb 2023, 06:30

AutoHotkey's help utilizes HTML Help - mine is described as HTML Help Control Version 10.0 in it's About and in Task Manager is listed as hh.exe

And every time I click the maximize icon in the top right corner of its window - and yet every next time it does not remember being maximized: it's around 99% of the max size and has almost the same centered position, but nevertheless it requires manual clicking

How can I make that change be remembered? Or how to make hh.exe open always maximized? Or how to tell AutoHotkey to tell hh.exe to open maximized?


I am using AutoHotkey 1.1.36.02 on Windows 10 Enterprise 20H2 19042.746 x64
Last edited by A Keymaker on 04 Jul 2023, 04:20, edited 2 times in total.

User avatar
A Keymaker
Posts: 454
Joined: 31 May 2022, 13:46
Location: Donjon du Château de Mérovingien

Re: AutoHotkey Help does not remember being opened maximized

Post by A Keymaker » 16 Feb 2023, 14:39

I have tried using an AHK file

Code: Select all

SetTitleMatchMode, 2

#IfWinActive, "AutoHotkey Help"
    WinWaitActive, "AutoHotkey Help"
    Sleep 1111
    SendInput {LAlt Down}{Space Down}{Space Up}{LAlt Up}
    Sleep 555
    SendInput x
#IfWinActive
and

Code: Select all

IfWinActive,AutoHotkey Help
{
    WinMaximize
    return
}
but they do not work - window of AutoHotkey Help is still not opened maximized

User avatar
A Keymaker
Posts: 454
Joined: 31 May 2022, 13:46
Location: Donjon du Château de Mérovingien

Re: AutoHotkey Help does not remember being opened maximized

Post by A Keymaker » 04 Jul 2023, 03:39

I have managed to come up with this code

Code: Select all

#NoEnv
#Persistent   ; This affects all codes from the file
#SingleInstance Force
SetTitleMatchMode 2

prevWindowState := ""   ; Stores the previous state of the AHK Help window

Loop
{
    IfWinExist, AutoHotkey Help
    {
        WinGet, winState, MinMax, AutoHotkey Help   ; Gets the current state of the window
        If (winState != prevWindowState)   ; Checks if state of the window has changed
        {
            prevWindowState := winState
            If (winState != 1)   ; Maximize the window if it is not maximized
            {
                WinMaximize, AutoHotkey Help
            }
        }
    }
    Sleep 1111
}
However it works only if I right click the Help entry from context menu in Tray for that very AHK file that is holding this script. And I cannot put it in my bulk AHK file because of the #Persistent affecting all codes from it

Thee very same problem is with this simplier approach

Code: Select all

#Persistent   ; This affects all codes from the file
SetTimer, CheckHelp, 1111
return

CheckHelp:
IfWinExist, AutoHotkey Help
{
    WinActivate, AutoHotkey Help
    WinWaitActive, AutoHotkey Help
    WinMaximize
    SetTimer, CheckHelp, off
}
return

And so: am I correct to assume that without using a trigger or continuously checking for changes, it is simply not possible to detect an opening of the AutoHotkey Help window using AHK script alone, as AutoHotkey does not have an event-driven mechanism to monitor window creation directly?
Last edited by A Keymaker on 04 Jul 2023, 04:28, edited 2 times in total.

User avatar
A Keymaker
Posts: 454
Joined: 31 May 2022, 13:46
Location: Donjon du Château de Mérovingien

Re: AutoHotkey Help does not remember being opened maximized  Topic is solved

Post by A Keymaker » 05 Jul 2023, 17:30

Finally I have come up with an A-OK working workaround

Code: Select all

#NoTrayIcon   ; Hides the icon of this script in Tray notification area of Windows

SetTitleMatchMode, 2
Loop
{

;;; IfWinExist, AutoHotkey Help   ;  This works - but makes impossible to be used in an AHK file that has in its name "AutoHotkey Help"
    IfWinExist, AutoHotkey Help
    {
        WinGetTitle, winTitle, AutoHotkey Help
        If (winTitle = "AutoHotkey Help")

       {
            WinMaximize
            Break   ; This stops this script after first detection of the AutoHotkey Help window - i.e. it makes possible to adjust size of that window when needed by closing the AHK holding this script
        }
    }
    Sleep, 333   ; For a quick applying the optimal value seems to be ~250 milliseconds
}

Post Reply

Return to “Ask for Help (v1)”