Code: Select all
Loop {
If WinActive("ahk_exe calc1.exe"){
WinSet, AlwaysOnTop, On
}else if WinActive("ahk_exe sw.exe"){
WinSet, AlwaysOnTop, On
}}
Code: Select all
Loop {
If WinActive("ahk_exe calc1.exe"){
WinSet, AlwaysOnTop, On
}else if WinActive("ahk_exe sw.exe"){
WinSet, AlwaysOnTop, On
}}
Code: Select all
DllCall("RegisterShellHookWindow", "UInt", A_ScriptHwnd)
OnMessage(DllCall("RegisterWindowMessage", "Str", "SHELLHOOK"), "onTop")
Return
onTop(wParam, lParam) {
If (wParam != WINDOWCREATED := 1)
Return
WinGet, pname, ProcessName, % wTitle := "ahk_id " lParam
SplitPath, pname,,,, fnBare
If fnBare not in calc1,sw
Return
SoundBeep, 1700
WinSet, AlwaysOnTop, On, %wTitle%
}