hoangtungpcinfo Posted May 24, 2012 Share Posted May 24, 2012 (edited) Hi all!Everyone. I live in Vietnam.Ghoster and I am very need this tool "Checkdisk"Link to download it:http://www.mediafire.com/?sdtw39bnk2j1tpdSpecifically:I want the HDD mode display like this:And when the Command window, CMD work will not be turned off but in combination with GUI GUI like this:I have a couple of code:Cmd.au3Check Disk GUI.au3I tried to contact the author of its source but received no response.I come here with you. Hope you will help me.Tool authors made AutoIt but it is I can not Unpack and pack it out.I think I need to add a command utility, can be useful again to partition your hard drive is the perfect program.But because I do not have the source code because of your help.I want you to combine and modify it so that it could look similar to the author's tool "CheckdiskGui"Can you send me the code or *. Au3 better.I always respect the copyrights and we're looking for help so I can complete in the shortest time.What's wrong hope you ignore.Thank you all! Edited May 25, 2012 by hoangtungpcinfo Link to comment Share on other sites More sharing options...
hannes08 Posted May 24, 2012 Share Posted May 24, 2012 Hello, to get the disks, labels, free space and filesystem you can use the Disk*() functions. E.g.: DriveGetDrive("FIXED") to recieve all HDDs. DriveGetLabel("C:") to get the label of C: DriveGetFilesystem("C:") and so on... Outputs of commands can be read with StdOutRead. the helpfile is your friend, pal! Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
hoangtungpcinfo Posted May 24, 2012 Author Share Posted May 24, 2012 (edited) Hello,to get the disks, labels, free space and filesystem you can use the Disk*() functions.E.g.: DriveGetDrive("FIXED") to recieve all HDDs. DriveGetLabel("C:") to get the label of C: DriveGetFilesystem("C:") and so on...Outputs of commands can be read with StdOutRead.the helpfile is your friend, pal! Thanks you! I was notveryclear aboutthiscode.You can editit in theattachedfileofmyAu3.There isonethingthat Iwant to integratetheGUICMDwindowwhen it runsturnedoutto not bethatalwaysfails.Helpme!Thanks all! Edited May 25, 2012 by hoangtungpcinfo Link to comment Share on other sites More sharing options...
hannes08 Posted May 24, 2012 Share Posted May 24, 2012 Here's an example, of how to display the outputs of a DOS command to an edit box: #include <Constants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <GUIEdit.au3> #Include <ScrollBarConstants.au3> $Form1 = GUICreate("Form1", 625, 445, 192, 124) $Edit1 = GUICtrlCreateEdit("", 30, 30, 361, 341, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_HSCROLL,$WS_VSCROLL,$ES_READONLY)) $Button1 = GUICtrlCreateButton("Start", 410, 70, 75, 25, $WS_GROUP) $Input1 = GUICtrlCreateInput("C:Windows", 410, 30, 121, 21) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GUICtrlSetState($Button1, $GUI_DISABLE) GUICtrlSetState($Input1, $GUI_DISABLE) GUICtrlSetData($Edit1, "") $foo = Run(@ComSpec & " /c dir " & GUICtrlRead($Input1), @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While 1 $line = StdoutRead($foo) If @error Then ExitLoop GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & $line) Wend $iEnd = StringLen(GUICtrlRead($Edit1)) _GUICtrlEdit_SetSel($Edit1, $iEnd, $iEnd) _GUICtrlEdit_Scroll($Edit1, $SB_SCROLLCARET) GUICtrlSetState($Button1, $GUI_ENABLE) GUICtrlSetState($Input1, $GUI_ENABLE) EndSwitch WEnd hoangtungpcinfo 1 Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
hoangtungpcinfo Posted May 25, 2012 Author Share Posted May 25, 2012 Thank You.Còn vấn đề này :Tôi đã cố gắng cách gợi ý của bạn nhưng ko đc.Tôi ngu và gà về lập trình và mong các bạn giúp đỡ nhiệt tình. Link to comment Share on other sites More sharing options...
hoangtungpcinfo Posted May 25, 2012 Author Share Posted May 25, 2012 (edited) expandcollapse popup#NoTrayIcon #region #AutoIt3Wrapper_icon=Icon.ico #AutoIt3Wrapper_compression=0 #AutoIt3Wrapper_useupx=n #endregion #include <Constants.au3> #include <GUIConstantsEx.au3> #include <GUIEdit.au3> #include <WindowsConstants.au3> Opt("GUIResizeMode", 802) ;Global Const $GUI_CHECKED = 1 ;Global Const $GUI_DISABLE = 128 ;Global Const $GUI_ENABLE = 64 ;Global Const $GUI_SHOW = 16 ;Global Const $GUI_HIDE = 32 Global $PARAMS[4] For $I = 0 To 3 $PARAMS[$I] = False Next If $CMDLINE[0] > 0 Then For $I = 1 To $CMDLINE[0] If StringInStr($CMDLINE[$I], "/About") Then $PARAMS[0] = True EndIf If StringInStr($CMDLINE[$I], "/Default") Then $PARAMS[1] = True EndIf If StringInStr($CMDLINE[$I], "/Advanced") Then $PARAMS[2] = True EndIf If StringInStr($CMDLINE[$I], "/drive:") Then $PARAMS[3] = StringTrimLeft($CMDLINE[$I], 7) & ":" $PARAMS[1] = True EndIf Next EndIf $COMMANDS = "" #region If $PARAMS[0] == False Then $GUI = GUICreate("Check Disk",800, 600, -1, -1, -2067267584 ) GUISetBkColor(0xABCDEF) $GUICONTEXT = GUICtrlCreateContextMenu() $GUIGO = GUICtrlCreateMenuItem("Run", $GUICONTEXT) GUICtrlSetTip(-1, "Execute the selected operation") $GUIADVANCED = GUICtrlCreateMenuItem("Advanced Settings", $GUICONTEXT) GUICtrlSetTip(-1, "Show Advanced Options") $GUIABOUT = GUICtrlCreateMenuItem("About", $GUICONTEXT) GUICtrlSetTip(-1, "Show Program Information") GUICtrlCreateMenuItem("", $GUICONTEXT) $GUIEXIT = GUICtrlCreateMenuItem("Exit", $GUICONTEXT) GUISetHelp("cmd.exe /K " & Chr(34) & "chkdsk /?" & Chr(34)) $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) & ":", 60,50 , 220) GUICtrlSetTip(-1, "Drive to Check") $LOCATION = GUICtrlCreateInput(Chr($I) & ":", 60, 50, 200) GUICtrlSetState(-1, $GUI_HIDE) $BROWSE = GUICtrlCreateIcon("shell32.dll", 5, 260, 40) GUICtrlSetState(-1, $GUI_HIDE) EndIf EndIf Next #Region ### START Koda GUI section ### hoangtungpc.info $Labe1 = GUICtrlCreateLabel( "Phần mềm kiểm tra và sửa lỗi Bad HDD", 10, 10, 300 ) GUICtrlSetFont(-1, 11, 800) $Label3 = GUICtrlCreateLabel("Chọn :", 10, 57, 51 ) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global Const $idEdit = GUICtrlCreateEdit($GUI, 0, 300, 300, 200, BitOR($ES_AUTOVSCROLL, $WS_HSCROLL, $WS_VSCROLL, $ES_MULTILINE, $ES_WANTRETURN)) Global $sPrefix = GetCMDVer() Global $sCMDLine = @HomeDrive & @HomePath Global $iPrefixLen = StringLen($sCMDLine & ">") GUICtrlSetData(-1, $sPrefix & @CRLF & _ "Copyright © 2009 Microsoft Corporation. All rights reserved." & @CRLF & @CRLF & $sCMDLine & ">") GUICtrlSetFont(-1, 10, 600, 0, "Lucida Console") GUICtrlSetColor(-1, 0xC0C0C0) GUICtrlSetBkColor(-1, 0x000000) $hEdit = GUICtrlGetHandle($idEdit) _GUICtrlEdit_SetLimitText($hEdit, -1) Global $hEditWndProc = DllCallbackRegister ("EditWndProc", "long", "hwnd;uint;wparam;lparam") Global $hOldEditProc = _WinAPI_SetWindowLong($hEdit, $GWL_WNDPROC, DllCallbackGetPtr($hEditWndProc)) $FIX = GUICtrlCreateCheckbox("Kiểm tra toàn bộ phân vùng", 5, 80) GUICtrlSetTip(-1, "Fixes errors on the disk") GUICtrlSetState(-1, $GUI_CHECKED) $SECTORS = GUICtrlCreateCheckbox("Sửa lỗi Bad Sectors", 165, 80) GUICtrlSetTip(-1, "Locates bad sectors and recovers readable information") GUICtrlSetState(-1, $GUI_CHECKED) $DISMOUNT = GUICtrlCreateCheckbox("Sửa lỗi Bad nâng cao", 5, 110) GUICtrlSetTip(-1, "Forces volume dismount if necicary" & @CRLF & "NTFS only") $MESSAGE = GUICtrlCreateCheckbox("Hiển thị quá trình", 165, 110) 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, 1155) GUICtrlSetTip(-1, "Performs less-vigorous check of index entries" & @CRLF & "NTFS only") $CYCLES = GUICtrlCreateCheckbox("Skip cycle checking", 5, 1808) GUICtrlSetTip(-1, "Skips checking of cycles within the folder structure" & @CRLF & "NTFS only") $GO = GUICtrlCreateButton("Thực hiện", 165, 143, 118, 55, 1) GUICtrlSetTip(-1, "Execute the selected operation") $ADVANCED = GUICtrlCreateIcon("shell32.dll", 300, 50, 300, 16, 16) GUICtrlSetTip(-1, "Show Advanced Options") $ABOUT = GUICtrlCreateIcon("shell32.dll", 44, 70, 320, 32, 32) GUICtrlSetTip(-1, "Show Program Information") $LOGFILE = GUICtrlCreateCheckbox("Show Logfile Size", 5, 155) GUICtrlSetTip(-1, "Display the size of the logfile" & @CRLF & "NTFS only") GUICtrlSetState(-1, $GUI_HIDE) $RESIZE = GUICtrlCreateCheckbox("Resize Logfile", 15, 175) GUICtrlSetTip(-1, "Change the size of the logfile" & @CRLF & "NTFS only") GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetState(-1, $GUI_DISABLE) $SIZE = GUICtrlCreateInput("1", 32, 200, 100) GUICtrlSetTip(-1, "New size for the logfile in KB" & @CRLF & "NTFS only") GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetLimit(-1, 100000, 0) $SIZEUPDOWN = GUICtrlCreateUpdown($SIZE) GUICtrlSetLimit(-1, 100000, 0) GUICtrlSetTip(-1, "New size for the logfile in KB" & @CRLF & "NTFS only") GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetState(-1, $GUI_DISABLE) $SIZELABEL = GUICtrlCreateLabel("KB", 140, 204) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetState(-1, $GUI_DISABLE) $FILEFOLDER = GUICtrlCreateCheckbox("Kiểm tra file hoặc folder:", 5, 140) GUICtrlSetTip(-1, "Check a File or Folder instead of a Drive" & @CRLF & "FAT only") $FILE = GUICtrlCreateRadio("File", 5, 160) GUICtrlSetTip(-1, "Check a File instead of a Drive" & @CRLF & "FAT only") GUICtrlSetState(-1, $GUI_DISABLE) $FOLDER = GUICtrlCreateRadio("Folder", 5, 180) GUICtrlSetTip(-1, "Check a Folder instead of a Drive" & @CRLF & "FAT only") GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetState(-1, $GUI_CHECKED) If $PARAMS[1] == False Then GUISetState() Else GO() Exit EndIf Else $GUI = -1 EndIf #endregion #region $ABOUTGUI = GUICreate("About", 250, 150, -1, -1, -2067267584) GUISetIcon("shell32.dll", 24, $ABOUTGUI) GUICtrlCreateIcon(@ScriptName, 0, 10, 10, 32, 32) GUICtrlCreateLabel("Check Disk GUI", 50, 5, 190) GUICtrlSetFont(-1, 11, 800) GUICtrlCreateLabel("Version: 1.2", 60, 25) GUICtrlCreateLabel("Written By: Matthew McMullan", 5, 50, 240) GUICtrlSetFont(-1, 11, 800) GUICtrlCreateLabel("Contact: NerdFencer@Gmail.com", 10, 70) If $PARAMS[0] == True Then GUISetState() EndIf #endregion If $PARAMS[2] == True Then MAINMSG($ADVANCED) EndIf While 1 $MSG = GUIGetMsg(1) If $MSG[1] == $GUI Then MAINMSG($MSG[0]) Else ABOUTMSG($MSG[0]) EndIf WEnd Func COMMANDADD($CONTROL, $COMMAND) If GUICtrlRead($CONTROL) == $GUI_CHECKED Then $COMMANDS = $COMMANDS & $COMMAND EndIf EndFunc Func GO($STAYOPEN = True) Local $COMMAND = "cmd.exe /K " If $STAYOPEN == False Then $COMMAND = "cmd.exe " EndIf $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") COMMANDADD($LOGFILE, " /L") If GUICtrlRead($RESIZE) == $GUI_CHECKED Then $COMMANDS = $COMMANDS & ":" & GUICtrlRead($SIZE) EndIf If $PARAMS[3] == False Then If GUICtrlRead($FILEFOLDER) == $GUI_CHECKED Then Run($COMMAND & Chr(34) & "chkdsk " & GUICtrlRead($LOCATION) & $COMMANDS & Chr(34)) Else Run($COMMAND & Chr(34) & "chkdsk " & GUICtrlRead($DRIVE) & $COMMANDS & Chr(34)) EndIf Else Run($COMMAND & Chr(34) & "chkdsk " & $PARAMS[3] & $COMMANDS & Chr(34)) EndIf EndFunc Func ABOUTMSG($MSG) Switch $MSG Case - 3 If $PARAMS[0] == False Then GUISetState(@SW_HIDE, $ABOUTGUI) Else Exit EndIf EndSwitch EndFunc Func MAINMSG($MSG) Switch $MSG Case - 3 Exit Case $GUIEXIT 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 GO() Exit Case $GUIGO GO() Exit Case $GUIADVANCED MAINMSG($ADVANCED) Case $LOGFILE If GUICtrlRead($LOGFILE) == $GUI_CHECKED Then GUICtrlSetState($RESIZE, $GUI_ENABLE) If GUICtrlRead($RESIZE) == $GUI_CHECKED Then GUICtrlSetState($SIZE, $GUI_ENABLE) GUICtrlSetState($SIZEUPDOWN, $GUI_ENABLE) GUICtrlSetState($SIZELABEL, $GUI_ENABLE) EndIf Else GUICtrlSetState($RESIZE, $GUI_DISABLE) GUICtrlSetState($SIZE, $GUI_DISABLE) GUICtrlSetState($SIZEUPDOWN, $GUI_DISABLE) GUICtrlSetState($SIZELABEL, $GUI_DISABLE) EndIf Case $RESIZE If GUICtrlRead($RESIZE) == $GUI_CHECKED Then GUICtrlSetState($SIZE, $GUI_ENABLE) GUICtrlSetState($SIZEUPDOWN, $GUI_ENABLE) GUICtrlSetState($SIZELABEL, $GUI_ENABLE) Else GUICtrlSetState($SIZE, $GUI_DISABLE) GUICtrlSetState($SIZEUPDOWN, $GUI_DISABLE) GUICtrlSetState($SIZELABEL, $GUI_DISABLE) EndIf Case $FILEFOLDER If GUICtrlRead($FILEFOLDER) == $GUI_CHECKED Then GUICtrlSetState($FILE, $GUI_ENABLE) GUICtrlSetState($FOLDER, $GUI_ENABLE) GUICtrlSetState($DRIVE, $GUI_HIDE) GUICtrlSetState($LOCATION, $GUI_SHOW) GUICtrlSetState($BROWSE, $GUI_SHOW) Else GUICtrlSetState($FILE, $GUI_DISABLE) GUICtrlSetState($FOLDER, $GUI_DISABLE) GUICtrlSetState($DRIVE, $GUI_SHOW) GUICtrlSetState($LOCATION, $GUI_HIDE) GUICtrlSetState($BROWSE, $GUI_HIDE) EndIf Case $BROWSE If BitAND(GUICtrlRead($FILE), $GUI_CHECKED) == $GUI_CHECKED Then $TEMP = FileOpenDialog("Browse", GUICtrlRead($LOCATION), "All (*.*)", 3) If Not (@error) Then GUICtrlSetData($LOCATION, $TEMP) EndIf Else $TEMP = FileSelectFolder("Browse", GUICtrlRead($DRIVE)) If Not (@error) Then GUICtrlSetData($LOCATION & "", $TEMP) EndIf EndIf Case $ABOUT GUISetState(@SW_SHOW, $ABOUTGUI) Case $GUIABOUT GUISetState(@SW_SHOW, $ABOUTGUI) EndSwitch EndFunc Func SendCommand2CMD($sCommand) ControlFocus($hGUI, "", $idEdit) ControlSend($hGUI, "", $idEdit, $sCommand & @LF) EndFunc Func EditWndProc($hWnd, $iMsg, $wParam, $lParam) Switch $iMsg Case $WM_KEYDOWN ;~ ConsoleWrite($wParam & @LF) Switch $wParam Case 13 Local $sCMD = StringMid(_GUICtrlEdit_GetLine($hEdit, _GUICtrlEdit_LineFromChar($hEdit)), $iPrefixLen + 1) _GUICtrlEdit_BeginUpdate($hEdit) _GUICtrlEdit_AppendText($hEdit, Oem2Ansi(ExecuteCMD($sCMD))) $sCMDLine = StringReplace(ExecuteCMD("cd"), @CRLF, "") ExecuteCMD("cd /d " & $sCMDLine) $iPrefixLen = StringLen($sCMDLine & ">") _GUICtrlEdit_AppendText($hEdit, @CRLF & Oem2Ansi($sCMDLine) & ">") _GUICtrlEdit_EndUpdate($hEdit) _GUICtrlEdit_LineScroll($hEdit, 0, 0xFFFFFF) Return 1 Case 8 If _GUICtrlEdit_LineLength($hEdit) < $iPrefixLen Then _GUICtrlEdit_AppendText($hEdit, ">") EndIf Return 1 EndSwitch EndSwitch Return _WinAPI_CallWindowProc($hOldEditProc, $hWnd, $iMsg, $wParam, $lParam) EndFunc Func ExecuteCMD($sCommand) Local $iPID = Run(@ComSpec & " /c " & $sCommand, $sCMDLine, @SW_HIDE, $STDERR_MERGED) Local $line While 1 $line &= StdoutRead($iPID) If @error Then ExitLoop WEnd Return $line EndFunc Func GetCMDVer() Local $foo = Run(@ComSpec & " /c ver", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Local $line While 1 $line &= StdoutRead($foo) If @error Then ExitLoop WEnd Return StringStripWS(StringStripCR($line), 3) EndFunc ;==>GetCMDVer Func Oem2Ansi($text) $text = DllCall('user32.dll','Int','OemToChar','str',$text,'str','') Return $text[2] EndFunc Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _WinAPI_SetWindowLong($hEdit, $GWL_WNDPROC, $hOldEditProc) DllCallbackFree($hEditWndProc) GUIDelete() Exit Case $idButton_Dir SendCommand2CMD("dir") Case $idButton_IPC SendCommand2CMD("chkdsk.exe ") EndSwitch Until FalseI am with Active combine be as thế this. By default, du not Active combine is how to fix error. but not hieu sao when running CPU -> 100%. Sure you have might do too many loop and me unknown Join our ở Where And when off go does the program Autoit3.exe still running in sevice. Interpreted you you can help me edit ko it again . Thanks! Edited May 25, 2012 by hoangtungpcinfo Link to comment Share on other sites More sharing options...
Zedna Posted May 25, 2012 Share Posted May 25, 2012 (edited) To get more response write in English and don't spam people by PM. EDIT: And don't bump your topics before 24 hours! Edited May 25, 2012 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 25, 2012 Moderators Share Posted May 25, 2012 (edited) hoangtungpcinfo,You appear to have PMed a lot of people about this thread - please read the Forum Rules before you post again as any further misdemeanours will result in sanctions. M23 Edited May 25, 2012 by Melba23 Typo Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
hoangtungpcinfo Posted May 28, 2012 Author Share Posted May 28, 2012 Ineed help Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now