CMD formatierungs problem

  • So ich habe an eienm pinger geschrieben der alle ausgaben auf CMD geben soll die UDF habe ich aus dem bord... weiß leider blos leider nich mehr aus welchem post

    [autoit]

    #include<CMD.au3>
    Global Const $_CMD_USEWINDOW = True
    Global $info, $DNS_zu_IP ,$DNS ,$IP_DNS, $error = 0, $n = 0, $send = 0, $recev = 0, $lost = 0 ,$Ping_D ,$Ping_G ,$Ping_min ,$Ping_max ,$anzahl_pings,$T

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

    _CMD_STARTUP()
    _CMD_Write("********************************************************************************")
    _CMD_Write("Ping Maker by_Matthias_199"&@CRLF)
    _CMD_Write("********************************************************************************")
    _CMD_Write("Bitte IP/DNS eingeben : ")
    $IP = _CMD_READ()
    _CMD_Write("Bitte Ping Anzahl eingeben : ")
    $anzahl_pings = _CMD_READ()
    $anzahl_pings=Int ($anzahl_pings)

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

    If $anzahl_pings = 0 Then
    _CMD_Write("Ping Anzahl Fehlerhaft. Bitte neustarten und neu eingeben")
    _CMD_READ()
    Exit
    EndIf

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

    Dim $Ping[$anzahl_pings]
    Dim $Error[$anzahl_pings]

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

    $Step_1 = StringReplace ( $IP, ".", "")
    $Step_2 = Number ($Step_1)
    If $Step_2 = 0 Then
    TCPStartup()
    $DNS_zu_IP = TCPNameToIP ($IP)
    If $DNS_zu_IP = "" Then
    $IP = "Nicht verfügbar"
    $DNS = "Nicht verfügbar"
    $error = 1
    Else
    $DNS = $IP
    $IP = $DNS_zu_IP
    EndIf
    TCPShutdown ()
    Else
    $DNS = "Nicht verfügbar"
    EndIf

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

    If $error = 1 then
    _CMD_Write("IP/DNS Fehlerhaft. Bitte neustarten und neu eingeben")
    _CMD_READ()
    Exit
    EndIf

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

    _CMD_Write("********************************************************************************"&@CRLF)
    _CMD_Write("IP: "&$IP&@CRLF)
    _CMD_Write("DNS: "&$DNS&@CRLF)
    _CMD_Write("********************************************************************************"&@CRLF)
    Sleep(1000)

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

    While 1
    $Ping[$n] = Ping ($IP,999)
    $Error[$n] = @error
    $send = $send +1
    If $Ping[$n] > 0 Then
    $var = StringFormat ( "Antwort von %s Antwortszeit = %sms",$IP,$Ping[$n])
    _CMD_Write(""&$var&@CRLF)
    $recev = $recev +1
    Else
    If $Error[$n] = 1 Then
    $Text = "Der Computer ist offline"
    ElseIf $Error[$n] = 2 Then
    $Text = "Der Computer ist nicht erreichbar"
    ElseIf $Error[$n] = 3 Then
    $Text = "Falsche Adresse"
    ElseIf $Error[$n] = 4 Then
    $Text = "Andere Fehler"
    EndIf
    _CMD_Write("Keine Antwort von "&$IP&"!"&"Fehlercode "&$Error[$n]&" : "&$Text&""&@CRLF)
    $lost = $lost +1
    EndIf
    If $n = ($anzahl_pings-1) then ExitLoop
    $n = $n + 1
    Sleep(1000)
    WEnd

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

    _CMD_Write("********************************************************************************")
    _CMD_Write("Ping Statistik für "&$IP&@CRLF)
    _CMD_Write("********************************************************************************")
    _CMD_Write("Gesendete Pakete = "&$send&@CRLF)
    _CMD_Write("Empfangene Pakete = "&$recev&@CRLF)
    _CMD_Write("Verlorene Pakete = "&$lost&@CRLF)
    $P_Verlust = Round (($lost/$send)*100)
    _CMD_Write("Datenverlust = "&$P_Verlust&"%"&@CRLF)
    _CMD_Write("********************************************************************************")

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

    $n = 0
    While 1
    If $Ping[$n] > 0 Then
    $Ping_G = $Ping_G + $Ping[$n]
    EndIf
    If $n = ($anzahl_pings-1) then ExitLoop
    $n = $n + 1
    Sleep(50)
    WEnd

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

    $Ping_D = Round (($Ping_G/$send))

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

    $n = 0
    $Ping_min = 999
    While 1
    If $Ping[$n] > 0 Then
    If $Ping_min > $Ping[$n] Then
    $Ping_min = $Ping[$n]
    EndIf
    EndIf
    If $n = ($anzahl_pings-1) then ExitLoop
    $n = $n + 1
    Sleep(50)
    WEnd

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

    $n = 0
    $Ping_max = 0
    While 1
    If $Ping[$n] > 0 Then
    If $Ping_max < $Ping[$n] Then
    $Ping_max = $Ping[$n]
    EndIf
    EndIf
    If $n = ($anzahl_pings-1) then ExitLoop
    $n = $n + 1
    Sleep(50)
    WEnd

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

    _CMD_Write("Durchschnittlicher Ping = "&$Ping_D&"ms"&@CRLF)
    _CMD_Write("Minimaler Ping = "&$Ping_min&"ms"&@CRLF)
    _CMD_Write("Maximaler Ping = "&$Ping_max&"ms"&@CRLF)
    _CMD_Write("********************************************************************************")

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

    _CMD_PAUSE()

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

    Ja das Problem ist die formatierung.......
    Das komm schlecht formatiert raus und kann mir nich erklären woran es liegt da sind ja große unterschiede drinnen wie dan manchmal die ausgabe rauskommt...
    Probiert es mal mit ner IP ne DNS und auch der falschen IP das die pings fehlschlagen

    MFG Matthias

  • von Hier

    [ gelöst ] Ausgabe in CMD mittlerweile möglich ?

    [autoit]

    #AutoIt3Wrapper_Change2CUI=y
    #include<WinAPI.au3>
    Global $GLOBAL_hConsole,$GLOBAL_hConsoleIn
    ; Initialize the CMD Funcs
    ; Parameter: [Opt] $ExitOnFatal - If True, The App exits with Fatal error if an error occurs in this Function (Default: False)
    ; Return values: Success: 1
    ; Error: 0 and @error:
    ; 1 - Could not allocate Console -> no In or outuput-Handle
    ; 2 - GetStdHandle for Output failed -> No Output-Handle, too
    ; 3 - GetStdHandle for Input failed, but we have an Ouput-Handle
    ;Author: Prog@ndy
    Func _CMD_STARTUP($ExitOnFatal=0)
    if not _WinAPI_AttachConsole() then
    $ret = DllCall("Kernel32.dll", "long", "AllocConsole")
    If $ret = 0 Then
    If $ExitOnFatal Then _WinAPI_FatalAppExit("Could not allocate Console")
    Return SetError(1,0,0)
    EndIf
    EndIf
    Global $GLOBAL_hConsole = _WinAPI_GetStdHandle(1)
    if $GLOBAL_hConsole= -1 then
    If $ExitOnFatal Then _WinAPI_FatalAppExit("GetStdHandle for Output failed")
    Return SetError(2,0,0)
    EndIf
    Global $GLOBAL_hConsoleIn = _WinAPI_GetStdHandle(0)
    if $GLOBAL_hConsoleIn = -1 then
    If $ExitOnFatal Then _WinAPI_FatalAppExit("GetStdHandle for Input failed")
    Return SetError(1,0,0)
    EndIf
    Return 1
    EndFunc

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

    ; PASUES CMD, waits for ENTER
    ;Prog@ndy
    Func _CMD_PAUSE()
    _CMD_Write("PAUSE: ENTER drücken")
    _CMD_READ()
    EndFunc

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

    ;Writes Text to CMD
    ;Prog@ndy
    Func _CMD_Write($text)
    Local $temp = _WinAPI_WriteConsole($GLOBAL_hConsole, CharToOem($text))
    Return SetError(@error,@extended,$temp)
    EndFunc

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

    ;REads Text from CMD
    ;Prog@ndy
    Func _CMD_READ()
    Local $test = DllStructCreate("char[10000]")
    Local $read = 5000
    Local $temp = _WinAPI_ReadFile($GLOBAL_hConsoleIn,DllStructGetPtr($test),DllStructGetSize($test),$read)
    If @error Then Return SetError(@error,@extended,$temp)
    Return OemToChar(DllStructGetData($test,1))
    EndFunc

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

    ;===============================================================================
    ; Name: OemToChar
    ; Description: Wandelt einen ASCII- in einen ANSI-String
    ; Parameter(s): $szSrc = String der umgewandelt werden soll
    ; Requirement(s): keine
    ; Return Value(s): bei Erfolg: umgewandelter String
    ; bei Fehler: "" und @error = 1
    ; Author(s): bernd670
    ;===============================================================================
    Func OemToChar($szSrc)
    ;~ Private Declare Function OemToChar Lib "user32.dll" Alias "OemToCharA" (ByVal lpszSrc As String, ByVal lpszDst As String) As Long
    Local $placeholder
    For $i = 0 To StringLen($szSrc)
    $placeholder &= " "
    Next
    Local $lRetVal = DllCall("user32.dll", "long", "OemToChar", "str", $szSrc, "str",$placeholder)
    If IsArray($lRetVal) And $lRetVal[0] = 1 Then
    Return SetError(0,0,$lRetVal[2])
    EndIf

    Return SetError(1,0,"")
    EndFunc ;==>OemToChar

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

    ;===============================================================================
    ; Name: CharToOEM
    ; Description: Wandelt einen ANSI- in einen ASCII-String
    ; Parameter(s): $szSrc = String der umgewandelt werden soll
    ; Requirement(s): keine
    ; Return Value(s): bei Erfolg: umgewandelter String
    ; bei Fehler: "" und @error = 1
    ; Author(s): Prog@ndy
    ;===============================================================================
    Func CharToOEM($szSrc)
    Local $placeholder
    For $i = 0 To StringLen($szSrc)
    $placeholder &= " "
    Next
    Local $lRetVal = DllCall("user32.dll", "long", "CharToOem", "str", $szSrc, "str",$placeholder)
    If IsArray($lRetVal) And $lRetVal[0] = 1 Then
    Return SetError(0,0,$lRetVal[2])
    EndIf

    #AutoIt3Wrapper_Change2CUI=y
    #include<WinAPI.au3>
    Global $GLOBAL_hConsole,$GLOBAL_hConsoleIn
    ; Initialize the CMD Funcs
    ; Parameter: [Opt] $ExitOnFatal - If True, The App exits with Fatal error if an error occurs in this Function (Default: False)
    ; Return values: Success: 1
    ; Error: 0 and @error:
    ; 1 - Could not allocate Console -> no In or outuput-Handle
    ; 2 - GetStdHandle for Output failed -> No Output-Handle, too
    ; 3 - GetStdHandle for Input failed, but we have an Ouput-Handle
    ;Author: Prog@ndy
    Func _CMD_STARTUP($ExitOnFatal=0)
    if not _WinAPI_AttachConsole() then
    $ret = DllCall("Kernel32.dll", "long", "AllocConsole")
    If $ret = 0 Then
    If $ExitOnFatal Then _WinAPI_FatalAppExit("Could not allocate Console")
    Return SetError(1,0,0)
    EndIf
    EndIf
    Global $GLOBAL_hConsole = _WinAPI_GetStdHandle(1)
    if $GLOBAL_hConsole= -1 then
    If $ExitOnFatal Then _WinAPI_FatalAppExit("GetStdHandle for Output failed")
    Return SetError(2,0,0)
    EndIf
    Global $GLOBAL_hConsoleIn = _WinAPI_GetStdHandle(0)
    if $GLOBAL_hConsoleIn = -1 then
    If $ExitOnFatal Then _WinAPI_FatalAppExit("GetStdHandle for Input failed")
    Return SetError(1,0,0)
    EndIf
    Return 1
    EndFunc

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

    ; PASUES CMD, waits for ENTER
    ;Prog@ndy
    Func _CMD_PAUSE()
    _CMD_Write("PAUSE: ENTER drücken")
    _CMD_READ()
    EndFunc

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

    ;Writes Text to CMD
    ;Prog@ndy
    Func _CMD_Write($text)
    Local $temp = _WinAPI_WriteConsole($GLOBAL_hConsole, CharToOem($text))
    Return SetError(@error,@extended,$temp)
    EndFunc

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

    ;REads Text from CMD
    ;Prog@ndy
    Func _CMD_READ()
    Local $test = DllStructCreate("char[10000]")
    Local $read = 5000
    Local $temp = _WinAPI_ReadFile($GLOBAL_hConsoleIn,DllStructGetPtr($test),DllStructGetSize($test),$read)
    If @error Then Return SetError(@error,@extended,$temp)
    Return OemToChar(DllStructGetData($test,1))
    EndFunc

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

    ;===============================================================================
    ; Name: OemToChar
    ; Description: Wandelt einen ASCII- in einen ANSI-String
    ; Parameter(s): $szSrc = String der umgewandelt werden soll
    ; Requirement(s): keine
    ; Return Value(s): bei Erfolg: umgewandelter String
    ; bei Fehler: "" und @error = 1
    ; Author(s): bernd670
    ;===============================================================================
    Func OemToChar($szSrc)
    ;~ Private Declare Function OemToChar Lib "user32.dll" Alias "OemToCharA" (ByVal lpszSrc As String, ByVal lpszDst As String) As Long
    Local $placeholder
    For $i = 0 To StringLen($szSrc)
    $placeholder &= " "
    Next
    Local $lRetVal = DllCall("user32.dll", "long", "OemToChar", "str", $szSrc, "str",$placeholder)
    If IsArray($lRetVal) And $lRetVal[0] = 1 Then
    Return SetError(0,0,$lRetVal[2])
    EndIf

    Return SetError(1,0,"")
    EndFunc ;==>OemToChar

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

    ;===============================================================================
    ; Name: CharToOEM
    ; Description: Wandelt einen ANSI- in einen ASCII-String
    ; Parameter(s): $szSrc = String der umgewandelt werden soll
    ; Requirement(s): keine
    ; Return Value(s): bei Erfolg: umgewandelter String
    ; bei Fehler: "" und @error = 1
    ; Author(s): Prog@ndy
    ;===============================================================================
    Func CharToOEM($szSrc)
    Local $placeholder
    For $i = 0 To StringLen($szSrc)
    $placeholder &= " "
    Next
    Local $lRetVal = DllCall("user32.dll", "long", "CharToOem", "str", $szSrc, "str",$placeholder)
    If IsArray($lRetVal) And $lRetVal[0] = 1 Then
    Return SetError(0,0,$lRetVal[2])
    EndIf

    Return SetError(1,0,"")
    EndFunc ;==>OemToChar

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

    _CMD_STARTUP(True) ; IMPORTANT !!!!!

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

    _CMD_Write("Bitte Name eingeben: ")
    $name = _CMD_READ()
    MsgBox(0, '', $name)
    _CMD_Write("Hallo, " &$name & @CRLF)
    _CMD_PAUSE()

    if not _CMD_Write("Hello World" & @CRLF) then
    MsgBox(0, "Error", "WriteConsole Failed")
    endif Return SetError(1,0,"")
    EndFunc ;==>OemToChar

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

    _CMD_STARTUP(True) ; IMPORTANT !!!!!

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

    _CMD_Write("Bitte Name eingeben: ")
    $name = _CMD_READ()
    MsgBox(0, '', $name)
    _CMD_Write("Hallo, " &$name & @CRLF)
    _CMD_PAUSE()

    if not _CMD_Write("Hello World" & @CRLF) then
    MsgBox(0, "Error", "WriteConsole Failed")
    endif

    [/autoit]
  • Hallo,

    ich hab mir das mal angeschaut,

    und festgestellt das _CMD_READ nicht auf eine Eingabe Wartet, bist du sicher das das so Funktiopnieren soll?
    Und, HInter denFragen solltet du noch ein @crlf einfürgen.

    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_Change2CUI=y
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include<CMD.au3>
    Global Const $_CMD_USEWINDOW = True
    Global $info, $DNS_zu_IP ,$DNS ,$IP_DNS, $error = 0, $n = 0, $send = 0, $recev = 0, $lost = 0 ,$Ping_D ,$Ping_G ,$Ping_min ,$Ping_max ,$anzahl_pings,$T

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

    _CMD_STARTUP()
    _CMD_Write("********************************************************************************"&@CRLF)
    _CMD_Write("Ping Maker by_Matthias_199"&@CRLF)
    _CMD_Write("********************************************************************************"&@CRLF)
    _CMD_Write("Bitte IP/DNS eingeben : "&@CRLF)
    $IP = _CMD_READ()
    _CMD_Write("Bitte Ping Anzahl eingeben : "&@CRLF)
    $anzahl_pings = _CMD_READ()
    $anzahl_pings=Int ($anzahl_pings)

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

    If $anzahl_pings = 0 Then
    _CMD_Write("Ping Anzahl Fehlerhaft. Bitte neustarten und neu eingeben"&@CRLF)
    _CMD_READ()
    Exit
    EndIf

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

    Dim $Ping[$anzahl_pings]
    Dim $Error[$anzahl_pings]

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

    $Step_1 = StringReplace ( $IP, ".", "")
    $Step_2 = Number ($Step_1)
    If $Step_2 = 0 Then
    TCPStartup()
    $DNS_zu_IP = TCPNameToIP ($IP)
    If $DNS_zu_IP = "" Then
    $IP = "Nicht verfügbar"
    $DNS = "Nicht verfügbar"
    $error = 1
    Else
    $DNS = $IP
    $IP = $DNS_zu_IP
    EndIf
    TCPShutdown ()
    Else
    $DNS = "Nicht verfügbar"
    EndIf

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

    If $error = 1 then
    _CMD_Write("IP/DNS Fehlerhaft. Bitte neustarten und neu eingeben"&@CRLF)
    _CMD_READ()
    Exit
    EndIf

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

    _CMD_Write("********************************************************************************"&@CRLF)
    _CMD_Write("IP: "&$IP&@CRLF)
    _CMD_Write("DNS: "&$DNS&@CRLF)
    _CMD_Write("********************************************************************************"&@CRLF)
    Sleep(1000)

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

    While 1
    $Ping[$n] = Ping ($IP,999)
    $Error[$n] = @error
    $send = $send +1
    If $Ping[$n] > 0 Then
    $var = StringFormat ( "Antwort von %s Antwortszeit = %sms",$IP,$Ping[$n]&@CRLF)
    _CMD_Write(""&$var&@CRLF)
    $recev = $recev +1
    Else
    If $Error[$n] = 1 Then
    $Text = "Der Computer ist offline"
    ElseIf $Error[$n] = 2 Then
    $Text = "Der Computer ist nicht erreichbar"
    ElseIf $Error[$n] = 3 Then
    $Text = "Falsche Adresse"
    ElseIf $Error[$n] = 4 Then
    $Text = "Andere Fehler"
    EndIf
    _CMD_Write("Keine Antwort von "&$IP&"!"&"Fehlercode "&$Error[$n]&" : "&$Text&""&@CRLF)
    $lost = $lost +1
    EndIf
    If $n = ($anzahl_pings-1) then ExitLoop
    $n = $n + 1
    Sleep(1000)
    WEnd

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

    _CMD_Write("********************************************************************************"&@CRLF)
    _CMD_Write("Ping Statistik für "&$IP&@CRLF)
    _CMD_Write("********************************************************************************"&@CRLF)
    _CMD_Write("Gesendete Pakete = "&$send&@CRLF)
    _CMD_Write("Empfangene Pakete = "&$recev&@CRLF)
    _CMD_Write("Verlorene Pakete = "&$lost&@CRLF)
    $P_Verlust = Round (($lost/$send)*100)
    _CMD_Write("Datenverlust = "&$P_Verlust&"%"&@CRLF)
    _CMD_Write("********************************************************************************"&@CRLF)

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

    $n = 0
    While 1
    If $Ping[$n] > 0 Then
    $Ping_G = $Ping_G + $Ping[$n]
    EndIf
    If $n = ($anzahl_pings-1) then ExitLoop
    $n = $n + 1
    Sleep(50)
    WEnd

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

    $Ping_D = Round (($Ping_G/$send))

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

    $n = 0
    $Ping_min = 999
    While 1
    If $Ping[$n] > 0 Then
    If $Ping_min > $Ping[$n] Then
    $Ping_min = $Ping[$n]
    EndIf
    EndIf
    If $n = ($anzahl_pings-1) then ExitLoop
    $n = $n + 1
    Sleep(50)
    WEnd

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

    $n = 0
    $Ping_max = 0
    While 1
    If $Ping[$n] > 0 Then
    If $Ping_max < $Ping[$n] Then
    $Ping_max = $Ping[$n]
    EndIf
    EndIf
    If $n = ($anzahl_pings-1) then ExitLoop
    $n = $n + 1
    Sleep(50)
    WEnd

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

    _CMD_Write("Durchschnittlicher Ping = "&$Ping_D&"ms"&@CRLF)
    _CMD_Write("Minimaler Ping = "&$Ping_min&"ms"&@CRLF)
    _CMD_Write("Maximaler Ping = "&$Ping_max&"ms"&@CRLF)
    _CMD_Write("********************************************************************************"&@CRLF)

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

    _CMD_PAUSE()

    [/autoit]
  • also bi mir wartet der mit _CMDRead bis ich was eingabe

    und bei den *********************************** braucht man kein @CRLF

    weil das 70 oder 80 sind als pringt die box von selber in die neue zeile

  • so funktioniert es bei mir und Sieht gut aus,

    ich denke du hast das Problem das $IP noch ein @crlf drin ist.

    Spoiler anzeigen
    [autoit]

    #include<CMD.au3>
    Global Const $_CMD_USEWINDOW = True
    Global $info, $DNS_zu_IP ,$DNS ,$IP_DNS, $error = 0, $n = 0, $send = 0, $recev = 0, $lost = 0 ,$Ping_D ,$Ping_G ,$Ping_min ,$Ping_max ,$anzahl_pings,$T

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

    _CMD_STARTUP()
    _CMD_Write(@CRLF)
    _CMD_Write("********************************************************************************")
    _CMD_Write("Ping Maker by_Matthias_199"&@CRLF)
    _CMD_Write("********************************************************************************")
    _CMD_Write("Bitte IP/DNS eingeben : "&@CRLF)
    $IP = StringReplace(_CMD_READ(),@CRLF,"")
    _CMD_Write("Bitte Ping Anzahl eingeben : "&@CRLF)
    $anzahl_pings = _CMD_READ()
    $anzahl_pings=Int ($anzahl_pings)

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

    If $anzahl_pings = 0 Then
    _CMD_Write("Ping Anzahl Fehlerhaft. Bitte neustarten und neu eingeben"&@CRLF)
    _CMD_READ()
    Exit
    EndIf

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

    Dim $Ping[$anzahl_pings]
    Dim $Error[$anzahl_pings]

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

    $Step_1 = StringReplace ( $IP, ".", "")
    $Step_2 = Number ($Step_1)
    If $Step_2 = 0 Then
    TCPStartup()
    $DNS_zu_IP = TCPNameToIP ($IP)
    If $DNS_zu_IP = "" Then
    $IP = "Nicht verfügbar"
    $DNS = "Nicht verfügbar"
    $error = 1
    Else
    $DNS = $IP
    $IP = $DNS_zu_IP
    EndIf
    TCPShutdown ()
    Else
    $DNS = "Nicht verfügbar"
    EndIf

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

    If $error = 1 then
    _CMD_Write("IP/DNS Fehlerhaft. Bitte neustarten und neu eingeben"&@CRLF)
    _CMD_READ()
    Exit
    EndIf

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

    _CMD_Write("********************************************************************************")
    _CMD_Write("IP: "&$IP&@CRLF)
    _CMD_Write("DNS: "&$DNS&@CRLF)
    _CMD_Write("********************************************************************************")
    Sleep(1000)

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

    While 1
    $Ping[$n] = Ping ($IP,999)
    $Error[$n] = @error
    $send = $send +1
    If $Ping[$n] > 0 Then
    _CMD_Write("Antwort von " & $IP & " Antwortszeit = "&$Ping[$n]&" ms" &@CRLF)
    $recev = $recev +1
    Else
    If $Error[$n] = 1 Then
    $Text = "Der Computer ist offline"
    ElseIf $Error[$n] = 2 Then
    $Text = "Der Computer ist nicht erreichbar"
    ElseIf $Error[$n] = 3 Then
    $Text = "Falsche Adresse"
    ElseIf $Error[$n] = 4 Then
    $Text = "Andere Fehler"
    EndIf
    _CMD_Write("Keine Antwort von "&$IP&"!"&"Fehlercode "&$Error[$n]&" : "&$Text&""&@CRLF)
    $lost = $lost +1
    EndIf
    If $n = ($anzahl_pings-1) then ExitLoop
    $n = $n + 1
    Sleep(1000)
    WEnd

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

    _CMD_Write("********************************************************************************")
    _CMD_Write("Ping Statistik für "&$IP&@CRLF)
    _CMD_Write("********************************************************************************")
    _CMD_Write("Gesendete Pakete = "&$send&@CRLF)
    _CMD_Write("Empfangene Pakete = "&$recev&@CRLF)
    _CMD_Write("Verlorene Pakete = "&$lost&@CRLF)
    $P_Verlust = Round (($lost/$send)*100)
    _CMD_Write("Datenverlust = "&$P_Verlust&"%"&@CRLF)
    _CMD_Write("********************************************************************************")

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

    $n = 0
    While 1
    If $Ping[$n] > 0 Then
    $Ping_G = $Ping_G + $Ping[$n]
    EndIf
    If $n = ($anzahl_pings-1) then ExitLoop
    $n = $n + 1
    Sleep(50)
    WEnd

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

    $Ping_D = Round (($Ping_G/$send))

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

    $n = 0
    $Ping_min = 999
    While 1
    If $Ping[$n] > 0 Then
    If $Ping_min > $Ping[$n] Then
    $Ping_min = $Ping[$n]
    EndIf
    EndIf
    If $n = ($anzahl_pings-1) then ExitLoop
    $n = $n + 1
    Sleep(50)
    WEnd

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

    $n = 0
    $Ping_max = 0
    While 1
    If $Ping[$n] > 0 Then
    If $Ping_max < $Ping[$n] Then
    $Ping_max = $Ping[$n]
    EndIf
    EndIf
    If $n = ($anzahl_pings-1) then ExitLoop
    $n = $n + 1
    Sleep(50)
    WEnd

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

    _CMD_Write("Durchschnittlicher Ping = "&$Ping_D&"ms"&@CRLF)
    _CMD_Write("Minimaler Ping = "&$Ping_min&"ms"&@CRLF)
    _CMD_Write("Maximaler Ping = "&$Ping_max&"ms"&@CRLF)
    _CMD_Write("********************************************************************************")

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

    _CMD_PAUSE()

    [/autoit]
  • ja jetz geht es so auch

    das ich das @CRLF nach der IP und und anzahl eingabe auch machen muss habe ich nicht mehr daran gedacht