shutdown manager gui öffnet sich nicht

  • moin

    ich arbeite im moment an einem modifiziertem shutdown manager :huh: (nicht schon wieder so einer^^)
    naja jedenfalls muss der halt bombenmäßig viele einstellungen haben und das kam bei raus:

    Spoiler anzeigen
    [autoit]


    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <ListBoxConstants.au3>

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

    $Form1 = GUICreate("C.S.F. -Tool", 410, 500)
    $Start = GUICtrlCreateButton("Start", 152, 448, 75, 25, $WS_GROUP)

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

    $inputhour = GUICtrlCreateInput("00", 10, 42, 75, 60, @SW_DISABLE)
    GUICtrlSetFont(-1, 30, 400, 0, "Sylfaen")
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1, 0x000000)
    $updownhour = GUICtrlCreateUpdown($inputhour)
    GUICtrlSetLimit($updownhour, 23)

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

    $inputmin = GUICtrlCreateInput("00", 10, 100, 75, 60, @SW_DISABLE)
    GUICtrlSetFont(-1, 30, 400, 0, "Sylfaen")
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1, 0x000000)
    $updownmin = GUICtrlCreateUpdown($inputmin)
    GUICtrlSetLimit($updownmin, 59)

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

    $inputsek = GUICtrlCreateInput("00", 10, 158, 75, 60, @SW_DISABLE)
    GUICtrlSetFont(-1, 30, 400, 0, "Sylfaen")
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1, 0x000000)
    $updownsek = GUICtrlCreateUpdown($inputsek)
    GUICtrlSetLimit($updownsek, 59)

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

    $Label1 = GUICtrlCreateLabel("Stunden", 90, 56, 44, 17)
    $Label2 = GUICtrlCreateLabel("Minuten", 90, 112, 42, 17)
    $Label3 = GUICtrlCreateLabel("Sekunden", 90, 168, 53, 17)

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

    $Radio1 = GUICtrlCreateRadio("Piep-Ton", 224, 40, 113, 17)
    $Radio2 = GUICtrlCreateRadio("Eigener Sound", 224, 72, 100, 17)
    $Radio3 = GUICtrlCreateRadio("nichts", 224, 104, 113, 17)
    GUICtrlSetState($Radio3, $GUI_CHECKED)

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

    $Radio4 = GUICtrlCreateRadio("Programm ausführen", 224, 152, 113, 17)
    $Radio5 = GUICtrlCreateRadio("Programm beenden", 224, 192, 113, 17)
    $Radio6 = GUICtrlCreateRadio("nichts", 224, 232, 113, 17)
    GUISetState($Radio6, $GUI_CHECKED)

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

    $filebutton = GUICtrlCreateButton("Durchsuchen", 328, 72, 75, 25, $WS_GROUP)
    $progstart = GUICtrlCreateButton("Durschsuchen", 328, 192, 75, 25, $WS_GROUP)
    $progkill = GUICtrlCreateButton("Auswählen", 328, 232, 75, 25, $WS_GROUP)

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

    $Combo1 = GUICtrlCreateCombo("nichts", 224, 320, 145, 25)
    GUICtrlSetData($Combo1, "nichts|Herunterfahren|Neu starten|Abmelden|Energie sparen", "nichts")

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

    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $filebutton
    $soundpath = FileOpenDialog("Sound Datei", @MyDocumentsDir, "*.mp3|*.wav", 3, "", $Form1)
    ContinueLoop
    Case $progstart
    $exepath = FileOpenDialog("Programm auswahl", @MyDocumentsDir, "*.exe", 3, "", $Form1)
    ContinueLoop
    Case $progkill

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

    Dim $WinList

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

    $Form2 = GUICreate("Programmauswahl", 355, 340, 193, 125)
    $List1 = GUICtrlCreateList("", 8, 8, 337, 279)
    $button = GUICtrlCreateButton("Auswählen", 140, 300)
    GUISetState(@SW_SHOW)

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

    $Liste = _WinListVisible()
    For $i = 0 To UBound($Liste) - 1
    GUICtrlSetData($List1, $Liste[$i][0])
    Next

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $button
    $killprog = GUICtrlRead($List1)
    GUIDelete()
    If $killprog = "" Then _killprogerror()

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

    EndSwitch
    WEnd
    ContinueLoop

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

    Case $Start
    GUISetState(@SW_HIDE)
    _count()

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

    EndSwitch

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

    WEnd

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

    Func _killprogerror()
    MsgBox(0, "Fehler", "Du hast nichts ausgewählt")
    GUISetState($Radio6, $GUI_CHECKED)
    EndFunc

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

    Func _WinListVisible()
    Local $WinListVisible[1][2]
    Local $Count = 0
    $WinList = WinList()
    For $i = 1 To $WinList[0][0]
    If BitAND(WinGetState($WinList[$i][1]), 2) Then
    If $WinList[$i][0] <> "" And $WinList[$i][0] <> "Program Manager" Then
    $Count += 1
    ReDim $WinListVisible[$Count][2]
    $WinListVisible[$Count - 1][0] = $WinList[$i][0]
    $WinListVisible[$Count - 1][1] = $WinList[$i][1]
    EndIf
    EndIf
    Next
    Return $WinListVisible
    EndFunc

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

    Func _count()

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

    $hour = GUICtrlRead($inputhour)
    $min = GUICtrlRead($inputmin)
    $sek = GUICtrlRead($inputsek)

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

    $time = ($hour * 1120) + ($min * 1060) + ($sek * 1000)

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

    Sleep($time)

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

    EndFunc

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

    $Radio1_r = GUICtrlRead($Radio1)
    $Radio2_r = GUICtrlRead($Radio2)
    $Radio3_r = GUICtrlRead($Radio3)

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

    While $GUI_CHECKED
    Select
    Case $Radio1_r
    Beep(700, 500)
    Beep(700, 500)
    Sleep(500)
    Beep(700, 500)
    Beep(700, 500)

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

    Case $Radio2_r
    SoundPlay($soundpath, 1)

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

    Case $Radio3_r
    ExitLoop
    EndSelect
    WEnd

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

    $Radio4_r = GUICtrlRead($Radio4)
    $Radio5_r = GUICtrlRead($Radio5)
    $Radio6_r = GUICtrlRead($Radio6)

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

    While $GUI_CHECKED
    Select
    Case $Radio4_r
    Run($exepath)
    Case $Radio5_r
    WinKill($killprog)
    Case $Radio6_r
    ExitLoop
    EndSelect
    WEnd

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

    While 1
    $combochoice = GUICtrlRead($Combo1)
    Select
    Case $combochoice = "nichts"
    Exit
    Case $combochoice = "Herunterfahren"
    Shutdown(1)
    Case $combochoice = "Neu starten"
    Shutdown(2)
    Case $combochoice = "Abmelden"
    Shutdown(0)
    Case $combochoice = "Energie sparen"
    Shutdown(32)
    EndSelect
    WEnd

    [/autoit]

    mein problem ist das wenn ich das script starte wird keine gui geöffnet dadurch kann ich auch nicht testen ob die funktion auch funktionieren ( ich wette 50% davon klappen)

    wo ist der fehler? ?(

    mfg bulli

  • okey habs wirklich bisle übertrieben :whistling:
    habs jetz geändert von 5 auf 1 ( und da noch sleep eingefügt) die anderen hab ich while einfach weggelassen und select gelassen

    Spoiler anzeigen
    [autoit]


    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <ListBoxConstants.au3>

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

    Opt("GUIOnEventMode", 1)
    Dim $killprog

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

    $Form1 = GUICreate("C.S.F. -Tool", 410, 500)
    $Start = GUICtrlCreateButton("Start", 152, 448, 75, 25, $WS_GROUP)

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

    $inputhour = GUICtrlCreateInput("00", 10, 42, 75, 60, @SW_DISABLE)
    GUICtrlSetFont(-1, 30, 400, 0, "Sylfaen")
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1, 0x000000)
    $updownhour = GUICtrlCreateUpdown($inputhour)
    GUICtrlSetLimit($updownhour, 23)

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

    $inputmin = GUICtrlCreateInput("00", 10, 100, 75, 60, @SW_DISABLE)
    GUICtrlSetFont(-1, 30, 400, 0, "Sylfaen")
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1, 0x000000)
    $updownmin = GUICtrlCreateUpdown($inputmin)
    GUICtrlSetLimit($updownmin, 59)

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

    $inputsek = GUICtrlCreateInput("00", 10, 158, 75, 60, @SW_DISABLE)
    GUICtrlSetFont(-1, 30, 400, 0, "Sylfaen")
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlSetBkColor(-1, 0x000000)
    $updownsek = GUICtrlCreateUpdown($inputsek)
    GUICtrlSetLimit($updownsek, 59)

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

    $Label1 = GUICtrlCreateLabel("Stunden", 90, 56, 44, 17)
    $Label2 = GUICtrlCreateLabel("Minuten", 90, 112, 42, 17)
    $Label3 = GUICtrlCreateLabel("Sekunden", 90, 168, 53, 17)

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

    $Radio1 = GUICtrlCreateRadio("Piep-Ton", 224, 40, 113, 17)
    $Radio2 = GUICtrlCreateRadio("Eigener Sound", 224, 72, 100, 17)
    $Radio3 = GUICtrlCreateRadio("nichts", 224, 104, 113, 17)
    GUICtrlSetState($Radio3, $GUI_CHECKED)

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

    $Radio4 = GUICtrlCreateRadio("Programm ausführen", 224, 152, 113, 17)
    $Radio5 = GUICtrlCreateRadio("Programm beenden", 224, 192, 113, 17)
    $Radio6 = GUICtrlCreateRadio("nichts", 224, 232, 113, 17)
    GUISetState($Radio6, $GUI_CHECKED)

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

    $filebutton = GUICtrlCreateButton("Durchsuchen", 328, 72, 75, 25, $WS_GROUP)
    $progstart = GUICtrlCreateButton("Durschsuchen", 328, 192, 75, 25, $WS_GROUP)
    $progkill = GUICtrlCreateButton("Auswählen", 328, 232, 75, 25, $WS_GROUP)

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

    $Combo1 = GUICtrlCreateCombo("nichts", 224, 320, 145, 25)
    GUICtrlSetData($Combo1, "nichts|Herunterfahren|Neu starten|Abmelden|Energie sparen", "nichts")

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

    GUISetState(@SW_SHOW)

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

    While 1
    Sleep( 100 )
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $filebutton
    $soundpath = FileOpenDialog("Sound Datei", @MyDocumentsDir, "*.mp3|*.wav", 3, "", $Form1)
    ContinueLoop
    Case $progstart
    $exepath = FileOpenDialog("Programm auswahl", @MyDocumentsDir, "*.exe", 3, "", $Form1)
    ContinueLoop
    Case $progkill

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

    Dim $WinList

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

    $Form2 = GUICreate("Programmauswahl", 355, 340, 193, 125)
    $List1 = GUICtrlCreateList("", 8, 8, 337, 279)
    $button = GUICtrlCreateButton("Auswählen", 140, 300)
    GUISetState(@SW_SHOW)

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

    $Liste = _WinListVisible()
    For $i = 0 To UBound($Liste) - 1
    GUICtrlSetData($List1, $Liste[$i][0])
    Next

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

    GUICtrlSetOnEvent($GUI_EVENT_CLOSE, "_Close")
    GUICtrlSetOnEvent($button, "_readlist")

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

    Case $Start
    GUISetState(@SW_HIDE)
    _count()

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

    EndSwitch
    WEnd

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

    Func _readlist ()
    $killprog = GUICtrlRead($List1)
    GUIDelete()
    If $killprog = "" Then MsgBox(0, "Fehler", "Du hast nichts ausgewählt")
    EndFunc

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

    Func _Close ()
    GUIDelete()
    EndFunc

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

    Func _WinListVisible()
    Local $WinListVisible[1][2]
    Local $Count = 0
    $WinList = WinList()
    For $i = 1 To $WinList[0][0]
    If BitAND(WinGetState($WinList[$i][1]), 2) Then
    If $WinList[$i][0] <> "" And $WinList[$i][0] <> "Program Manager" Then
    $Count += 1
    ReDim $WinListVisible[$Count][2]
    $WinListVisible[$Count - 1][0] = $WinList[$i][0]
    $WinListVisible[$Count - 1][1] = $WinList[$i][1]
    EndIf
    EndIf
    Next
    Return $WinListVisible
    EndFunc

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

    Func _count()

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

    $hour = GUICtrlRead($inputhour)
    $min = GUICtrlRead($inputmin)
    $sek = GUICtrlRead($inputsek)
    $time = ($hour * 1120) + ($min * 1060) + ($sek * 1000)

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

    Sleep($time)

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

    EndFunc

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

    $Radio1_r = GUICtrlRead($Radio1)
    $Radio2_r = GUICtrlRead($Radio2)
    $Radio3_r = GUICtrlRead($Radio3)

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

    Select
    Case $Radio1_r = $GUI_CHECKED
    Beep(700, 500)
    Beep(700, 500)
    Sleep(500)
    Beep(700, 500)
    Beep(700, 500)
    Case $Radio2_r = $GUI_CHECKED
    SoundPlay($soundpath, 1)
    Case $Radio3_r =$GUI_CHECKED
    Sleep( 10 )
    EndSelect

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

    $Radio4_r = GUICtrlRead($Radio4)
    $Radio5_r = GUICtrlRead($Radio5)
    $Radio6_r = GUICtrlRead($Radio6)

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

    Select
    Case $Radio4_r = $GUI_CHECKED
    Run($exepath)
    Case $Radio5_r = $GUI_CHECKED
    WinKill($killprog)
    Case $Radio6_r = $GUI_CHECKED
    Sleep( 10 )
    EndSelect

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

    $combochoice = GUICtrlRead($Combo1)
    Select
    Case $combochoice = "nichts"
    Exit
    Case $combochoice = "Herunterfahren"
    Shutdown(1)
    Case $combochoice = "Neu starten"
    Shutdown(2)
    Case $combochoice = "Abmelden"
    Shutdown(0)
    Case $combochoice = "Energie sparen"
    Shutdown(32)
    EndSelect

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

    Exit

    [/autoit]


    aber es funktioniert immernoch nicht wirklich :S

  • mach mal anstatt

    [autoit]

    GUISetState(@SW_SHOW)

    [/autoit]


    das hier:

    [autoit]

    GUISetState(@SW_SHOW, $Form1)

    [/autoit]


    und du wirst sehen: die GUI wird angezeigt :D

    Mfg. PCKing


    Mein PC

    CPU: AMD FX 8350 8x4.00GHz
    Ram: 8GB DDR3
    Grafikkarte: Nvidia Geforce GTX 960 (4GB)
    Festplatten: 500GB SSD 1TB HDD
    Laufwerk: Blueray RW+ Brenner