2015-07-04 73 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 
} 

我希望此定位足夠具體。

相關問題