0
votes
SplashImageText:
{       
    SplashImage,    ,   B FS%SplashImageTextSize% W1920 CWblack CTwhite,    %SplashImageText%
    WinSet, TransColor, Black   150,    [script name].ahk
    SetTimer,   KillSplashImage,    -%SplashImageTextTime%
}
Return

This displays white text in the middle of the screen. It's useful for indicating stuff without being as intrusive as MsgBox. However, the text can be clicked on and thus it blocks clicks.

What I've found so far is http://www.autohotkey.com/board/topic/53209-make-window-transparent-and-click-through-it/ but I don't fully understand it and my attempt to make it work on the text doesn't seem to work. Normally, the text doesn't seem to have an ahk_id. By adding the "M2" parameter to SplashImage, I am able to get some more info from the text. The best constant thing seems to be that its ahk_class is "AutoHotKey2". So, I modified Wicked's script by replacing ahk_id with ahk_class thusly:

/*
WinSet_Click_Through - Makes a window unclickable.

I - class of the window to set as unclickable.

T - The transparency to set the window. Leaving it blank will set it to 254. It can also be set On or Off. Any numbers lower then 0 or greater then 254 will simply be changed to 254.

If the window class doesn't exist, it returns 0.
*/

WinSet_Click_Through(I, T="254") {
    IfWinExist, % "ahk_class " I
    {
        If (T == "Off")
        {
            WinSet, AlwaysOnTop, Off, % "ahk_class " I
            WinSet, Transparent, Off, % "ahk_class " I
            WinSet, ExStyle, -0x20, % "ahk_class " I
        }
        Else
        {
            WinSet, AlwaysOnTop, On, % "ahk_class " I
            If(T < 0 || T > 254 || T == "On")
                T := 254
            WinSet, Transparent, % T, % "ahk_class " I
            WinSet, ExStyle, +0x20, % "ahk_class " I
        }
    }
    Else
        Return 0
}

And I put WinSet_Click_Through(AutoHotKey2, T="254") after SplashImage in the sub-routine, but it doesn't affect the text.

Update: OK, so I got it working in one way by using ahk_exe and targeting AutoHotKey.exe itself, but I was hoping to target just the text and not any AutoHotKey.exe. I'm wondering why ahk_class doesn't work.

1

1 Answers

1
votes

You can just use WinTitle instead, which is the default matching behaviour. Remove "ahk_class " in the script.

/*
WinSet_Click_Through - Makes a window unclickable.

I - title of the window to set as unclickable.

T - The transparency to set the window. Leaving it blank will set it to 254. It can also be set On or Off. Any numbers lower then 0 or greater then 254 will simply be changed to 254.

If the window title doesn't exist, it returns 0.
*/

WinSet_Click_Through(I, T="254") {
    IfWinExist, % I
    {
        If (T == "Off")
        {
            WinSet, AlwaysOnTop, Off, % I
            WinSet, Transparent, Off, % I
            WinSet, ExStyle, -0x20, % I
        }
        Else
        {
            WinSet, AlwaysOnTop, On, % I
            If(T < 0 || T > 254 || T == "On")
                T := 254
            WinSet, Transparent, % T, % I
            WinSet, ExStyle, +0x20, % I
        }
    }
    Else
        Return 0
}

I hope this targeting is specific enough.