Sign in to follow this  
Followers 0
raedts

on-line or off-line

3 posts in this topic

#1 ·  Posted (edited)

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...

Code:

$var = Ping("hopbot.net",20)
InetGet("http://hopbot.net:8765/stat.xml",@WorkingDir&"hopbot.txt")
$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)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit
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  
Followers 0