1
votes

To check that my local servers are online as seen from the WAN, I have a PHP script on a remote web site that tests my servers every 5 minutes, and a report is returned to my local browser. If something is wrong, some javascript also changes the title. My AHK script should then recognise the title change within 10 seconds, and bring the browser window to the top.

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
;
^F1::Send Dave Kimble
...
;
SetTitleMatchMode 2
Loop {
  IfWinExist, Server Error 
  { WinActivate 
    return
  }
  Sleep 10000
  return
}

The PHP script works OK, however the AHK script doesn't seem to recognise the title change. Indeed it doesn't seem to clock any CPU time at all after the initial load. What am I doing wrong?

1

1 Answers

1
votes

As soon as your loop reaches the second return, the loop will exit.

You will also have to move ^F1::Send Dave Kimble after your loop since it prevents the script from reaching the loop statement.