给自己网吧编的,不定时关闭又重新打开文化检查软件的小东东.
起因是文化那鸟玩意在运行时间过长时会大量内存.
希望能给你一点启示吧.#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=D:\Program Files\barserver\BarServer.ico
#AutoIt3Wrapper_outfile=C:\Documents and Settings\Administrator\桌面\BarServer.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Comment=文化软件启动器,in an hour or so restart the Softwre circlely!
#AutoIt3Wrapper_Res_Description=文化软件启动器
#AutoIt3Wrapper_Res_Fileversion=1.0.0.1
#AutoIt3Wrapper_Res_LegalCopyright=by Alam Lu
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
Sleep(100)
Local $aa=ProcessList(@ScriptName)
If $aa[0][0] <> 1 Then Exit
Local $BarServerRoot = "D:\Program Files\barserver"
Local $BarServerW = 'NetBarServer.exe'
Local $iTime
AdlibRegister('memory', 3000)
While 1
Sleep(50)
Switch @HOUR
Case 0 To 10
$iTime = 1.5 * 60
Case 11 To 18
$iTime = 1 * 60
Case Else
$iTime = 46
EndSwitch
_toRun()
WEnd
Func _toRun()
If Not ProcessExists($BarServerW) Then
ShellExecute($BarServerRoot & $BarServerW, '', $BarServerRoot, 'open', @SW_HIDE)
Sleep(6000)
WinSetState('文化监管平台网吧服务器','机器名称',@SW_HIDE)
Sleep($iTime * 60 * 1000)
ProcessClose($BarServerW)
ProcessClose('ServerAid.exe')
ElseIf ProcessExists ($BarServerW) Then
ProcessClose($BarServerW)
ProcessClose('ServerAid.exe')
ShellExecute($BarServerRoot & $BarServerW, '', $BarServerRoot, 'open', @SW_HIDE)
Sleep(6000)
WinSetState('文化监管平台网吧服务器','机器名称',@SW_HIDE)
Sleep($iTime * 60 * 1000)
ProcessClose($BarServerW)
EndIf
EndFunc ;==>_toRun
Func Memory()
_ReduceMemory(@AutoItPID)
EndFunc ;==>Memory
Func _ReduceMemory($i_PID = -1)
If $i_PID <> -1 Then
Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
Else
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
EndIf
Return $ai_Return[0]
EndFunc ;==>_ReduceMemory
|