View Single Post
  #1  
Old 08-15-2011, 07:03 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default Auto-restarting CloD server with AutoIt

AutoIt is a popular windows automation toolbox which can be scripted to do various tasks. BigRepa created a script for it to restart Repka servers.

What it does:
1. Checks if launcher process exists
2. Checks if there is no Steam disconnect window pop-up.

If 1 or 2 is not true, it runs reboot.cmd which restarts Windows.

Code:
#Include <WinAPIEx.au3>
Opt("TrayAutoPause",0) ; important line!
$okno="Steam Connection"
While 1
If Not ProcessExists('Launcher.exe') Then
sleep (300000)
	If Not ProcessExists('Launcher.exe') Then
	Run("C:\autocod\reboot.cmd")
	Endif
Else
	$var = WinList($okno)  
	For $n = 1 to $var[0][0]    
	$aData = _WinAPI_EnumChildWindows($var[$n][1])
	For $i= 1 To $aData[0][0]
	$text=ControlGetText ($var[$n][1], "", $aData[$i][0])
	If StringInStr($text, "Steam") Then
	Run("C:\autocod\reboot.cmd")
	Endif
	Next
    Next
    sleep (60000)
Endif
WEnd
You also have to put the following files into the script directory:
APIConstants.au3
WinAPIEx.au3
Get them at AutoIt site. AutoIt forums provide a lot of help and instructions.

I personally did not install or ran it. Just spread some useful info.

Last edited by Ataros; 09-30-2011 at 02:36 PM.
Reply With Quote