Jump to content
Sign in to follow this  

on-line or off-line

Recommended Posts

Okay i am working on a little program that checks if a server is on-line or off-line.

I have it working but i would like to add some aditional info, with this i mean the uptime.

The server reports the up-time on a XML page.

I managed to download this file and read it but the problem is that i don't know how to read a piece of the file.

The way i do it now is by reading line 8 of the xml file, but this shows the xml tags...


$var = Ping("hopbot.net",20)
$online = filereadline(@WorkingDir&"hopbot.txt", 8)

#include <GuiConstants.au3>

GuiCreate("MyGUI", 392, 137,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
if $var = 0 then $stat = "offline.bmp"
if $var >= 1 then $stat = "online.bmp"
$Pic_1 = GuiCtrlCreatePic($stat, 20, 20, 100, 100)
$Label_2 = GuiCtrlCreateLabel("The server is on-line", 140, 30, 240, 20)
$Label_3 = GuiCtrlCreateLabel("The ping between you and the server is " & $var, 140, 50, 240, 20)
$Label_4 = GuiCtrlCreateLabel($online, 140, 70, 240, 20)
;$Label_5 = GuiCtrlCreateLabel("Label5", 140, 90, 240, 20)

While 1
    $msg = GuiGetMsg()
    Case $msg = $GUI_EVENT_CLOSE
    Case Else
Edited by raedts

Share this post

Link to post
Share on other sites

if it is always the same xml code (as usual) then you can kick it out with StringReplace before creating the label...

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...