我正在尝试使用autohotkey来确认网站的超时消息并自动保持会话处于活动状态。 Winwait似乎是这个的理想功能,但由于某种原因,它没有做我认为应该做的事情。
这是我写的不起作用的函数:
DetectHiddenWindows, On
SetTitleMatchMode 2
winwait, Message from webpage, Your TrackWise session is expiring
ControlClick, Button1, Message from webpage, Your TrackWise session is expiring
return
该窗口是来自Internet Explorer的弹出窗口。这是窗口间谍告诉我关于我想要检测的窗口的内容,并自动点击OK:
>>>>>>>>>>( Window Title & Class )<<<<<<<<<<<
Message from webpage
ahk_class #32770
>>>>>>>>>>>>( Mouse Position )<<<<<<<<<<<<<
On Screen: 1503, 692 (less often used)
In Active Window: 1219, 259
>>>>>>>>>( Now Under Mouse Cursor )<<<<<<<<
Color: 0xF0F0F0 (Blue=F0 Green=F0 Red=F0)
>>>>>>>>>>( Active Window Position )<<<<<<<<<<
left: 284 top: 433 width: 484 height: 174
>>>>>>>>>>>( Status Bar Text )<<<<<<<<<<
>>>>>>>>>>>( Visible Window Text )<<<<<<<<<<<
OK
Cancel
Your TrackWise session is expiring in 15 minute(s).
If you would like to continue click OK, otherwise you will be logged off TrackWise.
>>>>>>>>>>>( Hidden Window Text )<<<<<<<<<<<
>>>>( TitleMatchMode=slow Visible Text )<<<<
>>>>( TitleMatchMode=slow Hidden Text )<<<<
无论出于何种原因,winwait都没有得到它。如果我使用这样的热键:
#k::ControlClick , Button1, Message from webpage, Your TrackWise session is expiring
然后win + k点击右键,让网页会话保持活力,就像我想要的那样,不会像我想的那样自动生成。
有什么建议吗?谢谢!!!
答案 0 :(得分:0)
titleOption:="ahk_exe iexplore.exe ahk_class #32770", GW_OWNER:=4
Loop
{
WinWait, % titleOption
WinGet, procName, ProcessName
, % "ahk_id "DllCall("GetWindow", "Ptr", hWnd:=WinExist(titleOption)
, "UInt", GW_OWNER
, "Ptr")
If % procName=="IEXPLORE.EXE"
ControlClick, % "Button1", % "ahk_id "hWnd
Sleep, 250
}