Sign in to follow this  
Followers 0
mazwoz

network tester help

5 posts in this topic

hey everyone i have been working on a network testing utility for the past couple days and i can't figure out why it is not working properly. can someone look at the code for me and see if they see anything wrong? i would really appreciate it. thank you.

CODE
#include <GUIConstants.au3>

#include"constants.au3"

#Region ### START Koda GUI section ### Form=c:\documents and settings\bret\my documents\fun\nettest7.kxf

$Form2 = GUICreate("Dialog", 591, 374, 251, 199)

GUISetIcon("D:03.ico")

$GroupBox1 = GUICtrlCreateGroup("", 0, -7, 585, 377)

$IP = InputBox("IP ADDRESS/HOST NAME","Input the IP Address or Host Name here:", "192.168.0.1" ,"",16, 32, 153, 21)

$PING = GUICtrlCreateButton("PING", 16, 88, 75, 25, 0)

$TRACERT = GUICtrlCreateButton("TRACERT", 16, 144, 75, 25, 0)

$IPCONFIG = GUICtrlCreateButton("IPCONFIG", 96, 88, 75, 25, 0)

$NETSTAT = GUICtrlCreateButton("NETSTAT", 96, 144, 75, 25, 0)

$NSLOOKUP = GUICtrlCreateButton("NSLOOKUP", 16, 200, 75, 25, 0)

$NBTSTAT = GUICtrlCreateButton("NBTSTAT", 96, 200, 75, 25, 0)

$GUIEdit = GUICtrlCreateEdit("", 189, 29, 385, 321)

GUICtrlSetColor(-1, 0x716F64)

GUICtrlSetBkColor(-1, 0xFFFFFF)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Button1 = GUICtrlCreateButton("&EXIT", 96, 257, 75, 25, 0)

$CANCEL = GUICtrlCreateButton("CANCEL", 16, 257, 75, 25, 0)

$IPADDRESS = GUICtrlCreateLabel("IP ADDRESS:" & @CRLF & $IP, 24, 32, 146, 41)

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

case $Button1

Exit

case $PING

$get = GUICtrlGetHandle($IP)

$ping2 = Run(@ComSpec & " /c ping.exe " & $IP, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

If @Error = -1 Then ExitLoop

$lineping = StdoutRead($ping2)

GUICtrlSetData($GUIEdit, $lineping & @CRLF, 1)

case $TRACERT

$get = GUICtrlRead($IP)

$trace = Run(@ComSpec & " /c tracert" & " " & $IP, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

If @Error = -1 Then ExitLoop

$linetrace = StdoutRead($trace)

GUICtrlSetData($GUIEdit, $linetrace & @CRLF, 1)

case $NSLOOKUP

$get = GUICtrlRead($IP)

$look = Run(@ComSpec & " /c nslookup" & " " & $IP, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

If @Error = -1 Then ExitLoop

$linelook = StdoutRead($look)

GUICtrlSetData($GUIEdit, $linelook & @CRLF, 1)

case $NETSTAT

$stat = Run(@ComSpec & " /c netstat", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

If @Error = -1 Then ExitLoop

$linestat = StdoutRead($stat)

GUICtrlSetData($GUIEdit, $linestat & @CRLF, 1)

case $IPCONFIG

$config = Run(@ComSpec & " /c ipconfig /all", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

If @Error = -1 Then ExitLoop

$lineconfig = StdoutRead($config)

GUICtrlSetData($GUIEdit, $lineconfig & @CRLF, 1)

EndSwitch

WEnd

also feel free to borrow any code of course

nettest8.au3

Share this post


Link to post
Share on other sites



i can't figure out why it is not working properly. can someone look at the code for me and see if they see anything wrong?

Before I look at code I prefer to have some idea of what the problem is. Can you tell us what is not working and maybe what does?


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Before I look at code I prefer to have some idea of what the problem is. Can you tell us what is not working and maybe what does?

right now the ping and tracert show that they are going to do something but do not.

the ping will show

Pinging 192.168.0.1 with 32 bytes of data:

but the nslookup ipconfig and netstat work just fine... i havnt yet dont much with the nbtstat so dont worry about that.

Share this post


Link to post
Share on other sites

right now the ping and tracert show that they are going to do something but do not.

the ping will show

but the nslookup ipconfig and netstat work just fine... i havnt yet dont much with the nbtstat so dont worry about that.

Here is a small change to the $PING case, hope it helps.

Case $PING
        ; $get = GUICtrlGetHandle($IP)
         $ping2 = Run(@ComSpec & " /c ping.exe " & $IP, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
         
         While 1
            $lineping = StdoutRead($ping2)
            If @error Then ExitLoop
            GUICtrlSetData($GUIEdit, $lineping, 1)
         WEnd
         While 1
            $line = StderrRead($lineping)
            If @error Then ExitLoop
            MsgBox(0, "STDERR read:", $line)
         WEnd

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

wow man... thank you... you fixed my only issue. thanks a lot.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0