raedts Posted July 2, 2006 Share Posted July 2, 2006 (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 July 2, 2006 by raedts Link to comment Share on other sites More sharing options...
McDope Posted July 2, 2006 Share Posted July 2, 2006 if it is always the same xml code (as usual) then you can kick it out with StringReplace before creating the label... Link to comment Share on other sites More sharing options...
raedts Posted July 2, 2006 Author Share Posted July 2, 2006 Fixed: $online = filereadline(@WorkingDir&"hopbot.txt", 8) $online = StringReplace($online,"<uptime>","") $online = StringReplace($online,"</uptime>","") Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now