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

这会在屏幕中间显示白色文字。这对指示内容非常有用,而不会像MsgBox那样具有侵入性。但是,文本可以点击,因此它阻止点击。有没有办法让SplashImage文字点击?

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

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

我在子程序把WinSet_Click_Through(AutoHotKey2, T="254") SplashImage之后,但它不会影响文本。

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

回答

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 
} 

我希望此定位足够具体。

相关问题