Jump to content

Multiping Gui


 Share

Recommended Posts

Greetings,

for troubleshooting reasons I need to create a small GUI for out internal staff that pings 3 different IP adresses in one window in 3 columns. No interaction, no nothing. only pinging these 3 IPs until the tool is clodes. It would be like piping the output of "ping x.x.x.x -t" 

Since I am an newbie here, I am not sure how to start that. Is piping the output really working, or is there a more ssophisticated approach to it?

Cheers

Guy

Link to comment
Share on other sites

You can create a GUI with three read only edit controls and put there the result of Ping() function. For reference look in help file for GUICreate(), GUICtrlCreateEdit(), Ping() and GUICtrlSetData().

 

Something like this:

#include <GuiIPAddress.au3>
#include <EditConstants.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>

Global $fPinging = False
Global $sIP1, $sIP2, $sIP3
Global $iUpdateRate = 3000 ; ms
Global $iTimer

$hMain = GUICreate('Ping', 490, 340)
$hIP1 = _GUICtrlIpAddress_Create($hMain, 10, 10, 150, 25)
$hIP2 = _GUICtrlIpAddress_Create($hMain, 170, 10, 150, 25)
$hIP3 = _GUICtrlIpAddress_Create($hMain, 330, 10, 150, 25)
$cEdit1 = GUICtrlCreateEdit('', 10, 45, 150, 240, BitOR($WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY))
$cEdit2 = GUICtrlCreateEdit('', 170, 45, 150, 240, BitOR($WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY))
$cEdit3 = GUICtrlCreateEdit('', 330, 45, 150, 240, BitOR($WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY))
$cPingButton = GUICtrlCreateButton('Start pinging', 170, 295, 150, 35)
GUICtrlSetBkColor($cEdit1, 0xFFFFFF)
GUICtrlSetBkColor($cEdit2, 0xFFFFFF)
GUICtrlSetBkColor($cEdit3, 0xFFFFFF)
GUISetState(@SW_SHOW, $hMain)

_GUICtrlIpAddress_Set($hIP1, '142.251.208.110')
_GUICtrlIpAddress_Set($hIP2, '74.6.143.26')
_GUICtrlIpAddress_Set($hIP3, '20.231.239.246')

While True
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _GUICtrlIpAddress_Destroy($hIP1)
            _GUICtrlIpAddress_Destroy($hIP2)
            _GUICtrlIpAddress_Destroy($hIP3)
            Exit
        Case $cPingButton
            $fPinging = Not $fPinging
            GUICtrlSetData($cPingButton, $fPinging ? 'Stop pinging' : 'Start pinging')
            $sIP1 = _GUICtrlIpAddress_Get($hIP1)
            $sIP2 = _GUICtrlIpAddress_Get($hIP2)
            $sIP3 = _GUICtrlIpAddress_Get($hIP3)
            If $fPinging Then PingIPs($cEdit1, $cEdit2, $cEdit3)
    EndSwitch
    If $fPinging And TimerDiff($iTimer) >= $iUpdateRate Then PingIPs($cEdit1, $cEdit2, $cEdit3)
WEnd

Func PingIPs($cEdit1, $cEdit2, $cEdit3)
    GUICtrlSetData($cEdit1, Ping($sIP1) & @CRLF, 1)
    GUICtrlSetData($cEdit2, Ping($sIP2) & @CRLF, 1)
    GUICtrlSetData($cEdit3, Ping($sIP3) & @CRLF, 1)
    $iTimer = TimerInit()
EndFunc

 

Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

  • 2 months later...

Use PingInfoView.exe from NirSoft, it's freeware, and you can have multiple ping definition files to be referenced with the command line parameter 

PingInfoView.exe /loadfile "\\Server\share\path\MyListOfHosts.txt"

 

 

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...