$LngTitle = 'Check Disk' $LngCh1 = 'Fix disk errors' $LngCh2 = 'Recovering bad sectors' $LngCh3 = 'Forced dismount volume' $LngBtn = 'Start' If @OSLang = 0419 Then ; $LngTitle = 'Проверка дисков' $LngCh1 = 'Исправление ошибок на диске' $LngCh2 = 'Восстановление поврежденных секторов' $LngCh3 = 'Принудительное отключение тома' $LngBtn = 'Старт' EndIf #NoTrayIcon Opt("GUIOnEventMode", 1) $sp = Chr(1) Opt("GUIDataSeparatorChar", $sp) $iGui = GUICreate($LngTitle, 250, 117) GUISetIcon(@ScriptDir & '\ChkDskGui.ico') GUISetOnEvent(-3, "_Form1Close") $iCheckbox1 = GUICtrlCreateCheckbox($LngCh1, 10, 10, 240, 20) GUICtrlSetState(-1, 1) $iCheckbox2 = GUICtrlCreateCheckbox($LngCh2, 10, 30, 240, 20) GUICtrlSetOnEvent(-1, "_Checkbox2Click") $iCheckbox3 = GUICtrlCreateCheckbox($LngCh3, 10, 50, 240, 20) GUICtrlSetOnEvent(-1, "_Checkbox3Click") GUICtrlSetState(-1, 1) $sList = _GetDrv() $iCombo1 = GUICtrlCreateCombo("", 20, 78, 91, -1, 0x3) GUICtrlSetFont(-1, -1, -1, 0, "Courier New") GUICtrlSendMsg(-1, 0x160, 370, 0) GUICtrlSetData(-1, $sList, StringLeft($sList, StringInStr($sList & $sp, $sp) - 1)) $iButton1 = GUICtrlCreateButton($LngBtn, 135, 75, 90, 32) GUICtrlSetOnEvent(-1, "_Button1Click") GUICtrlSetState($iButton1, 256) GUISetState() While 1 Sleep(10000) WEnd Func _Checkbox2Click() GUICtrlSetState($iCheckbox1, 1) EndFunc Func _Checkbox3Click() GUICtrlSetState($iCheckbox1, 1) EndFunc Func _Form1Close() Exit EndFunc Func _GetDrv() Local $sInfo = _ComboListDrive('Fixed') $sInfo &= _ComboListDrive('Removable') Return StringTrimLeft($sInfo, 1) EndFunc Func _Button1Click() Local $sDisk = StringLeft(GUICtrlRead($iCombo1), 2) If StringRight($sDisk, 1) = ":" Then GUICtrlSetState($iButton1, 128) Local $sArgs = $sDisk If GUICtrlRead($iCheckbox1) = 1 Then $sArgs &= " /f" If GUICtrlRead($iCheckbox2) = 1 Then $sArgs &= " /r" If GUICtrlRead($iCheckbox3) = 1 Then $sArgs &= " /x" RunWait(@ComSpec & ' /c (Title Check Disk & @Echo off & Color 1e & cls & chkdsk.exe ' & $sArgs & ' & set /p Ok=^>^>)') GUICtrlSetState($iButton1, 64) EndIf EndFunc Func _ComboListDrive($Type) Local $aDrive = DriveGetDrive($Type), $list = '', $sString, $sLabel If @error Then Return '' If $Type = 'Removable' Then $Type = 'Rem' For $i = 1 To $aDrive[0] If $aDrive[$i] = 'A:' Then ContinueLoop $sLabel = DriveGetLabel($aDrive[$i]) If StringLen($sLabel) > 15 Then $sLabel = StringLeft($sLabel, 12) & '...' $sString = StringFormat("%-2s %-5s %-15s %-5s ", StringUpper($aDrive[$i]), $Type, $sLabel, _ DriveGetFileSystem($aDrive[$i])) & _GetSize(DriveSpaceTotal($aDrive[$i])) & ' Gb' $list &= $sp & $sString Next Return $list EndFunc Func _GetSize($s) $s = StringFormat('%.03f', $s / 1024) If StringLen($s) > 7 Then $s = StringRegExpReplace(StringTrimRight($s, 4), '(\A\d{1,3}(?=(\d{3})+\z)|\d{3}(?=\d))', '\1 ') & StringRight($s, 4) Return StringFormat('%9s', $s) ; 9 терабайт EndFunc