[AutoIt]Code for Restarter
#1

I have atm this code, that Start lcsm if this not exist in taskmngr.

 

While 1
While ProcessExists("lcsm.exe") ----> Here can be Connector.exe too.
Sleep(100)
WEnd
Sleep(30)
Run( "lcsm")
Do
Sleep(100)
Until ProcessExists("lcsm.exe")
WEnd

 

But, i wanna to write a Programm, who restart the Server then the Connector or/and Gameserver Crashs.

 

A Friend send me something like this :

f _NotResponding("C:\Users\Desktop\LCSM\Connector\Connector.exe", 1) Then; The last parameter indicates whether you want to close the hung app or not.
MsgBox(0,"Restart Server", "Restart Biw")
Else
MsgBox(0,"", "Application running as intended.")
EndIf

Func _NotResponding($title, $text, $closeIfHung = 0)
$hWnd = WinGetHandle($title, $text)
If $hWnd == "C:\Users\Desktop\LCSM\Connector\Connector.exe" Then
MsgBox(0,"Error","Could not find window")
Exit
EndIf
$retArr = DllCall("user32.dll", "int", "IsHungAppWindow", "hwnd", $hWnd)
If @error == 0 Then
If $retArr[0] == 1 Then
If $closeIfHung Then
ProcessClose(WinGetProcess($title, $text))
EndIf
Return 1
EndIf
Else
Return 0
EndIf
EndFunc

 

But i cant handle with it i wanna a simple script^^

#2

First thing you forgot to write [AutoIt] on your title tag.

 

Your code has some problems.

 

1)It looks for LCSM.exe not Connector.exe

2)When the Connector is crashing will not close(the process will remain there).

3)You dont need this, because you have your second while:

Do
Sleep(100)
Until ProcessExists("lcsm.exe")

3)look if the Process is working using the code your fried gave you:

fisrt you need to get the process Handle, using WinGetProcess();:

 

Then you need to check the the process i s hung up(your friend gave you the code):

$retArr = DllCall("user32.dll", "int", "IsHungAppWindow", "hwnd", $hWnd);
If retArr then
ProcessClose("Connector.exe");
Run( "Connector.exe")
EndIf

#3
what must be $hWnd ?

#4

$Hwnd is the window handler, needed to check.

 

func getHandle($pid)
$list = WinList()
for $i = 1 to $list[0][0]
if(WinGetProcess($list[$i][1]) = $pid) Then
return $list[i][1]
endIf
Next
return 0
endFunc

#5
Thank you for Help i generate my own with ProcessClose and then start lcsm Tongue

#6
how i can use it ??

#7
i make a new at the moment that handle with OllyDbg

#8

It may not have anything to do with programming or with autoit, but i personally use : 2 that free program to monitor my processes.

 

btw, someone, is there any language u dont know ? :O

#9
Thanks you Wiza^^

#10

btw, someone, is there any language u dont know ? :O

 

Im sure he doesnt speak japanese yet.

 

(please tell me im right)



Forum Jump:


Users browsing this thread: 1 Guest(s)