Unter-GUI Fenster aufrufen

  • Hi, ich habe eine GUI + deren While-Schleife am Laufen. Nun möchte ich, dass auf Knopfdruck ein neues GUI-Fenster aufgeht dass einige Aktionen durchführt - es ist eine Input-Zeile + Ok Button + Abbrechen usw. Danach soll dort noch eine Ausgabe wie "X Erfolgreich durchgeführt" erscheinen.

    So, wie mache ich das nun, dass meine ursprüngliche GUI wartet bis das andere Programm fertig oder beendet wird, und dann wieder zur Hauptebene leitet.

    Ich raff das net, wegen der while Schleife und wo die Unterschleife der neuen GUI hingehört innerhalb des Skripts usw.

    Hat jemand einBeispiel eines solchen Konstrukt, dann leite ich mir das ab...

  • beudeutet GUIGetMsg(1), dass die While auf einen Wert der anderen GUI wartet oder wie?
    D.h. GUIGetMsg() = zuerst erstellte GUI, GUIGetMsg(1) = zweiterstellte GUI usw.???

    So, hab nun die zweite Gui in den entsprechenden Case innerhalb meiner While eingebaut - geht soweit. Nur wenn ich nun das Unter-GUI schließe beendet sich das ganze Programm anstatt nur das neue GUI-fenster zu schließen...wieso das denn?

    2 Mal editiert, zuletzt von greetzz (8. Januar 2007 um 12:46)

    • Offizieller Beitrag

    Hi,

    nein. Du baust eine große GUI-Schleife in der auf alles reagiert wird. msg[0] ist das Control und msg[1] ist die GUI aus der das Control stammt.

    Bsp:

    [autoit]


    While 1
    $msg = GUIGetMsg(1)
    If $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $gui_main Then ExitLoop
    If $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $gui_child Then GUISetState(@SW_HIDE, $gui_child)
    WEnd

    [/autoit]

    So long,

    Mega

  • Hmm also so ganz raff ich das noch net...wo muss ich die Variablen $gui_child und $gui_main anlegen?

    Ich poste jetzt einfach mal mein ganzes Skript, vielleicht kannst du mir dann daran zeign wo gnau der Fehler ist. Die neue GUI soll innerhalb des "untersten Case - ab Zeile 164 - geöffnet werden und das Hauptprogramm nicht geschlossen werden wenn ich diese GUI beende

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <ServiceControl.au3>
    #include <Constants.au3>
    #Include <GuiList.au3>

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

    GUICreate("Service-Skript V1.5",650,490)
    GUISetState(@sw_show)
    Global $text
    Global $ipconfig = "ipconfig",$cmd = "cmd /T:1F /K",$gpupdate = "gpupdate /force",$nslookup = "nslookup",$tracert = "tracert",$remoteaccess="rcimlby.exe -LaunchRA"
    Dim $Prt, $ProgName, $Optionen, $MaxB=0, $i, $PrtArray
    $text1=GUICtrlCreateLabel("Bitte wählen Sie eines der folgenden Programme aus, in dem Sie den entsprechenden Button auswählen und mit OK bestätigen. Zum Beenden des Programms, bitte Exit wählen. Zum Löschen der Anzeige, Clear wählen.",15,10,200,80,-1,-1)
    $button_ok=GUICtrlCreateButton("OK",10,120,200,35,-1,-1)
    $button_clear=GUICtrlCreateButton("Clear",10,170,90,35,-1,-1)
    $button_exit=GUICtrlCreateButton("Exit",125,170,90,35,-1,-1)

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

    GUICtrlCreateGroup ("1. Ihr PC-Name ist: ", 340, 10, 300, 50)
    GUICtrlCreateLabel (@ComputerName, 360, 30, 270, 20)

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

    GUICtrlCreateGroup ("2. Ausführen des Ping auf Rechner:", 340, 70, 300, 90)
    $radio_2 = GUICtrlCreateRadio ("srv01mail1", 350, 90, 140, 20)
    $radio_3 = GUICtrlCreateRadio (@ComputerName, 350, 110, 140, 20)
    $radio_4 = GUICtrlCreateRadio ("srv32sis", 350, 130, 140, 20)
    $radio_1 = GUICtrlCreateRadio ("eigene Eingabe:",490, 90, 140, 20)

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

    GUICtrlCreateGroup ("3. Netzwerktools", 340, 170, 300, 110)
    $radio_5 = GUICtrlCreateRadio ("IP-Adressen des Rechners anzeigen", 350, 190, 280, 20)
    $radio_7 = GUICtrlCreateRadio ("Policy-Refresh", 350, 210, 280, 20)
    $radio_8 = GUICtrlCreateRadio ("NSLOOKUP auf Ditzingen / Böblingen", 350, 230, 280, 20)
    $radio_12 = GUICtrlCreateRadio ("Trace Route auf Server x", 350, 250, 280, 20)

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

    GUICtrlCreateGroup ("4. Windows Tools", 340, 290, 300, 90)
    $radio_9 = GUICtrlCreateRadio ("Computermanagement öffnen", 350, 310, 280, 20)
    $radio_10 = GUICtrlCreateRadio ("Eventviewer starten", 350, 330, 280, 20)
    $radio_11 = GUICtrlCreateRadio ("Windows Remote Assistance starten", 350, 350, 280, 20)

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

    GUICtrlCreateGroup ("5. Admin Tools", 340, 390, 300, 90)
    $radio_13 = GUICtrlCreateRadio ("Firewall", 350, 410, 70, 20)
    $button_off=GUICtrlCreateButton("AUS",530,410,80,20,-1,-1)
    $button_on=GUICtrlCreateButton("AN",430,410,80,20,-1,-1)
    $radio_14 = GUICtrlCreateRadio ("Lokalen Benutzer entsperren", 350, 430, 280, 20)
    $radio_6 = GUICtrlCreateRadio ("DOS-Box mit Adminrechten starten", 350, 450, 280, 20)

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

    $out = GUICtrlCreateList("", 10, 230, 320, 250,($ws_vscroll+$WS_BORDER+$LBS_NOTIFY+$LBS_NOINTEGRALHEIGHT))
    GuiSetIcon("trash.ico", 0)
    GUISetState ()

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

    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
    Exit
    Case $msg = $button_clear
    ClearFields($out,$radio_2,$radio_3,$radio_4,$radio_5,$radio_6,$radio_7,$radio_8,$radio_9,$radio_10,$radio_11,$radio_12,$radio_13,$radio_14)
    Case $msg = $button_exit
    Exit
    Case $msg = $button_ok AND (GUICtrlRead($radio_2) = $GUI_Checked) ; Ping srv01mail1
    PingServ("srv01mail1")

    Case $msg = $button_ok AND (GUICtrlRead($radio_3) = $GUI_Checked) ; Ping localhost
    PingServ(@ComputerName)

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

    Case $msg = $button_ok AND (GUICtrlRead($radio_4) = $GUI_Checked) ; Ping srv32sis
    PingServ("srv32sis")

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

    Case $msg = $button_ok AND (GUICtrlRead($radio_5) = $GUI_Checked) ; IP-Adresse anzeigen
    ClearFields($out,$radio_2,$radio_3,$radio_4,$radio_5,$radio_6,$radio_7,$radio_8,$radio_9,$radio_10,$radio_11,$radio_12,$radio_13,$radio_14)
    $stream = Run(@comspec & ' /c ' & $ipconfig,'',@SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
    $text=""
    While 1
    $textline = StdoutRead($stream)
    $text = $text & @CRLF & $textline
    If @error Then ExitLoop
    Wend

    MsgBox(0, "STDOUT read:", $text)

    Case $msg = $button_ok AND (GUICtrlRead($radio_6) = $GUI_Checked) ; DOS-Box mit Adminrechten starten
    ClearFields($out,$radio_2,$radio_3,$radio_4,$radio_5,$radio_6,$radio_7,$radio_8,$radio_9,$radio_10,$radio_11,$radio_12,$radio_13,$radio_14)
    Run( @ComSpec & " /c " & $cmd, @SystemDir, @SW_SHOW)

    Case $msg = $button_ok AND (GUICtrlRead($radio_7) = $GUI_Checked) ; Policy Update
    ClearFields($out,$radio_2,$radio_3,$radio_4,$radio_5,$radio_6,$radio_7,$radio_8,$radio_9,$radio_10,$radio_11,$radio_12,$radio_13,$radio_14)
    GUICtrlSetData($out,"Refresh der Policy startet")
    Opt("WinWaitDelay",100)
    Opt("WinTitleMatchMode",4)
    Opt("WinDetectHiddenText",1)
    Opt("MouseCoordMode",0)
    Run('C:\WINDOWS\system32\cmd.exe',"", @SW_HIDE)
    WinWait("C:\WINDOWS\system32\cmd.exe","")
    If Not WinActive("C:\WINDOWS\system32\cmd.exe","") Then WinActivate("C:\WINDOWS\system32\cmd.exe","")
    WinWaitActive("C:\WINDOWS\system32\cmd.exe","")
    Send("gpupdate /force")
    Send("{ENTER}")
    GUICtrlSetData($out,"-------------------------------------------------------------" & "|" & "Bitte warten, die Policy wird erneuert.")
    Sleep(20000)
    Send( "n" & "{ENTER}" & "exit" & "{ENTER}")
    GUICtrlSetData($out,"-------------------------------------------------------------" & "|" & "Die Policy wurde erfolgreich erneuert")
    Case $msg = $button_ok AND (GUICtrlRead($radio_8) = $GUI_Checked) ; nslookup auf beliebigen Server durchführen
    ClearFields($out,$radio_2,$radio_3,$radio_4,$radio_5,$radio_6,$radio_7,$radio_8,$radio_9,$radio_10,$radio_11,$radio_12,$radio_13,$radio_14)
    $server = InputBox("Nslookup auf Server X", "Bitte den Servernamen eingeben: ",""," M")
    $stream = Run(@comspec & ' /c ' & $nslookup & " " & $server,'',@SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
    $text=""
    While 1
    $textline = StdoutRead($stream)
    $text = $text & @CRLF & $textline

    If @error Then ExitLoop
    Wend
    MsgBox(0, "STDOUT read:", $text)
    Case $msg = $button_ok AND (GUICtrlRead($radio_9) = $GUI_Checked) ; Computermanagement öffnen
    ClearFields($out,$radio_2,$radio_3,$radio_4,$radio_5,$radio_6,$radio_7,$radio_8,$radio_9,$radio_10,$radio_11,$radio_12,$radio_13,$radio_14)
    Run(@ComSpec & " /c " & 'compmgmt.msc', "", @SW_HIDE)

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

    Case $msg = $button_ok AND (GUICtrlRead($radio_10) = $GUI_Checked) ; Eventviewer öffnen
    ClearFields($out,$radio_2,$radio_3,$radio_4,$radio_5,$radio_6,$radio_7,$radio_8,$radio_9,$radio_10,$radio_11,$radio_12,$radio_13,$radio_14)
    Run(@ComSpec & " /c " & 'eventvwr.msc', "", @SW_HIDE)

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

    Case $msg = $button_ok AND (GUICtrlRead($radio_11) = $GUI_Checked) ; Windows remote Assistance
    ClearFields($out,$radio_2,$radio_3,$radio_4,$radio_5,$radio_6,$radio_7,$radio_8,$radio_9,$radio_10,$radio_11,$radio_12,$radio_13,$radio_14)
    Run($remoteaccess)

    Case $msg = $button_ok AND (GUICtrlRead($radio_12) = $GUI_Checked) ; Traceroute auf beliebigen Server durchführen
    ClearFields($out,$radio_2,$radio_3,$radio_4,$radio_5,$radio_6,$radio_7,$radio_8,$radio_9,$radio_10,$radio_11,$radio_12,$radio_13,$radio_14)
    $server = InputBox("Traceroute auf Server X", "Bitte den Servernamen eingeben: ",""," M")
    $stream = Run(@comspec & ' /c ' & $tracert & " " & $server,'',@SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
    $text=""
    While 1
    $textline = StdoutRead($stream)
    $text = $text & @CRLF & $textline

    If @error Then ExitLoop
    Wend
    MsgBox(0, "STDOUT read:", $text)

    Case $msg = $button_ok AND (GUICtrlRead($radio_13) = $GUI_Checked) ; Meldung zum Start/Stop der Firewall anzeigen
    GUICtrlSetData($out,"Für das Aktivieren der Windows-Firewall bitte rechts den |AN Button drücken ||Für das Deaktivieren der Windows-Firewall bitte rechts den |AUS Button drücken")

    Case $msg = $button_on AND (GUICtrlRead($radio_13) = $GUI_Checked) ; Firewall anschalten
    ClearFields($out,$radio_2,$radio_3,$radio_4,$radio_5,$radio_6,$radio_7,$radio_8,$radio_9,$radio_10,$radio_11,$radio_12,$radio_13,$radio_14)
    _startService("","sharedaccess")
    $err = @error
    Select
    Case $err=0
    GUICtrlSetData($out,"Die Windows Firewall wurde gestartet")
    Case $err=1056
    GUICtrlSetData($out,"Der Windows-Firewalldienst ist bereit aktiv")
    Case Else
    GUICtrlSetData($out,"Es sind Fehler aufgetreten,|der Dienst konnte nicht erfolgreich gestartet werden |Evtl fehlen die Admin-Berechtigungen")
    EndSelect

    Case $msg = $button_off AND (GUICtrlRead($radio_13) = $GUI_Checked) ; Firewall abschalten
    ClearFields($out,$radio_2,$radio_3,$radio_4,$radio_5,$radio_6,$radio_7,$radio_8,$radio_9,$radio_10,$radio_11,$radio_12,$radio_13,$radio_14)
    _StopService("","sharedaccess")
    $err = @error
    Select
    Case $err=0
    GUICtrlSetData($out,"Die Windows Firewall wurde erfolgreich gestopt")
    Case $err=1062
    GUICtrlSetData($out,"Der Windows-Firewalldienst war bereit beendet")
    Case Else
    GUICtrlSetData($out,"Es sind Fehler aufgetreten,|der Dienst konnte nicht erfolgreich beendet werden |Evtl fehlen die Admin-Berechtigungen")
    EndSelect

    Case $msg = $button_ok AND (GUICtrlRead($radio_14) = $GUI_Checked) ; Lokalen Benutzer entsperren
    ClearFields($out,$radio_2,$radio_3,$radio_4,$radio_5,$radio_6,$radio_7,$radio_8,$radio_9,$radio_10,$radio_11,$radio_12,$radio_13,$radio_14)
    GUICreate("Test",65,49)
    GUISetState(@sw_show)

    EndSelect

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

    WEnd

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

    Func ClearFields($out,$radio_2,$radio_3,$radio_4,$radio_5,$radio_6,$radio_7,$radio_8,$radio_9,$radio_10,$radio_11,$radio_12,$radio_13,$radio_14)
    _GUICtrlListClear ($out)
    GUICtrlSetState($radio_2, $GUI_unchecked)
    GUICtrlSetState($radio_3, $GUI_unchecked)
    GUICtrlSetState($radio_4, $GUI_unchecked)
    GUICtrlSetState($radio_5, $GUI_unchecked)
    GUICtrlSetState($radio_6, $GUI_unchecked)
    GUICtrlSetState($radio_7, $GUI_unchecked)
    GUICtrlSetState($radio_8, $GUI_unchecked)
    GUICtrlSetState($radio_9, $GUI_unchecked)
    GUICtrlSetState($radio_10, $GUI_unchecked)
    GUICtrlSetState($radio_11, $GUI_unchecked)
    GUICtrlSetState($radio_12, $GUI_unchecked)
    GUICtrlSetState($radio_13, $GUI_unchecked)
    GUICtrlSetState($radio_14, $GUI_unchecked)
    EndFunc

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

    Func PingServ($ping)
    ClearFields($out,$radio_2,$radio_3,$radio_4,$radio_5,$radio_6,$radio_7,$radio_8,$radio_9,$radio_10,$radio_11,$radio_12,$radio_13,$radio_14)
    GUICtrlSetData($out,"Please wait...")
    $i=Run(@ComSpec &" /c ping "& $ping, @SystemDir, @SW_HIDE, $STDOUT_CHILD+$STDERR_CHILD)
    ProcessWaitClose($i)
    $h=StdOutRead($i)
    If @Error=0 Then $Prt=$h
    $h=StdErrRead($i)
    If @Error=0 Then $Prt = $h
    $Prt=StringReplace($Prt, Chr(154), "Ü")
    $Prt=StringReplace($Prt, Chr(129), "ü")
    $Prt=StringReplace($Prt, Chr(142), "Ä")
    $Prt=StringReplace($Prt, Chr(132), "ä")
    $Prt=StringReplace($Prt, Chr(153), "Ö")
    $Prt=StringReplace($Prt, Chr(148), "ö")
    $Prt=StringReplace($Prt, Chr(10), "")
    $Zeilen =StringSplit($Prt, @CR)
    ClearFields($out,$radio_2,$radio_3,$radio_4,$radio_5,$radio_6,$radio_7,$radio_8,$radio_9,$radio_10,$radio_11,$radio_12,$radio_13,$radio_14)
    For $v = 1 To $Zeilen[0] Step 1
    If StringLen(StringStripWS($Zeilen[$v], 8)) > 0 Then
    GUICtrlSetData($out,($Zeilen[$v])&"|")
    EndIf
    Next
    EndFunc

    [/autoit]

    Einmal editiert, zuletzt von greetzz (8. Januar 2007 um 13:09)

    • Offizieller Beitrag

    Hi,

    versuch es mal so :

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <ServiceControl.au3>
    #include <Constants.au3>
    #Include <GuiList.au3>

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

    $main = GUICreate("Service-Skript V1.5", 650, 490)
    GUISetState(@SW_SHOW)
    Global $text
    Global $ipconfig = "ipconfig", $cmd = "cmd /T:1F /K", $gpupdate = "gpupdate /force", $nslookup = "nslookup", $tracert = "tracert", $remoteaccess = "rcimlby.exe -LaunchRA"
    Dim $Prt, $ProgName, $Optionen, $MaxB = 0, $i, $PrtArray
    $text1 = GUICtrlCreateLabel("Bitte wählen Sie eines der folgenden Programme aus, in dem Sie den entsprechenden Button auswählen und mit OK bestätigen. Zum Beenden des Programms, bitte Exit wählen. Zum Löschen der Anzeige, Clear wählen.", 15, 10, 200, 80, -1, -1)
    $button_ok = GUICtrlCreateButton("OK", 10, 120, 200, 35, -1, -1)
    $button_clear = GUICtrlCreateButton("Clear", 10, 170, 90, 35, -1, -1)
    $button_exit = GUICtrlCreateButton("Exit", 125, 170, 90, 35, -1, -1)

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

    GUICtrlCreateGroup("1. Ihr PC-Name ist: ", 340, 10, 300, 50)
    GUICtrlCreateLabel(@ComputerName, 360, 30, 270, 20)

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

    GUICtrlCreateGroup("2. Ausführen des Ping auf Rechner:", 340, 70, 300, 90)
    $radio_2 = GUICtrlCreateRadio("srv01mail1", 350, 90, 140, 20)
    $radio_3 = GUICtrlCreateRadio(@ComputerName, 350, 110, 140, 20)
    $radio_4 = GUICtrlCreateRadio("srv32sis", 350, 130, 140, 20)
    $radio_1 = GUICtrlCreateRadio("eigene Eingabe:", 490, 90, 140, 20)

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

    GUICtrlCreateGroup("3. Netzwerktools", 340, 170, 300, 110)
    $radio_5 = GUICtrlCreateRadio("IP-Adressen des Rechners anzeigen", 350, 190, 280, 20)
    $radio_7 = GUICtrlCreateRadio("Policy-Refresh", 350, 210, 280, 20)
    $radio_8 = GUICtrlCreateRadio("NSLOOKUP auf Ditzingen / Böblingen", 350, 230, 280, 20)
    $radio_12 = GUICtrlCreateRadio("Trace Route auf Server x", 350, 250, 280, 20)

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

    GUICtrlCreateGroup("4. Windows Tools", 340, 290, 300, 90)
    $radio_9 = GUICtrlCreateRadio("Computermanagement öffnen", 350, 310, 280, 20)
    $radio_10 = GUICtrlCreateRadio("Eventviewer starten", 350, 330, 280, 20)
    $radio_11 = GUICtrlCreateRadio("Windows Remote Assistance starten", 350, 350, 280, 20)

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

    GUICtrlCreateGroup("5. Admin Tools", 340, 390, 300, 90)
    $radio_13 = GUICtrlCreateRadio("Firewall", 350, 410, 70, 20)
    $button_off = GUICtrlCreateButton("AUS", 530, 410, 80, 20, -1, -1)
    $button_on = GUICtrlCreateButton("AN", 430, 410, 80, 20, -1, -1)
    $radio_14 = GUICtrlCreateRadio("Lokalen Benutzer entsperren", 350, 430, 280, 20)
    $radio_6 = GUICtrlCreateRadio("DOS-Box mit Adminrechten starten", 350, 450, 280, 20)

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

    $out = GUICtrlCreateList("", 10, 230, 320, 250, ($ws_vscroll + $WS_BORDER + $LBS_NOTIFY + $LBS_NOINTEGRALHEIGHT))
    GUISetIcon("trash.ico", 0)
    GUISetState()
    $child = GUICreate("Test", 65, 49)
    GUISetState(@SW_HIDE, $child)

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

    While 1
    $msg = GUIGetMsg(1)
    Select
    Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $main
    Exit
    Case $msg = $button_clear And $msg[1] = $main
    ClearFields($out, $radio_2, $radio_3, $radio_4, $radio_5, $radio_6, $radio_7, $radio_8, $radio_9, $radio_10, $radio_11, $radio_12, $radio_13, $radio_14)
    Case $msg[0] = $button_exit
    Exit
    Case $msg[0] = $button_ok And (GUICtrlRead($radio_2) = $GUI_Checked) And $msg[1] = $main ; Ping srv01mail1
    PingServ("srv01mail1")

    Case $msg[0] = $button_ok And (GUICtrlRead($radio_3) = $GUI_Checked) And $msg[1] = $main ; Ping localhost
    PingServ(@ComputerName)

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

    Case $msg[0] = $button_ok And (GUICtrlRead($radio_4) = $GUI_Checked) And $msg[1] = $main ; Ping srv32sis
    PingServ("srv32sis")

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

    Case $msg[0] = $button_ok And (GUICtrlRead($radio_5) = $GUI_Checked) And $msg[1] = $main ; IP-Adresse anzeigen
    ClearFields($out, $radio_2, $radio_3, $radio_4, $radio_5, $radio_6, $radio_7, $radio_8, $radio_9, $radio_10, $radio_11, $radio_12, $radio_13, $radio_14)
    $stream = Run(@ComSpec & ' /c ' & $ipconfig, '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
    $text = ""
    While 1
    $textline = StdoutRead($stream)
    $text = $text & @CRLF & $textline
    If @error Then ExitLoop
    WEnd

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

    MsgBox(0, "STDOUT read:", $text)

    Case $msg[0] = $button_ok And (GUICtrlRead($radio_6) = $GUI_Checked) And $msg[1] = $main ; DOS-Box mit Adminrechten starten
    ClearFields($out, $radio_2, $radio_3, $radio_4, $radio_5, $radio_6, $radio_7, $radio_8, $radio_9, $radio_10, $radio_11, $radio_12, $radio_13, $radio_14)
    Run(@ComSpec & " /c " & $cmd, @SystemDir, @SW_SHOW)

    Case $msg[0] = $button_ok And (GUICtrlRead($radio_7) = $GUI_Checked) And $msg[1] = $main ; Policy Update
    ClearFields($out, $radio_2, $radio_3, $radio_4, $radio_5, $radio_6, $radio_7, $radio_8, $radio_9, $radio_10, $radio_11, $radio_12, $radio_13, $radio_14)
    GUICtrlSetData($out, "Refresh der Policy startet")
    Opt("WinWaitDelay", 100)
    Opt("WinTitleMatchMode", 4)
    Opt("WinDetectHiddenText", 1)
    Opt("MouseCoordMode", 0)
    Run('C:\WINDOWS\system32\cmd.exe', "", @SW_HIDE)
    WinWait("C:\WINDOWS\system32\cmd.exe", "")
    If Not WinActive("C:\WINDOWS\system32\cmd.exe", "") Then WinActivate("C:\WINDOWS\system32\cmd.exe", "")
    WinWaitActive("C:\WINDOWS\system32\cmd.exe", "")
    Send("gpupdate /force")
    Send("{ENTER}")
    GUICtrlSetData($out, "-------------------------------------------------------------" & "|" & "Bitte warten, die Policy wird erneuert.")
    Sleep(20000)
    Send("n" & "{ENTER}" & "exit" & "{ENTER}")
    GUICtrlSetData($out, "-------------------------------------------------------------" & "|" & "Die Policy wurde erfolgreich erneuert")
    Case $msg[0] = $button_ok And (GUICtrlRead($radio_8) = $GUI_Checked) And $msg[1] = $main ; nslookup auf beliebigen Server durchführen
    ClearFields($out, $radio_2, $radio_3, $radio_4, $radio_5, $radio_6, $radio_7, $radio_8, $radio_9, $radio_10, $radio_11, $radio_12, $radio_13, $radio_14)
    $server = InputBox("Nslookup auf Server X", "Bitte den Servernamen eingeben: ", "", " M")
    $stream = Run(@ComSpec & ' /c ' & $nslookup & " " & $server, '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
    $text = ""
    While 1
    $textline = StdoutRead($stream)
    $text = $text & @CRLF & $textline

    If @error Then ExitLoop
    WEnd
    MsgBox(0, "STDOUT read:", $text)
    Case $msg[0] = $button_ok And (GUICtrlRead($radio_9) = $GUI_Checked) And $msg[1] = $main; Computermanagement öffnen
    ClearFields($out, $radio_2, $radio_3, $radio_4, $radio_5, $radio_6, $radio_7, $radio_8, $radio_9, $radio_10, $radio_11, $radio_12, $radio_13, $radio_14)
    Run(@ComSpec & " /c " & 'compmgmt.msc', "", @SW_HIDE)

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

    Case $msg[0] = $button_ok And (GUICtrlRead($radio_10) = $GUI_Checked) And $msg[1] = $main; Eventviewer öffnen
    ClearFields($out, $radio_2, $radio_3, $radio_4, $radio_5, $radio_6, $radio_7, $radio_8, $radio_9, $radio_10, $radio_11, $radio_12, $radio_13, $radio_14)
    Run(@ComSpec & " /c " & 'eventvwr.msc', "", @SW_HIDE)

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

    Case $msg[0] = $button_ok And (GUICtrlRead($radio_11) = $GUI_Checked) And $msg[1] = $main; Windows remote Assistance
    ClearFields($out, $radio_2, $radio_3, $radio_4, $radio_5, $radio_6, $radio_7, $radio_8, $radio_9, $radio_10, $radio_11, $radio_12, $radio_13, $radio_14)
    Run($remoteaccess)

    Case $msg[0] = $button_ok And (GUICtrlRead($radio_12) = $GUI_Checked) And $msg[1] = $main ; Traceroute auf beliebigen Server durchführen
    ClearFields($out, $radio_2, $radio_3, $radio_4, $radio_5, $radio_6, $radio_7, $radio_8, $radio_9, $radio_10, $radio_11, $radio_12, $radio_13, $radio_14)
    $server = InputBox("Traceroute auf Server X", "Bitte den Servernamen eingeben: ", "", " M")
    $stream = Run(@ComSpec & ' /c ' & $tracert & " " & $server, '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
    $text = ""
    While 1
    $textline = StdoutRead($stream)
    $text = $text & @CRLF & $textline

    If @error Then ExitLoop
    WEnd
    MsgBox(0, "STDOUT read:", $text)

    Case $msg[0] = $button_ok And (GUICtrlRead($radio_13) = $GUI_Checked) And $msg[1] = $main; Meldung zum Start/Stop der Firewall anzeigen
    GUICtrlSetData($out, "Für das Aktivieren der Windows-Firewall bitte rechts den |AN Button drücken ||Für das Deaktivieren der Windows-Firewall bitte rechts den |AUS Button drücken")

    Case $msg[0] = $button_on And (GUICtrlRead($radio_13) = $GUI_Checked) And $msg[1] = $main; Firewall anschalten
    ClearFields($out, $radio_2, $radio_3, $radio_4, $radio_5, $radio_6, $radio_7, $radio_8, $radio_9, $radio_10, $radio_11, $radio_12, $radio_13, $radio_14)
    _startService ("", "sharedaccess")
    $err = @error
    Select
    Case $err = 0
    GUICtrlSetData($out, "Die Windows Firewall wurde gestartet")
    Case $err = 1056
    GUICtrlSetData($out, "Der Windows-Firewalldienst ist bereit aktiv")
    Case Else
    GUICtrlSetData($out, "Es sind Fehler aufgetreten,|der Dienst konnte nicht erfolgreich gestartet werden |Evtl fehlen die Admin-Berechtigungen")
    EndSelect

    Case $msg[0] = $button_off And (GUICtrlRead($radio_13) = $GUI_Checked) And $msg[1] = $main; Firewall abschalten
    ClearFields($out, $radio_2, $radio_3, $radio_4, $radio_5, $radio_6, $radio_7, $radio_8, $radio_9, $radio_10, $radio_11, $radio_12, $radio_13, $radio_14)
    _StopService ("", "sharedaccess")
    $err = @error
    Select
    Case $err = 0
    GUICtrlSetData($out, "Die Windows Firewall wurde erfolgreich gestopt")
    Case $err = 1062
    GUICtrlSetData($out, "Der Windows-Firewalldienst war bereit beendet")
    Case Else
    GUICtrlSetData($out, "Es sind Fehler aufgetreten,|der Dienst konnte nicht erfolgreich beendet werden |Evtl fehlen die Admin-Berechtigungen")
    EndSelect

    Case $msg[0] = $button_ok And (GUICtrlRead($radio_14) = $GUI_Checked) And $msg[1] = $main; Lokalen Benutzer entsperren
    ClearFields($out, $radio_2, $radio_3, $radio_4, $radio_5, $radio_6, $radio_7, $radio_8, $radio_9, $radio_10, $radio_11, $radio_12, $radio_13, $radio_14)
    case $msg[0] = $button_ok
    GUISetState(@SW_SHOW, $child)
    Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $child
    GUISetState(@SW_HIDE, $child)
    EndSelect

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

    WEnd

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

    Func ClearFields($out, $radio_2, $radio_3, $radio_4, $radio_5, $radio_6, $radio_7, $radio_8, $radio_9, $radio_10, $radio_11, $radio_12, $radio_13, $radio_14)
    _GUICtrlListClear($out)
    GUICtrlSetState($radio_2, $GUI_unchecked)
    GUICtrlSetState($radio_3, $GUI_unchecked)
    GUICtrlSetState($radio_4, $GUI_unchecked)
    GUICtrlSetState($radio_5, $GUI_unchecked)
    GUICtrlSetState($radio_6, $GUI_unchecked)
    GUICtrlSetState($radio_7, $GUI_unchecked)
    GUICtrlSetState($radio_8, $GUI_unchecked)
    GUICtrlSetState($radio_9, $GUI_unchecked)
    GUICtrlSetState($radio_10, $GUI_unchecked)
    GUICtrlSetState($radio_11, $GUI_unchecked)
    GUICtrlSetState($radio_12, $GUI_unchecked)
    GUICtrlSetState($radio_13, $GUI_unchecked)
    GUICtrlSetState($radio_14, $GUI_unchecked)
    EndFunc ;==>ClearFields

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

    Func PingServ($ping)
    ClearFields($out, $radio_2, $radio_3, $radio_4, $radio_5, $radio_6, $radio_7, $radio_8, $radio_9, $radio_10, $radio_11, $radio_12, $radio_13, $radio_14)
    GUICtrlSetData($out, "Please wait...")
    $i = Run(@ComSpec & " /c ping " & $ping, @SystemDir, @SW_HIDE, $STDOUT_CHILD + $STDERR_CHILD)
    ProcessWaitClose($i)
    $h = StdoutRead($i)
    If @error = 0 Then $Prt = $h
    $h = StderrRead($i)
    If @error = 0 Then $Prt = $h
    $Prt = StringReplace($Prt, Chr(154), "Ü")
    $Prt = StringReplace($Prt, Chr(129), "ü")
    $Prt = StringReplace($Prt, Chr(142), "Ä")
    $Prt = StringReplace($Prt, Chr(132), "ä")
    $Prt = StringReplace($Prt, Chr(153), "Ö")
    $Prt = StringReplace($Prt, Chr(148), "ö")
    $Prt = StringReplace($Prt, Chr(10), "")
    $Zeilen = StringSplit($Prt, @CR)
    ClearFields($out, $radio_2, $radio_3, $radio_4, $radio_5, $radio_6, $radio_7, $radio_8, $radio_9, $radio_10, $radio_11, $radio_12, $radio_13, $radio_14)
    For $v = 1 To $Zeilen[0] Step 1
    If StringLen(StringStripWS($Zeilen[$v], 8)) > 0 Then
    GUICtrlSetData($out, ($Zeilen[$v]) & "|")
    EndIf
    Next
    EndFunc ;==>PingServ

    [/autoit]

    Wenn du jetzt auf ok klickst, kommt deine TestGUI.

    So long,

    Mega

  • Gute idee, will ja auch keine Nervensäge sein, wenns ein Tut gibt, umso besser!

    @Meger: Nachdem ich 1-2 kleine Fehlerchen raus hatte, läufts nun so wis aussieht. Auch wenn irgendwas no net stimmt, weil er manchmal so Bildflackerer drin hat und manchmal die GUI auch bei anderen Radio_Buttons nach Ausführung des eigentlichen Progs startet.

    • Offizieller Beitrag

    Hi,

    das liegt dann alles an der Logik. Du mußt dir die einzelnen Fälle in den case Zweigen angucken. Immer wenn die zutreffen, dann wird das ausgeführt. Wenn also (ich hatte das eingefügt) einfach nur okay geklickt wird ohne Radio Button, dann wird die Gui sichtbar gemacht.

    So long,

    Mega

  • Klar, das hab ich geändert ;)

    Läuft nun auch super.

    Bin jetzt schon weiter und erstelle das eigentliche Programm innerhalb der neuen GUI.


    Besteht Interesse, dass ich mein Projekt "Dau-Hilfe-Skript" hier vorstelle, wenn ich soweit fertig bin?