Тема: AHK: Программа для слежения за исправностью RAID 1
Зеркальный рейд, должен быть создан средствами windows.
#NoTrayIcon
DllCall("AllocConsole")
WinHide % "ahk_id " DllCall("GetConsoleWindow", "ptr")
loop
{
objShell := ComObjCreate("WScript.Shell")
objExec := objShell.Exec(ComSpec " /C echo list volume | C:\Windows\System32\diskpart.exe")
strStdOut := ""
while, !objExec.StdOut.AtEndOfStream
strStdOut := objExec.StdOut.ReadAll()
Loop, Parse, strStdOut, `n, `r
{
If (instr(A_LoopField, "Failed") || instr(A_LoopField, "At Risk"))
{
errors = 1
StringMid, disk, A_LoopField, 16, 1
break
}
}
If errors = 1
{
Menu, Tray, Icon
Gui,+AlwaysOnTop
Gui, -MinimizeBox -MaximizeBox
Gui, Font, s80, Times New Roman
Gui, Add, Text,, Problema s Raid Disk: %disk%
Gui, Show,, RaidError
Gui, +LastFound
OnMessage(0x112, "WM_SYSCOMMAND")
Return
}
sleep, 3600000
}
WM_SYSCOMMAND(wParam)
{
if (A_Gui = 1 && wParam = 0xF060) ; SC_CLOSE
return 0
}