檢查雷電程式 是否 執行中 (AUTOIT)
因為我們公司的mail server 是用雷電
常常連續開機太多天 雷電就會當掉 所以我需要他當掉的時候會自動重開
並寄mail通知我,我就會再晚上的時候 手動來重開機
寫了以下 腳本
#include <INet.au3>
While 1
Sleep(100)
check()
WEnd
Func check()
If ProcessExists("RaidenMAILD.exe") Then
; MsgBox(0, "示例", "雷電運行中。")
Else
; MsgBox(0, "示例", "電電不在運行中。")
Run("C:\RaidenMAILD\RaidenMAILD.exe", "", @SW_MINIMIZE)
$Address = "xxx@msa.hine.net" ;請自行修改
$Subject = "RaidenMAILD Warning"
$Body = "RaidenMAILD Have ReOpen"
_INetMail($address, $subject, $body)
WinWait("RaidenMAILD Warning","")
If Not WinActive("RaidenMAILD Warning","") Then WinActivate("RaidenMAILD Warning","")
WinWaitActive("RaidenMAILD Warning","")
Send("{ALTDOWN}s{ALTUP}")
EndIf
sleep(30000)
EndFunc
如有錯誤 歡迎指正