繁体   English   中英

当前窗口更改时的AutoHotkey GetWinTitle

[英]AutoHotkey GetWinTitle when current window changes

我正在尝试制作ahk脚本,以在打开新窗口(或使其重新聚焦)时提醒您。 换句话说,我希望它能够检测当前窗口何时更改。 我尝试比较窗口名称以检测差异:

    0::
    WinGetTitle, title, A
    windowTitle=%title%
    MsgBox, "The current window is %title%."
    return

    9::
    WinGetTitle, title2, A
    if (%title2% = %title%)
    {
        success=1
    }
    else
    {
        MsgBox, "The current window changed to %title2%."
    }
    return

但,
1)我显然在变量中使用了非法字符;
2)我宁愿使用与此不同的方法;

提前致谢!

附言:我希望警报包含当前窗口的名称。

CurrentTitle := ""

SetTimer, CheckWindow, 1000
return

CheckWindow:
    WinGetTitle, NewTitle, A
    if (CurrentTitle != NewTitle){
        ToolTip % "Window changed to: " NewTitle
        CurrentTitle := NewTitle
    }
    return

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM