Jump to content

Recommended Posts

Posted (edited)

I was browsing through the help file and I came across a function that I don't think I have ever used, StringRegExp. I decided I wanted to use it just once so I came up with this. I have only tested it with the new freerainbowtables.com server but I think it will work with any server.

Enjoy.

#include <Inet.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiStatusBar.au3>
#Include <GuiListBox.au3>

Local $Server = "http://boinc.freerainbowtables.com/distrrtgen/server_status.php"

$StatusGui = GUICreate("BOINC server status", 300, 300, -1, -1, -1, $WS_EX_TOOLWINDOW)
$ModuleList = _GUICtrlListBox_Create($StatusGui, "", 0, 0, 200, 300, $LBS_NOSEL)
$StatusList = _GUICtrlListBox_Create($StatusGui, "", 200, 0, 100, 300, $LBS_NOSEL )
$StatusBar = _GUICtrlStatusBar_Create($StatusGui, 100, "")
GUISetState(@SW_SHOW)

_GUICtrlStatusBar_SetText($StatusBar, "Downloading status...", 0)
$StatusPage = _InetGetSource($Server)
_GUICtrlStatusBar_SetText($StatusBar, "Processing...", 0)
$StatusPageLines = StringSplit($StatusPage,@CRLF)
For $i = 1 to $StatusPageLines[0]
    $Module = StringRegExp($StatusPageLines[$i], '<td>(.*?)</td>',1)
    $Status = StringRegExp($StatusPageLines[$i], '<td class=.*?>(.*?)</td>', 1)
    If @error == 0 Then
        _GUICtrlListBox_InsertString($ModuleList, $Module[0], -1)
        _GUICtrlListBox_InsertString($StatusList, $Status[0], -1)
    EndIf
Next
_GUICtrlStatusBar_SetText($StatusBar, "Finished.", 0)
While 1
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
Wend
Edited by Deltaforce229

[size="1"]Please stop confusing "how to" with "how do"[/size]

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
  • Recently Browsing   0 members

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