#Region ;
#AutoIt3Wrapper_UseAnsi=y
#EndRegion ;
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <Constants.au3>
#include <StaticConstants.au3>
GUICreate("Formater Ver 1.1", 633, 380, 193, 125)
Dim $xz, $a, $b, $zx, $Q, $F, $ff
Local $add, $clear, $mylist, $Button1, $sf, $format
$myedit = GUICtrlCreateEdit("", 5, 32, 620, 200)
$Button1 = GUICtrlCreateButton("Start Format Disc", 380, 250, 245, 33, 0)
GUICtrlCreateGroup(" Choose Format Way ", 230, 250, 140, 100)
$Q = GUICtrlCreateRadio("Quick Format", 250, 280, 100, 20)
$F = GUICtrlCreateRadio("Full Format", 250, 300, 100, 20)
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group
GUISetState()
$var = DriveGetDrive("REMOVABLE")
$xz = GUICtrlCreateCombo("Select The Disc", 20, 250, 200, 30)
For $i = 1 To $var[0]
GUICtrlSetData($xz, $var[$i])
Next
GUISetState(@SW_SHOW)
While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$F111 = MsgBox(1 + 48, 'Attention', 'Are you sure you want to format this disc?')
Select
Case $F111 = 1
If BitAND(GUICtrlRead($Q), $GUI_CHECKED) Then $format = '/Q/'
If BitAND(GUICtrlRead($F), $GUI_CHECKED) Then $format = ''
_test()
Case $F111 = 2
ContinueLoop
EndSelect
EndSwitch
WEnd
Func _test()
Local $foo, $line, $lines, $currentRead
$a = TimerInit()
$zx = GUICtrlRead($xz)
$foo = Run(@ComSpec & " /c " & 'Format ' & $zx & '/FS:FAT32/V:HaHa' & $format & 'X/Y', "", @SW_HIDE, $STDOUT_CHILD)
While 1
$line = StdoutRead($foo)
If @error Then ExitLoop
GUICtrlSetData($myedit, $line, -1)
WEnd
$b = TimerDiff($a)
$c = $b / 1000
$d = Round($c)
MsgBox(64, "Finish", "This format cost you " & $d & " Seconds")
EndFunc ;==>_test