erstes Script und ein paar Fragen!?

  • so, ich habe jetzt mein erstes script geschrieben, funktioniert eigentlich soweit ganz gut, obwohl es sicherlich auch einfacher gehen würde. wie gesagt, bin anfänger.

    meine frage nun, würde gern noch bei format die funktion FAT einbinden (für disketten). hab das probiert und scheitere an der dritten combobox. weiß net wie ich das in code verwandeln soll so das man eine meldung bekommt wenn alle comboboxes ON/OFF sind.

    naja guckts euch mal an, vielleicht hat jemand eine idee oder andere vorschläge.

    Spoiler anzeigen
    [autoit]

    ; Script Start

    [/autoit] [autoit][/autoit] [autoit]

    ; Menü & Statusbar --------------------------------------------------------------------------------------------------
    #NoTrayIcon
    #include <GUIConstants.au3>
    #include <Array.au3>
    #include <WindowsConstants.au3>
    #include <IE.au3>

    [/autoit] [autoit][/autoit] [autoit]

    GUICreate("DriveControl v0.1.1",500,370)

    [/autoit] [autoit][/autoit] [autoit]

    Opt("WinWaitDelay",100)
    Opt("WinTitleMatchMode",4)
    Opt("WinDetectHiddenText",1)
    Opt("MouseCoordMode",0)

    [/autoit] [autoit][/autoit] [autoit]

    Global $defaultstatus = "Ready"
    Global $status

    [/autoit] [autoit][/autoit] [autoit]

    Dim $suche1
    Dim $suche2

    [/autoit] [autoit][/autoit] [autoit]

    $filemenu = GUICtrlCreateMenu ("&DriveControl")
    ;$fileitem = GUICtrlCreateMenuitem ("Open",$filemenu)
    $exititem = GUICtrlCreateMenuitem ("Beenden",$filemenu)
    GUICtrlSetState(-1,$GUI_DEFBUTTON)
    $helpmenu = GUICtrlCreateMenu ("?")
    ;$saveitem = GUICtrlCreateMenuitem ("Save",$filemenu)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
    $infoitem = GUICtrlCreateMenuitem ("Über",$helpmenu)

    [/autoit] [autoit][/autoit] [autoit]

    ;$recentfilesmenu = GUICtrlCreateMenu ("Recent Files",$filemenu,1)

    [/autoit] [autoit][/autoit] [autoit]

    ;$separator1 = GUICtrlCreateMenuitem ("",$filemenu,2) ; create a separator line

    [/autoit] [autoit][/autoit] [autoit]

    $viewmenu = GUICtrlCreateMenu("Ansicht",-1,1) ; is created before "?" menu
    $viewstatusitem = GUICtrlCreateMenuitem ("Status",$viewmenu)
    GUICtrlSetState(-1,$GUI_CHECKED)

    [/autoit] [autoit][/autoit] [autoit]

    $exitbutton = GUICtrlCreateButton ("Beenden",215,300,70,20)
    GUICtrlSetState(-1,$GUI_FOCUS)

    [/autoit] [autoit][/autoit] [autoit]

    $statuslabel = GUICtrlCreateLabel ($defaultstatus,0,333,500,16,BitOr($SS_SIMPLE,$SS_SUNKEN))

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState ()
    ; Menü & Statusbar Ende --------------------------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateGroup ("Laufwerke", 15, 15, 470, 85) ;Öffne Gruppe Laufwerke
    ; Alle Laufwerke ---------------------------------------------------------------------------------------------------
    $AllLw =""
    $all = DriveGetDrive( "fixed" )

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If NOT @error Then
    For $a = 1 to $all[0]
    $AllLw &= $all[$a] & "\ "
    Next
    EndIf
    ; Festplatten ------------------------------------------------------------------------------------------------------
    $Drives =""
    $drive = DriveGetDrive( "fixed" )

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If NOT @error Then
    For $i = 1 to $drive[0]
    $Drives &= $drive[$i] & "\ "
    Next
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $drive < 1 Then
    GUICtrlCreateLabel("0 Festplatten gefunden.", 25,35,300)
    Else
    GUICtrlCreateLabel("" & $drive[0] & " Festplatte(n) gefunden: ( " & $Drives & ")" ,25,35,300)
    EndIf

    ; Wechseldatenträger -----------------------------------------------------------------------------------------------
    $Removable =""
    $remove = DriveGetDrive( "removable" )

    [/autoit] [autoit][/autoit] [autoit]

    If NOT @error Then
    For $f = 1 to $remove[0]
    $Removable &= $remove[$f] & "\ "
    Next

    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $remove < 1 Then
    GUICtrlCreateLabel("0 Wechseldatenträger gefunden.", 25,55,300)
    Else
    GUICtrlCreateLabel("" & $remove[0] & " Wechseldatenträger gefunden: ( " & $Removable & ")" ,25,55,300)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ; CD-ROM ----------------------------------------------------------------------------------------------------------
    $Cd =""
    $cdrom = DriveGetDrive( "cdrom" )

    [/autoit] [autoit][/autoit] [autoit]

    If NOT @error Then
    For $g = 1 to $cdrom[0]
    $Cd &= $cdrom[$g] & "\ "
    Next
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $cdrom < 1 Then
    GUICtrlCreateLabel("0 CD-ROM Laufwerke gefunden.", 25,75,300)
    Else
    GUICtrlCreateLabel("" & $cdrom[0] & " CD-ROM Laufwerk(e) gefunden: ( " & $Cd & ")" ,25,75,300)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateGroup ("",-99,-99,1,1) ;Schließe Gruppe Laufwerke

    [/autoit] [autoit][/autoit] [autoit]

    ;-----------------------------------------------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateGroup ("Datenträger formatieren", 15, 110, 470, 85) ;Öffne Gruppe formatieren

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateLabel ("Bitte den zu formatierenden Datenträger angeben:", 25, 130 , 300)

    [/autoit] [autoit][/autoit] [autoit]

    $input = GUICtrlCreateInput("", 50, 150, 15)
    GUICtrlCreateLabel (":\", 70, 153, 20)
    $ntfs = GUICtrlCreateCheckbox ("Ntfs", 90, 150)
    GUICtrlSetState ( $ntfs, $GUI_UNCHECKED )
    $fat = GUICtrlCreateCheckbox ("Fat32", 150, 150)
    GUICtrlSetState ( $fat, $GUI_UNCHECKED )
    $formatbutton = GUICtrlCreateButton("FORMAT", 300, 150, 60, 20)
    $helpformat = GUICtrlCreateButton (" ? ", 370, 150, 20, 20)
    GUICtrlCreateGroup ("",-99,-99,1,1) ;Schließe Gruppe formatieren
    ;----------------------------------------------------------------------------------------------------------------
    GUICtrlCreateGroup ("Datenträger defragmentieren", 15, 205, 470, 85) ;Öffne Gruppe defragmentieren

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateLabel ("Bitte den zu defragmentiernden Datenträger angeben:", 25, 225 , 300)

    [/autoit] [autoit][/autoit] [autoit]

    $defraginput = GUICtrlCreateInput("", 50, 245, 15)
    GUICtrlCreateLabel (":\", 70, 248, 20)

    [/autoit] [autoit][/autoit] [autoit]

    $defragbutton = GUICtrlCreateButton("DEFRAG", 300, 245, 60, 20)
    $helpdefrag = GUICtrlCreateButton (" ? ", 370, 245, 20, 20)
    GUICtrlCreateGroup ("",-99,-99,1,1) ;Schließe Gruppe defragmentieren
    ;---------------------------------------------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    While 1

    $msg = GUIGetMsg()

    [/autoit] [autoit][/autoit] [autoit]

    ; Format Hilfe -------------------------------------------------------------------------------------------------
    If $msg = $helpformat Then
    MsgBox (32, "Hilfe : Formatierung", @CRLF & "Formatiert werden können folgende Dateisysteme:"& @CRLF & @CRLF &"NTFS: Dateisystem für Festplatten mit Windows XP. (Kann nicht von Windows 9x gelesen werden)" & @CRLF & "FAT 32: Dateisystem für Festplatten mit Windows 9x." & @CRLF)
    EndIf
    ; Format Hilfe Ende --------------------------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    ; Defrag Hilfe -------------------------------------------------------------------------------------------------
    If $msg = $helpdefrag Then
    MsgBox (32, "Hilfe : Defragmentierung", @CRLF & "Mit der DEFRAG Funktion können Festplatten, Disketten und USB-Sticks defragmentiert werden." & @CRLF)
    EndIf
    ; Defrag Hilfe Ende --------------------------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    ; Prüfe auf Laufwerke für Formatierung -------------------------------------------------------------------------
    If $msg = $formatbutton Then
    $suche1 = _ArraySearch($all, GUICtrlRead($input), 0, 0, 0, True) Or $suche2 = _ArraySearch($remove, GUICtrlRead($input), 0, 0, 0, True)
    If @error Then
    MsgBox(0,"Fehler","Dieses Laufwerk kann nicht formatiert werden oder existiert nicht") ;Fehlermeldung
    ;Else
    ElseIf GUICtrlRead ($ntfs) = GUICtrlRead ($fat) Then
    MsgBox(0,"Fehler","Wählen sie NTFS oder FAT32 als Dateisystem!")
    ;Else
    ElseIf GUICtrlRead ($ntfs) = $GUI_CHECKED Then
    $msgabort = MsgBox(33,"NTFS formatieren","Laufwerk "& GUICtrlRead($input) &": mit NTFS formatieren?") ;Info
    If $msgabort = 2 Then MsgBox(64,"Formatierung abbrechen" , "Formatierung abgebrochen")
    If $msgabort = 1 Then
    Run(@WindowsDir&'\system32\cmd.exe',"")
    WinWait(@WindowsDir & "\system32\cmd.exe","")
    If Not WinActive(@WindowsDir& "\system32\cmd.exe","") Then WinActivate(@WindowsDir & "\system32\cmd.exe","")
    WinWaitActive(@WindowsDir & "\system32\cmd.exe","")
    Send("format{SPACE}" & GUICtrlRead($input) & "{SHIFTDOWN}.{SHIFTUP}{SPACE}{SHIFTDOWN}7{SHIFTUP}fs{SHIFTDOWN}.{SHIFTUP}ntfs")
    Sleep(3000)
    Send("{ENTER}")
    Sleep(3000)
    send("j{ENTER}")
    Sleep(2000)
    send("{ENTER}")
    send("exit{ENTER}")
    MsgBox(64,"Laufwerk "& GUICtrlRead($input) &": formatiert","Dieses Laufwerk wurde mit NTFS formatiert") ;Ende
    EndIf
    Else
    $msgabort = MsgBox(33,"FAT32 formatieren","Laufwerk "& GUICtrlRead($input) &": mit FAT32 formatieren?") ;Info
    If $msgabort = 2 Then MsgBox(64,"Formatierung abbrechen" , "Formatierung abgebrochen")
    If $msgabort = 1 Then
    Run(@WindowsDir & '\system32\cmd.exe',"")
    WinWait(@WindowsDir & "\system32\cmd.exe","")
    If Not WinActive(@WindowsDir & "\system32\cmd.exe","") Then WinActivate(@WindowsDir & "\system32\cmd.exe","")
    WinWaitActive(@WindowsDir & "\system32\cmd.exe","")
    Send("format{SPACE}" & GUICtrlRead($input) & "{SHIFTDOWN}.{SHIFTUP}{SPACE}{SHIFTDOWN}7{SHIFTUP}fs{SHIFTDOWN}.{SHIFTUP}fat32")
    Sleep(3000)
    Send("{ENTER}")
    Sleep(3000)
    send("j{ENTER}")
    Sleep(2000)
    send("{ENTER}")
    send("exit{ENTER}")
    MsgBox(64,"Laufwerk "& GUICtrlRead($input) &": formatiert","Dieses Laufwerk wurde mit FAT32 formatiert") ;Ende
    EndIf
    EndIf
    EndIf

    ; Ende Prüfung ---------------------------------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    ; Prüfe auf Laufwerke für Defragmentierung -------------------------------------------------------------------------
    If $msg = $defragbutton Then
    $suche1 = _ArraySearch($all, GUICtrlRead($defraginput), 0, 0, 0, True) Or $suche2 = _ArraySearch($remove, GUICtrlRead($defraginput), 0, 0, 0, True)
    If @error Then
    MsgBox(0,"Fehler","Dieses Laufwerk kann nicht defragmentiert werden oder existiert nicht") ;Fehlermeldung
    Else
    $defragabort = MsgBox(33,"Datenträger "& GUICtrlRead($defraginput) &": defragmentieren","Soll Laufwerk "& GUICtrlRead($defraginput) & ": defragmentiert werden?") ;Info
    If $defragabort = 2 Then MsgBox(64,"Defragmentierung abbrechen" , "Defragmentierung abgebrochen")
    If $defragabort = 1 Then
    Run(@WindowsDir & '\system32\cmd.exe',"")
    WinWait(@WindowsDir & "\system32\cmd.exe","")
    If Not WinActive(@WindowsDir & "\system32\cmd.exe","") Then WinActivate(@WindowsDir & "\system32\cmd.exe","")
    WinWaitActive(@WindowsDir & "\system32\cmd.exe","")
    Send("defrag{SPACE}" & GUICtrlRead($defraginput) & "{SHIFTDOWN}.{SHIFTUP}{CTRLDOWN}{ALTDOWN}ß{CTRLUP}{ALTUP}")
    Sleep(3000)
    Send("{ENTER}")
    Sleep(2000)
    send("{ENTER}")
    send("exit{ENTER}")
    MsgBox(64,"Laufwerk "& GUICtrlRead($defraginput) &": defragmentiert","Laufwerk "& GUICtrlRead($defraginput) &": wurde defragmentiert") ;Ende
    EndIf
    EndIf
    EndIf

    ; Ende Prüfung ---------------------------------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]


    If $msg = $viewstatusitem Then
    If BitAnd(GUICtrlRead($viewstatusitem),$GUI_CHECKED) = $GUI_CHECKED Then
    GUICtrlSetState($viewstatusitem,$GUI_UNCHECKED)
    GUICtrlSetState($statuslabel,$GUI_HIDE)
    Else
    GUICtrlSetState($viewstatusitem,$GUI_CHECKED)
    GUICtrlSetState($statuslabel,$GUI_SHOW)
    EndIf
    EndIf
    If $msg = $GUI_EVENT_CLOSE Or $msg = $exitbutton Or $msg = $exititem Then ExitLoop
    If $msg = $infoitem Then Msgbox(64,"Über",@CRLF &"DriveControl v0.1.1 "& @CRLF &"License: FREE" & @CRLF &"Copyright (c)2007 Sebastian Zeuch / SZ-soft. "& @CRLF)
    WEnd
    GUIDelete()

    [/autoit] [autoit][/autoit] [autoit]

    Exit

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    danke! gruß seb!

    2 Mal editiert, zuletzt von oxymoron (2. Juli 2007 um 17:48)

  • danke für den tip,
    bin aber leider nicht so in der autoit syntax bewandert, wie gesagt: anfänger. wenn sonst noch etwas ist, einfach beschid geben.

    • Offizieller Beitrag

    Hi,

    habe den Rest der Fehler mal ausgebaut. Aber was genau willst du denn jetzt?

    Spoiler anzeigen
    [autoit]

    ; Script Start

    [/autoit] [autoit][/autoit] [autoit]

    ; Menü & Statusbar --------------------------------------------------------------------------------------------------
    #NoTrayIcon
    #include <GUIConstants.au3>
    #include <Array.au3>
    #include <WindowsConstants.au3>
    #include <IE.au3>

    [/autoit] [autoit][/autoit] [autoit]

    GUICreate("DriveControl v0.1.1", 500, 370)

    [/autoit] [autoit][/autoit] [autoit]

    Opt("WinWaitDelay", 100)
    Opt("WinTitleMatchMode", 4)
    Opt("WinDetectHiddenText", 1)
    Opt("MouseCoordMode", 0)

    [/autoit] [autoit][/autoit] [autoit]

    Global $defaultstatus = "Ready"
    Global $status

    [/autoit] [autoit][/autoit] [autoit]

    Dim $String1, $suche2
    Dim $String2

    [/autoit] [autoit][/autoit] [autoit]

    $filemenu = GUICtrlCreateMenu("&DriveControl")
    ;$fileitem = GUICtrlCreateMenuitem ("Open",$filemenu)
    $exititem = GUICtrlCreateMenuItem("Beenden", $filemenu)
    GUICtrlSetState(-1, $GUI_DEFBUTTON)
    $helpmenu = GUICtrlCreateMenu("?")
    ;$saveitem = GUICtrlCreateMenuitem ("Save",$filemenu)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
    $infoitem = GUICtrlCreateMenuItem("Über", $helpmenu)

    [/autoit] [autoit][/autoit] [autoit]

    ;$recentfilesmenu = GUICtrlCreateMenu ("Recent Files",$filemenu,1)

    [/autoit] [autoit][/autoit] [autoit]

    ;$separator1 = GUICtrlCreateMenuitem ("",$filemenu,2) ; create a separator line

    [/autoit] [autoit][/autoit] [autoit]

    $viewmenu = GUICtrlCreateMenu("Ansicht", -1, 1) ; is created before "?" menu
    $viewstatusitem = GUICtrlCreateMenuItem("Status", $viewmenu)
    GUICtrlSetState(-1, $GUI_CHECKED)

    [/autoit] [autoit][/autoit] [autoit]

    $exitbutton = GUICtrlCreateButton("Beenden", 215, 300, 70, 20)
    GUICtrlSetState(-1, $GUI_FOCUS)

    [/autoit] [autoit][/autoit] [autoit]

    $statuslabel = GUICtrlCreateLabel($defaultstatus, 0, 333, 500, 16, BitOR($SS_SIMPLE, $SS_SUNKEN))

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()
    ; Menü & Statusbar Ende --------------------------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateGroup("Laufwerke", 15, 15, 470, 85) ;Öffne Gruppe Laufwerke
    ; Alle Laufwerke ---------------------------------------------------------------------------------------------------
    $AllLw = ""
    $all = DriveGetDrive("fixed")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If Not @error Then
    For $a = 1 To $all[0]
    $AllLw &= $all[$a] & "\ "
    Next
    EndIf
    ; Festplatten ------------------------------------------------------------------------------------------------------
    $Drives = ""
    $drive = DriveGetDrive("fixed")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If Not @error Then
    For $i = 1 To $drive[0]
    $Drives &= $drive[$i] & "\ "
    Next
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $drive < 1 Then
    GUICtrlCreateLabel("0 Festplatten gefunden.", 25, 35, 300)
    Else
    GUICtrlCreateLabel("" & $drive[0] & " Festplatte(n) gefunden: ( " & $Drives & ")", 25, 35, 300)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ; Wechseldatenträger -----------------------------------------------------------------------------------------------
    $Removable = ""
    $remove = DriveGetDrive("removable")

    [/autoit] [autoit][/autoit] [autoit]

    If Not @error Then
    For $f = 1 To $remove[0]
    $Removable &= $remove[$f] & "\ "
    Next

    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $remove < 1 Then
    GUICtrlCreateLabel("0 Wechseldatenträger gefunden.", 25, 55, 300)
    Else
    GUICtrlCreateLabel("" & $remove[0] & " Wechseldatenträger gefunden: ( " & $Removable & ")", 25, 55, 300)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ; CD-ROM ----------------------------------------------------------------------------------------------------------
    $Cd = ""
    $cdrom = DriveGetDrive("cdrom")

    [/autoit] [autoit][/autoit] [autoit]

    If Not @error Then
    For $g = 1 To $cdrom[0]
    $Cd &= $cdrom[$g] & "\ "
    Next
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $cdrom < 1 Then
    GUICtrlCreateLabel("0 CD-ROM Laufwerke gefunden.", 25, 75, 300)
    Else
    GUICtrlCreateLabel("" & $cdrom[0] & " CD-ROM Laufwerk(e) gefunden: ( " & $Cd & ")", 25, 75, 300)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateGroup("", -99, -99, 1, 1) ;Schließe Gruppe Laufwerke

    [/autoit] [autoit][/autoit] [autoit]

    ;-----------------------------------------------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateGroup("Datenträger formatieren", 15, 110, 470, 85) ;Öffne Gruppe formatieren

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateLabel("Bitte den zu formatierenden Datenträger angeben:", 25, 130, 300)

    [/autoit] [autoit][/autoit] [autoit]

    $input = GUICtrlCreateInput("", 50, 150, 15)
    GUICtrlCreateLabel(":\", 70, 153, 20)
    $ntfs = GUICtrlCreateCheckbox("Ntfs", 90, 150)
    GUICtrlSetState($ntfs, $GUI_UNCHECKED)
    $fat = GUICtrlCreateCheckbox("Fat32", 150, 150)
    GUICtrlSetState($fat, $GUI_UNCHECKED)
    $formatbutton = GUICtrlCreateButton("FORMAT", 300, 150, 60, 20)
    $helpformat = GUICtrlCreateButton(" ? ", 370, 150, 20, 20)
    GUICtrlCreateGroup("", -99, -99, 1, 1) ;Schließe Gruppe formatieren
    ;----------------------------------------------------------------------------------------------------------------
    GUICtrlCreateGroup("Datenträger defragmentieren", 15, 205, 470, 85) ;Öffne Gruppe defragmentieren

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateLabel("Bitte den zu defragmentiernden Datenträger angeben:", 25, 225, 300)

    [/autoit] [autoit][/autoit] [autoit]

    $defraginput = GUICtrlCreateInput("", 50, 245, 15)
    GUICtrlCreateLabel(":\", 70, 248, 20)

    [/autoit] [autoit][/autoit] [autoit]

    $defragbutton = GUICtrlCreateButton("DEFRAG", 300, 245, 60, 20)
    $helpdefrag = GUICtrlCreateButton(" ? ", 370, 245, 20, 20)
    GUICtrlCreateGroup("", -99, -99, 1, 1) ;Schließe Gruppe defragmentieren
    ;---------------------------------------------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    While 1

    $msg = GUIGetMsg()

    [/autoit] [autoit][/autoit] [autoit]

    ; Format Hilfe -------------------------------------------------------------------------------------------------
    If $msg = $helpformat Then
    MsgBox(32, "Hilfe : Formatierung", @CRLF & "Formatiert werden können folgende Dateisysteme:" & @CRLF & @CRLF & "NTFS: Dateisystem für Festplatten mit Windows XP. (Kann nicht von Windows 9x gelesen werden)" & @CRLF & "FAT 32: Dateisystem für Festplatten mit Windows 9x." & @CRLF)
    EndIf
    ; Format Hilfe Ende --------------------------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    ; Defrag Hilfe -------------------------------------------------------------------------------------------------
    If $msg = $helpdefrag Then
    MsgBox(32, "Hilfe : Defragmentierung", @CRLF & "Mit der DEFRAG Funktion können Festplatten, Disketten und USB-Sticks defragmentiert werden." & @CRLF)
    EndIf
    ; Defrag Hilfe Ende --------------------------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    ; Prüfe auf Laufwerke für Formatierung -------------------------------------------------------------------------
    If $msg = $formatbutton Then
    $suche1 = _ArraySearch($all, GUICtrlRead($input), 0, 0, 0, True) Or $suche2 = _ArraySearch($remove, GUICtrlRead($input), 0, 0, 0, True)
    If @error Then
    MsgBox(0, "Fehler", "Dieses Laufwerk kann nicht formatiert werden oder existiert nicht") ;Fehlermeldung
    ;Else
    ElseIf GUICtrlRead($ntfs) = GUICtrlRead($fat) Then
    MsgBox(0, "Fehler", "Wählen sie NTFS oder FAT32 als Dateisystem!")
    ;Else
    ElseIf GUICtrlRead($ntfs) = $GUI_CHECKED Then
    $msgabort = MsgBox(33, "NTFS formatieren", "Laufwerk " & GUICtrlRead($input) & ": mit NTFS formatieren?") ;Info
    If $msgabort = 2 Then MsgBox(64, "Formatierung abbrechen", "Formatierung abgebrochen")
    If $msgabort = 1 Then
    Run(@WindowsDir & '\system32\cmd.exe', "")
    WinWait(@WindowsDir & "\system32\cmd.exe", "")
    If Not WinActive(@WindowsDir & "\system32\cmd.exe", "") Then WinActivate(@WindowsDir & "\system32\cmd.exe", "")
    WinWaitActive(@WindowsDir & "\system32\cmd.exe", "")
    Send("format{SPACE}" & GUICtrlRead($input) & "{SHIFTDOWN}.{SHIFTUP}{SPACE}{SHIFTDOWN}7{SHIFTUP}fs{SHIFTDOWN}.{SHIFTUP}ntfs")
    Sleep(3000)
    Send("{ENTER}")
    Sleep(3000)
    Send("j{ENTER}")
    Sleep(2000)
    Send("{ENTER}")
    Send("exit{ENTER}")
    MsgBox(64, "Laufwerk " & GUICtrlRead($input) & ": formatiert", "Dieses Laufwerk wurde mit NTFS formatiert") ;Ende
    EndIf
    Else
    $msgabort = MsgBox(33, "FAT32 formatieren", "Laufwerk " & GUICtrlRead($input) & ": mit FAT32 formatieren?") ;Info
    If $msgabort = 2 Then MsgBox(64, "Formatierung abbrechen", "Formatierung abgebrochen")
    If $msgabort = 1 Then
    Run(@WindowsDir & '\system32\cmd.exe', "")
    WinWait(@WindowsDir & "\system32\cmd.exe", "")
    If Not WinActive(@WindowsDir & "\system32\cmd.exe", "") Then WinActivate(@WindowsDir & "\system32\cmd.exe", "")
    WinWaitActive(@WindowsDir & "\system32\cmd.exe", "")
    Send("format{SPACE}" & GUICtrlRead($input) & "{SHIFTDOWN}.{SHIFTUP}{SPACE}{SHIFTDOWN}7{SHIFTUP}fs{SHIFTDOWN}.{SHIFTUP}fat32")
    Sleep(3000)
    Send("{ENTER}")
    Sleep(3000)
    Send("j{ENTER}")
    Sleep(2000)
    Send("{ENTER}")
    Send("exit{ENTER}")
    MsgBox(64, "Laufwerk " & GUICtrlRead($input) & ": formatiert", "Dieses Laufwerk wurde mit FAT32 formatiert") ;Ende
    EndIf
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ; Ende Prüfung ---------------------------------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    ; Prüfe auf Laufwerke für Defragmentierung -------------------------------------------------------------------------
    If $msg = $defragbutton Then
    $suche1 = _ArraySearch($all, GUICtrlRead($defraginput), 0, 0, 0, True) Or $suche2 = _ArraySearch($remove, GUICtrlRead($defraginput), 0, 0, 0, True)
    If @error Then
    MsgBox(0, "Fehler", "Dieses Laufwerk kann nicht defragmentiert werden oder existiert nicht") ;Fehlermeldung
    Else
    $defragabort = MsgBox(33, "Datenträger " & GUICtrlRead($defraginput) & ": defragmentieren", "Soll Laufwerk " & GUICtrlRead($defraginput) & ": defragmentiert werden?") ;Info
    If $defragabort = 2 Then MsgBox(64, "Defragmentierung abbrechen", "Defragmentierung abgebrochen")
    If $defragabort = 1 Then
    Run(@WindowsDir & '\system32\cmd.exe', "")
    WinWait(@WindowsDir & "\system32\cmd.exe", "")
    If Not WinActive(@WindowsDir & "\system32\cmd.exe", "") Then WinActivate(@WindowsDir & "\system32\cmd.exe", "")
    WinWaitActive(@WindowsDir & "\system32\cmd.exe", "")
    Send("defrag{SPACE}" & GUICtrlRead($defraginput) & "{SHIFTDOWN}.{SHIFTUP}{CTRLDOWN}{ALTDOWN}ß{CTRLUP}{ALTUP}")
    Sleep(3000)
    Send("{ENTER}")
    Sleep(2000)
    Send("{ENTER}")
    Send("exit{ENTER}")
    MsgBox(64, "Laufwerk " & GUICtrlRead($defraginput) & ": defragmentiert", "Laufwerk " & GUICtrlRead($defraginput) & ": wurde defragmentiert") ;Ende
    EndIf
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ; Ende Prüfung ---------------------------------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]


    If $msg = $viewstatusitem Then
    If BitAND(GUICtrlRead($viewstatusitem), $GUI_CHECKED) = $GUI_CHECKED Then
    GUICtrlSetState($viewstatusitem, $GUI_UNCHECKED)
    GUICtrlSetState($statuslabel, $GUI_HIDE)
    Else
    GUICtrlSetState($viewstatusitem, $GUI_CHECKED)
    GUICtrlSetState($statuslabel, $GUI_SHOW)
    EndIf
    EndIf
    If $msg = $GUI_EVENT_CLOSE Or $msg = $exitbutton Or $msg = $exititem Then ExitLoop
    If $msg = $infoitem Then MsgBox(64, "Über", @CRLF & "DriveControl v0.1.1 " & @CRLF & "License: FREE" & @CRLF & "Copyright (c)2007 Sebastian Zeuch / SZ-soft. " & @CRLF)
    WEnd
    GUIDelete()

    [/autoit] [autoit][/autoit] [autoit]

    Exit

    [/autoit]

    So long,

    Mega

  • wie gesagt, wollte noch eine format option für fat16 (disketten formatieren), bekomme das mit drei combo-boxen nicht hin. dabei soll geprüft werden ob das laufwerk kleiner als 512MB ist.

    gruß seb!