Jump to content

Check Disk Interface


NerdFencer
 Share

Recommended Posts

This is a quick interface that I wrote up for chkdsk, hopefully someone will it useful.

#NoTrayIcon

Global Const $GUI_CHECKED = 1
Global Const $GUI_DISABLE = 128
Global Const $GUI_ENABLE = 64

$gui = GUICreate("Check Disk",200,200)
GUISetHelp("cmd.exe /K "&Chr(34)&"chkdsk /?"&Chr(34))
GUICtrlCreateLabel("Drive:",5,7)
$drive = -1
For $i=Asc("A") To Asc("Z")
    If FileExists(Chr($i)&":") Then
        If $drive>0 Then
            GUICtrlSetData($drive,Chr($i)&":")
        Else
            $drive = GUICtrlCreateCombo(Chr($i)&":",40,5,150)
        EndIf
    EndIf
Next
$fix = GUICtrlCreateCheckbox("Fix Errors",5,35)
GUICtrlSetTip(-1,"Fixes errors on the disk")
GUICtrlSetState(-1,$GUI_CHECKED)
$sectors = GUICtrlCreateCheckbox("Fix Bad Sectors",15,55)
GUICtrlSetTip(-1,"Locates bad sectors and recovers readable information")
GUICtrlSetState(-1,$GUI_CHECKED)
$dismount = GUICtrlCreateCheckbox("Force Volume Dismount",15,75)
GUICtrlSetTip(-1,"Forces volume dismount if necicary")
$message = GUICtrlCreateCheckbox("Display Messages",5,95)
GUICtrlSetTip(-1,"NTFS:Displays Cleanup Messages if any"&@CRLF&"FAT/FAT32:Display all files and folders on disk")
GUICtrlSetState(-1,$GUI_CHECKED)
$indexes = GUICtrlCreateCheckbox("Incomplete Index check",5,115)
GUICtrlSetTip(-1,"Performs less-vigorous check of index entries")
$cycles = GUICtrlCreateCheckbox("Skip cycle checking",5,135)
GUICtrlSetTip(-1,"Skips checking of cycles within the folder structure")

$go = GUICtrlCreateButton("Run",100,165,95,25)
GUICtrlSetTip(-1,"Execute the selected operation")
GUISetState()

$commands = ""

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case -3
            Exit
        Case $fix
            If GUICtrlRead($fix)==$GUI_CHECKED Then
                GUICtrlSetState($sectors,$GUI_ENABLE)
                GUICtrlSetState($dismount,$GUI_ENABLE)
            Else
                GUICtrlSetState($sectors,$GUI_DISABLE)
                GUICtrlSetState($dismount,$GUI_DISABLE)
            EndIf
        Case $go
            $commands = ""
            CommandAdd($fix," /F")
            CommandAdd($message," /V")
            If GUICtrlRead($fix)==$GUI_CHECKED Then
                CommandAdd($sectors," /R")
                CommandAdd($dismount," /X")
            EndIf
            CommandAdd($indexes," /I")
            CommandAdd($cycles," /C")
            Run("cmd.exe /K "&Chr(34)&"chkdsk "&GUICtrlRead($drive)&$commands&Chr(34))
            Exit
    EndSwitch
WEnd
Func CommandAdd($control,$command)
    If GUICtrlRead($control)==$GUI_CHECKED Then
        $commands = $commands & $command
    EndIf
EndFunc
Edited by NerdFencer

_________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...