Hallo Autoitter,
ich hab gestern für ein Testsystem ein kleines Script gebastelt, welches ein System anpingt und alles in ein Logfile schreibt dazu einen kleinen Logviewer.jetzt fehlt mir eine "progressbar" "kleines Fenster" der mir die Anzahl der Pings und des Fehlercounters ständig aktuallisiert darstellt leider hab ich keine idee wie ich das unterbringen soll.
eventuell hat von euch ja jemand ne schnelle Lösung so bis Montag morgen 0730 ![]()
Script
Spoiler anzeigen
#include <file.au3>
#include <Date.au3>
; Prompt the user to enter the destination IP Adress - no logic verification still now
$ip = InputBox("Zieladresse", "Please type in the destination address and click OK", "127.0.0.1")
$i = 1
$f = 0
Do
ping($ip, 150) ; 150 ms timeout for Ping
if @error = 0 Then
_FileWriteLog(@ScriptDir & "\ping.log"," Works fine " & $ip &" Ping number: " & $i)
sleep(150)
ElseIf @error = 1 Then
_FileWriteLog(@ScriptDir & "\ping.log"," System not reachable " & $ip &" Ping number: " & $i & " Fehlercount " & $f)
Beep(1250, 150)
$f = $f + 1
ElseIf @error = 4 Then
_FileWriteLog(@ScriptDir & "\ping.log"," System not reachable " & $ip &" Ping number: " & $i& " Fehlercount " & $f)
Beep(1250, 150)
$f = $f + 1
endif
$i = $i + 1
Until $i = "xXx" ; xXx should never happen
Logviewer
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <File.au3>
#Include <GuiEdit.au3>
Opt("GUIOnEventMode", 1)
Global $iMemo, $new_line
$width = 1024
$height = 600
$hGUI = GUICreate("Log Reader ", $width, $height, -1, -1, Default, $WS_EX_TOPMOST)
$iMemo = GUICtrlCreateEdit("", 0, 0, $width, $height, $ES_AUTOVSCROLL + $WS_VSCROLL + $WS_HSCROLL + $ES_READONLY)
GUICtrlSetLimit(-1, 0x7FFFFFFF)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()
If $CmdLine[0] > 0 And FileExists($CmdLine[1]) Then
$file = $CmdLine[1]
Else
$file = @ScriptDir & "\ping.log"
EndIf
$hFile = FileOpen($file)
$txt = FileRead($hFile)
GUICtrlSetData($iMemo, $txt, 1)
_GUICtrlEdit_LineScroll($iMemo, 1, 0xfffffff)
$cl = _FileCountLines($file)
$fs = FileGetSize($file)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
While Sleep(1000)
$fs_new = FileGetSize($file)
If $fs < $fs_new Then
$cl_new = _FileCountLines($file)
For $i = $cl + 1 To $cl_new
$new_line &= FileReadLine($hFile, $i) & @CRLF
Next
GUICtrlSetData($iMemo, $new_line, 1)
$cl = $cl_new
$fs = $fs_new
$new_line = ""
EndIf
Wend
Func _Exit()
FileClose($hFile)
GUIDelete($hGUI)
Exit
EndFunc
Gui für drumrum
Spoiler anzeigen
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
FileInstall("c:\pingtool\pingbox.exe", "c:\temp\pingbox.exe",1)
FileInstall("c:\Pingtool\Logviewer.exe", "c:\temp\Logviewer.exe",1)
$Form1 = GUICreate("Pingtester", 195, 211, 488, 336)
$Start = GUICtrlCreateButton("Start Test", 40, 24, 113, 41)
$Log = GUICtrlCreateButton("Start Logviewer", 40, 80, 113, 41)
$Exit = GUICtrlCreateButton("Exit", 40, 136, 113, 41)
GUISetState(@SW_SHOW)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ProcessClose ( "pingbox.exe")
ExitLoop
Case $Start
; When you press Start
Run("c:\temp\pingbox.exe")
;~~
Case $Log
; When you press Log
Run("c:\temp\Logviewer.exe")
Case $exit
ProcessClose ( "pingbox.exe")
ExitLoop
;~~
EndSwitch
WEnd
das ganze starte ich aus einer kleinen Gui welche auch die Endlosschleife mit exit wegballert. Das ganze war Quick und besonders Dirty also nicht schimpfen. ![]()
Ich bin für ein bischen hilfe echt dankbar ![]()