0

我正在尝试使用 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 的弹出窗口。这是窗口间谍告诉我的关于我要检测的窗口并自动单击“确定”的内容:

>>>>>>>>>>( 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 点击右键,让网页会话保持活跃,就像我想要的那样,而不是像我想要的那样自动。

有什么建议么?谢谢!!!

4

1 回答 1

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
}
于 2013-07-24T12:49:21.440 回答