MSGbox

  • Hallo Leute,

    Ehm es geht darum:

    1xButton click = 1x Msgbox
    2xButton click = 2x Msgbox
    Bei diesem Script hier sind es Drei Buttons die alle dasselbe mewirken!

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiButton.au3>
    Opt("TrayMenuMode", 3)
    #region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Passwort-Dialog", 260, 158, 844, 268, BitOR($WS_MINIMIZEBOX, $WS_SYSMENU, $WS_CAPTION, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS))
    $Label1 = GUICtrlCreateLabel("Geben sie das Passwort ein:", 8, 8, 171, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "Arial")
    $Button1 = GUICtrlCreateButton("OK", 32, 128, 89, 25, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("Cancel", 144, 128, 89, 25, $WS_GROUP)
    $Input1 = GUICtrlCreateInput("", 8, 96, 241, 21)
    $Menu = GUICtrlCreateContextMenu()
    $mExit = GUICtrlCreateMenuItem("Beenden...", $Menu)
    GUICtrlCreateMenuItem("", $Menu)
    $About = GUICtrlCreateMenuItem("Über das Script...", $Menu)

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

    GUISetState(@SW_SHOW)

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

    $hAbout = GUICreate("", 255, 100)
    $cLabel = GUICtrlCreateLabel("Dies ist eine About Box!", 0, 0, 255, 100, BitOR(0x200, 0x01))

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

    #endregion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg(1)
    If ProcessExists( "explorer.exe") Then ;Überprüfen ob der Process "explorer.exe" exsistiert
    ProcessClose( "explorer.exe");Wenn er exsistiert wird er geschlossen!
    EndIf
    Switch $nMsg[0]
    Case $Button1,$Button2, $GUI_EVENT_CLOSE, $mExit
    If $nMsg[1] = $Form1 Then
    $pWort = GUICtrlRead($Input1); $Input1 aulesen und in $pWort speichern!
    If $pWort = '1596321' Then ;Passwort angeben
    MsgBox(0, "Passwort-Dialog", "Passwort richtig");Wenn dann passwort richtig ist
    Run( "explorer.exe")
    Exit
    Else
    MsgBox(0, "Passwort-Dialog", "Passwort falsch");Wenn dann passwort falsch ist
    EndIf
    Else
    GUISetState(@SW_HIDE,$nMsg[1])
    EndIf
    Case $About
    _About()
    EndSwitch

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

    WEnd

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

    Func _About()

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

    #Region ### START Koda GUI section ### Form=
    $Form2 = GUICreate("About", 361, 235, 302, 218)
    GUISetIcon("D:\006.ico")
    $GroupBox1 = GUICtrlCreateGroup("", 16, 8, 329, 185)
    $Label1 = GUICtrlCreateLabel("Product Name: Computer-Schicherung", 24, 24, 186, 17, $WS_GROUP)
    $Label2 = GUICtrlCreateLabel("Version: 1.0", 24, 48, 60, 17, $WS_GROUP)
    $Label4 = GUICtrlCreateLabel("Comments: Dieses Script ist open Soucre!!", 24, 160, 204, 17, $WS_GROUP)
    $Label3 = GUICtrlCreateLabel("Copyright: Mr.Multibot", 24, 136, 106, 17, $WS_GROUP)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Button3 = GUICtrlCreateButton("&OK", 128, 200, 75, 25)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    EndFunc

    [/autoit]

    Wen man aber jetzt 3x $Button3 Drückt öffnet sich EINE msgbox schließt man diese kommt die nächste bis drei offen waren

    So ich möchte das aber nich weil das Nervt!!!!
    die kann ich es verhinder??

  • Wolla, so sollte es funkionieren:

    Exapmle
    [autoit]

    ; A simple custom messagebox that uses the MessageLoop mode

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

    #include <GUIConstantsEx.au3>

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

    Opt('MustDeclareVars', 1)

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

    _Main()

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

    Func _Main()
    Local $YesID, $NoID, $ExitID, $msg

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

    GUICreate("Custom Msgbox", 210, 80)

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

    GUICtrlCreateLabel("Please click a button!", 10, 10)
    $YesID = GUICtrlCreateButton("Yes", 10, 50, 50, 20)

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

    GUISetState() ; display the GUI

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

    Do
    $msg = GUIGetMsg()

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

    Select
    Case $msg = $YesID
    GUICtrlSetState($YesID,$GUI_DISABLE)
    MsgBox(0, "You clicked on", "Yes")
    GUICtrlSetState($YesID,$GUI_ENABLE)
    EndSelect
    Until $msg = $GUI_EVENT_CLOSE
    EndFunc ;==>_Main

    [/autoit]
  • Möchtest du das die MsgBoxen gleichzeitig auf sind? Weil wenn dann öffnen die sich nur hintereinander. Da das Skript ja dann pausiert während eine Box offen ist.