Hilfe bei Inputbox abfrage

  • Ich habe wie oben gesagt ein problem oder besser gesagt eine frage zur inputbox. Hoffe kann wer helfen ;D

    Folgendes ich hab eine inputbox in der soll man eine gewünschte ip eintragen und dan über einen button soll diese angepingt werden.

    Könnte mir da mal wer ein beispiel script posten. hab kein plan wie des funktionieren soll :wacko: . Achja wäre noch nice wenn des pingen in ner if abfrage wäre, dass wen das pingen fehlgeschlagen ist ne msgbox kommt wo dann, "offline" oder so steht.


    danke schonmal fürs lesen

    Einmal editiert, zuletzt von zausel3112 (22. Oktober 2009 um 13:22)

  • SO:

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

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

    $Form1 = GUICreate("Ping", 625, 138, -1, -1)
    GUISetBkColor(0xFFFF00)
    $Input1 = GUICtrlCreateInput("", 8, 8, 607, 38, BitOR($ES_CENTER, $ES_AUTOHSCROLL))
    GUICtrlSetFont(-1, 16, 800, 0, "Arial Black")
    GUICtrlSetState(-1, $GUI_FOCUS)
    $Button1 = GUICtrlCreateButton("OK", 8, 56, 607, 77, $WS_GROUP)
    GUICtrlSetFont(-1, 16, 800, 0, "Arial Black")
    GUICtrlSetState(-1, $GUI_DEFBUTTON)
    GUISetState(@SW_SHOW)

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

    While 1
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    $var = Ping(GUICtrlRead($Input1), 250)
    If $var Then
    MsgBox(0, "Status", "Online! Antwortzeit war: " & $var)
    Else
    MsgBox(0, "Status", "Offline!")
    EndIf
    GUICtrlSetData($Input1, "")
    GUICtrlSetState($Input1, $GUI_FOCUS)
    EndSwitch
    WEnd

    [/autoit]

    Magnus

  • Meine Lösung

    Spoiler anzeigen
    [autoit]

    #include "RestrictControlRegExp.au3"

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

    Opt("GUIOnEventMode", 1)

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

    _RegEx_RestrictControl_setup (1) ; prepare for up to 1 Control to restrict

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

    GUICreate("Ping", 200, 70)
    GUISetOnEvent(-3, "_quit")
    $Input = GUICtrlCreateInput("", 10, 10, 100, 20)
    _RegEx_RestrictControl_add ($Input, "^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\." & _
    "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\." & _
    "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\." & _
    "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$", "255.255.0.0")

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

    $Ping = GUICtrlCreateButton("Ping", 120, 10, 50, 20)
    GUICtrlSetOnEvent(-1, "_Ping")
    $Label = GUICtrlCreateLabel("", 10, 40, 180, 20)
    GUISetState()

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

    While 1
    Sleep(10)
    WEnd

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

    Func _Ping()
    Local $IP = GUICtrlRead($Input, 1000)
    Local $Res = Ping($IP)
    If $Res > 0 Then
    GUICtrlSetData($Label, $IP & " ist erreichbar.")
    Else
    GUICtrlSetData($Label, $IP & " ist nicht erreichbar!")
    EndIf
    EndFunc

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

    Func _quit()
    Exit
    EndFunc ;==>_quit

    [/autoit]
  • sollten schon ziemlich viel abdecken....

    [autoit]

    _GUICtrlIpAddress_Create()
    _GUICtrlIpAddress_SetRange()

    [/autoit]