【问题标题】:Is there a way to make SplashImage text click-through?有没有办法让 SplashImage 文本点击?
【发布时间】:2015-07-04 23:43:10
【问题描述】:
SplashImageText:
{       
    SplashImage,    ,   B FS%SplashImageTextSize% W1920 CWblack CTwhite,    %SplashImageText%
    WinSet, TransColor, Black   150,    [script name].ahk
    SetTimer,   KillSplashImage,    -%SplashImageTextTime%
}
Return

这会在屏幕中间显示白色文本。它对于指示内容很有用,而不会像 MsgBox 那样具有侵入性。但是,可以单击文本,因此会阻止单击。

到目前为止,我发现的是http://www.autohotkey.com/board/topic/53209-make-window-transparent-and-click-through-it/,但我并不完全理解它,而且我试图让它在文本上工作的尝试似乎不起作用。通常,文本似乎没有 ahk_id。通过将“M2”参数添加到 SplashImage,我可以从文本中获取更多信息。最好的常量似乎是它的 ahk_class 是“AutoHotKey2”。因此,我修改了 Wicked 的脚本,将 ahk_id 替换为 ahk_class:

/*
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
}

并且我在子程序的SplashImage后面加上WinSet_Click_Through(AutoHotKey2, T="254"),但不影响文字。

更新:好的,所以我通过使用 ahk_exe 并针对 AutoHotKey.exe 本身以一种方式工作,但我希望只针对文本而不是任何 AutoHotKey.exe。我想知道为什么 ahk_class 不起作用。

【问题讨论】:

    标签: autohotkey


    【解决方案1】:

    您可以改用 WinTitle,这是默认的匹配行为。删除脚本中的"ahk_class "

    /*
    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
    }
    

    我希望这个定位足够具体。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-04-05
      • 1970-01-01
      • 1970-01-01
      • 2017-07-09
      • 2012-09-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多