Samurize script for Seti?

Associate
Joined
13 Nov 2002
Posts
2,308
Location
Bedfordshire
adwhitworth: yup no probs matey on its way in a mo...

Jem: Yup b0rkley was playing up so that is very likely..


Post Script: The Seti progress call is kernakered in the vbscript I have done a partial rewrite and got the % completed working but the tottime and timetogo proc are still to be done.

I will post and link to the script when Ive done it but working this w/end so more than likely wont happen till midweek. [I gotta learn VBS as I do it as well so bear with me :p ]


Sp!....

[edit] Jem lemme know if/when its working m8 [/edit]
 
Last edited:

Jem

Jem

Associate
Joined
12 Nov 2002
Posts
275
Location
North East
Sp!ke_uk the script as gone belly up again, i tried running it again after i checked the stats on borkely to make certain i could access my stats and i get that same error as before when i run the setionline part :(

If it helps any i'm using the new vers of the samurize prog :D
 
Man of Honour
Joined
30 Oct 2002
Posts
15,807
Location
Surrey
Does the script write out to a file? If so you could use the vbscript I use for Coolmon if thats all you need.

This outputs nearly everything from the seti user data into a txt file that coolmon reads.

Its vbscript so I don't see a reason why it wouldn't work if samurize just reads the data from a txt file after its generated.
 
Man of Honour
Joined
30 Oct 2002
Posts
15,807
Location
Surrey
Code:
' setixmldata VBS script
' grabs all user data from the seti XML page
' This is pretty reliable now.  It shouldn't stop working if the seti team changes the XML format,
' unless they actually change the tags for anything this captures.  It should now also work if you
' don't have a homepage set in your seti account, and if you're not part of a group.  It should
' simply leave those lines blank....

Const Path = "setidata.txt" 
Const Email = "[email protected]" 

'captures the following (in this order):
' 1)  Seti account homepage link
' 2)  Seti account name
' 3)  Results received
' 4)  Total CPU Time
' 5)  Average CPU Time per WU
' 6)  Average results per day (not current, over the entire time you've had your seti account)
' 7)  Date/Time last result was returned
' 8)  Registration date
' 9)  How long you've had your Seti account
' 10) Link to Seti team homepage (not the team's homepage, the team's seti stats page)
' 11) Group/Team name
' 12) Rank (out of ALL Seti users)
' 13) Total # of Seti users
' 14) Total # of users with the same ranks as you
' 15) Rank percentage (% of seti users with a higher rank than you)

'Don't mess with below unless you know what you're doing.

Const NumberOfCaptures = 15

Set fs = CreateObject("Scripting.FileSystemObject") 
Set outFile = fs.CreateTextFile(Path, True) 
set http = createobject("microsoft.xmlhttp") 
Http.open "GET","http://setiathome.ssl.berkeley.edu/fcgi-bin/fcgi?cmd=user_xml&email=" & Email, false 
Http.send 
xmldata = Http.responsetext 

Dim regEx 
Dim loopvalue
Dim regexpatterns()
ReDim regexpatterns(NumberOfCaptures - 1)

regexpatterns(0) = "<name><a href=""(.*)"" target=""new"">.*</a></name>"
regexpatterns(1) = "<name><a href="".*"" target=""new"">(.*)</a></name>"
regexpatterns(2) = "<numresults>(.*)</numresults>"
regexpatterns(3) = "<cputime>\s*(.*)</cputime>"
regexpatterns(4) = "<avecpu>(.*)</avecpu>"
regexpatterns(5) = "<resultsperday>(.*)</resultsperday>"
regexpatterns(6) = "<lastresulttime>(.*)</lastresulttime>"
regexpatterns(7) = "<regdate>(.*)</regdate>"
regexpatterns(8) = "<usertime>\s*(.*)</usertime>"
regexpatterns(9) = "<group><a href=""(.*)"">.*</a></group>"
regexpatterns(10) = "<group><a href="".*"">(.*)</a></group>"
regexpatterns(11) = "<rank>(.*)</rank>"
regexpatterns(12) = "<ranktotalusers>(.*)</ranktotalusers>"
regexpatterns(13) = "<num_samerank>(.*)</num_samerank>"
regexpatterns(14) = "<top_rankpct>(.*)</top_rankpct>"
' You can add more regexpatterns here.  add them on to the END, and change the NumberOfCaptures const appropriately
' Make sure that the pattern you use will not match more than one place in the XML file.

Set regEx = New RegExp 
regEx.Global = True 

loopvalue = 0
Do
    regEx.Pattern = regexpatterns(loopvalue)
    Set Matches = regEx.Execute(xmldata) 
    For Each Match in Matches
        outfile.write match.SubMatches(0)
        outfile.WriteLine
    Next
    loopvalue = loopvalue + 1
Loop While loopvalue<NumberOfCaptures

outFile.close
 
Soldato
Joined
18 Oct 2002
Posts
10,573
Location
Seattle
Biffa, if I use that it comes up "no script or function".

The original SETIProgress2.vbs script seems to work by creating a .tmp file in your systems temp directory that contains all the user data.

I'll give a whirl trying to shoe-horn your script into SetiProgress2 and see what happens.
 
Last edited:
Associate
Joined
13 Nov 2002
Posts
2,308
Location
Bedfordshire
Jem make sure that the path to your client is correct AND yor email addy is correct also. thats about all I can think of right now.

Right ...... Below is my VERY poorly reconstructed SETIProgress2.vbs file. THIS WORKS FOR ME. Including the SETIProgress function.

As a caveat I do have other .vbs scripts running. If you have then check that none of the variables are duplicated in those and this script as they are (I think) declared globally so this WILL cause you problems.

All rights are given for you to laugh at my naff rewrite. Doubles and longs have temporarily (sp?) been removed to get working and consider the bits I have rewritten as TOTAL BETA as I have NOT fully tested [ yet heh :) ]

Sp!ke.....

[edit] Just noticed BEWARE THE LINE BREAKS / WRAPS I will host and post a link a bit later to the file off of my site. [/edit]

<----------------------- okies cut here --------------------------------->


' SETIProgress v2.1 - 03-03-10
' For use with Serious Samurize http://www.samurize.com
' By Micke_ , Original V1,0 By Dex, [email protected]
'
' Send bugs/sugestions to : [email protected]
'
' 2,0, Converted to Serious Samurize
' Fixed bug that script locked when seticlient updating.
' 2.1, Added webstat from seti@home.
'
' Dex, mail me if you want me ro remove youre part of this script.
' If I don't answer, ask Sweetfish to remove this script. [email protected]
'
' POORLY EDITED BY SPIKE :p

path = "C:\seti@home\" ' Path to seti@home client Dont forget the LAST backslash
dec = "2" ' How much Decimals you want
printout = "pd%btg%btt"
' pd = % done.
' tg = time to go.
' tt = total time for this unit.
' %b = Same as samurize, line feed


' Settings for Seti webstat, gets info from
' http://setiathome.ssl.berkeley.edu/fcgi-bin/fcgi?cmd=user_xml&amp;email=XXXX
' (where XXXX is your registered email address)
' (The info from webpage are updated ones per hour)
' This script makes a tempfile (setiprogress2.tmp in youre temp folder.

email = "XXXX@XXXX" ' The Email registerd for youre account.LEAVE THE QUOTE MARKS!!!!!

result = "<name>%b%bTotal WU's: <numresults>%bCPU Time: <cputime>%bLast Result: <lastresulttime>"_
& "%bRank: <rank>%bUsers With same rank: <num_samerank>%bStomped Users: <top_rankpct>%"_
& ""



' %b = Same as samurize, line feed
' You can add text, E.g. <resultsperday>/day
' The folowing tag's are replaced with the info from seti@home
' Tag E.g. result
'<name> Micke_
'<numresults> 16788
'<cputime> 15.546 years
'<avecpu> 8 hr 06 min 42.0 sec
'<resultsperday> 12.13
'<lastresulttime> Mon Mar 10 09:29:03 2003
'<regdate> Thu May 27 06:41:00 1999
'<usertime> 3.790 years
'<rank> 3910
'<ranktotalusers> 4288359
'<num_samerank> 2
'<top_rankpct> 0.091

'==========================================================================
'dont change anything below!!! unless u wanna fix it :p

Function SETIProgress

tp = path & "state.sah" ' Generates the path to the file
Set file_obj = CreateObject ("Scripting.FileSystemObject")
If (file_obj.FileExists(tp)) Then
Set file_path = file_obj.GetFile(tp) ' Creates the connection to the file
if file_path.size > 200 then
Set file = file_path.OpenAsTextStream (1, -2) ' Opens the file for reading

statetmp = file.ReadAll & vbcrlf & vbcrlf & vbcrlf & vbcrlf & vbcrlf & vbcrlf & vbcrlf & vbcrlf

file.Close ' Closes the file

Set file_path = nothing ' Resets variable
Set file_obj = nothing ' Resets variable

tpx = split(statetmp, vblf)
prog = Mid(tpx(4), 6)
progtmp = prog * 100
progtmp = Round(progtmp,dec)
done = progtmp & "%"

cpu = Mid(tpx(3), 5)
prog = Mid(tpx(4), 6)
totaltimetmp = cpu / prog
timelefttmpA = ( totaltimetmp / 100 ) * progtmp
timelefttmp = totaltimetmp - timelefttmpA
hours = Fix(timelefttmp / 3600)
minutes = Fix( ( (timelefttmp / 3600) - hours) * 60)
seconds = Fix( ( ( ( (timelefttmp / 3600) - hours) * 60) - minutes)*60)
timetogo = hours & "h " & minutes & "m " & seconds & "s"

cpu = Mid(tpx(3), 5) ' OK This works now
prog = Mid(tpx(4), 6) ' leave me alone
totaltimetmp = cpu / prog
hours = Fix(totaltimetmp / 3600)
minutes = Fix( ( (totaltimetmp / 3600) - hours) * 60)
seconds = Fix( ( ( ( (totaltimetmp / 3600) - hours) * 60) - minutes)*60)
tottime = hours & "h " & minutes & "m " & seconds & "s"

pout = replace(printout, "%b", vbcrlf)
pout = replace(pout, "pd", done)
pout = replace(pout, "tg", timetogo)
SETIProgress = replace(pout, "tt", tottime)
else
Set file_path = nothing ' Resets variable
Set file_obj = nothing ' Resets variable
SETIProgress = "0%" & vbcrlf & "updating"
end if
Else
SETIProgress = "File not found." & vbcrlf & vbcrlf
End If
End Function

Function results

Set fso = CreateObject("Scripting.FileSystemObject")
set readfile = fso.OpenTextFile(path & "user_info.sah", 1)
rezread = split(readfile.ReadAll, "results=")
readfile.close
rez = split(rezread(1), vblf)
results= rez(0)
set readfile = nothing
Set fso = nothing

End Function

Function Setionline

Set envcheck = CreateObject("wscript.shell")
set wshenv = envcheck.environment("process")
tmppath = (wshenv("TEMP"))
set wshenv = nothing
set envcheck = nothing
Set fso = CreateObject("Scripting.FileSystemObject")
if fso.fileExists(tmppath & "\setiprogress2.tmp") then
set tmpfile = fso.getfile(tmppath & "\setiprogress2.tmp")
lud = tmpfile.datelastmodified
set tmpfile = nothing
end if
if lud < cdate(date() & " " & time) - 0.0416 then
set gw = createobject("msxml2.xmlhttp")
gw.open "GET","http://setiathome.ssl.berkeley.edu/fcgi-bin/fcgi?cmd=user_xml&email=" & email & "&bogus=" & time,false
gw.send
set savefile = fso.CreateTextFile(tmppath & "\setiprogress2.tmp", True)
savefile.write gw.responsetext
set gw = nothing
savefile.close
set savefile = nothing
end if
set savefile = fso.OpenTextFile(tmppath & "\setiprogress2.tmp", 1)
rez = savefile.readall
savefile.close
set savefile = nothing
set fso = nothing
if instr(rez, "<name>") then
name = trim (mid (rez, (instr (rez, "new") + 5), (instr(rez,"</a></name>") -(instr (rez, "new") + 5))))
numresults = trim (mid (rez, (instr (rez, "<numresults>") + 12), (instr(rez,"</numresults>") -(instr (rez, "<numresults>") + 12))))
cputime = trim (mid (rez, (instr (rez, "<cputime>") + 9), (instr(rez,"</cputime>") -(instr (rez, "<cputime>") + 9))))
avecpu = trim (mid (rez, (instr (rez, "<avecpu>") + 8), (instr(rez,"</avecpu>") -(instr (rez, "<avecpu>") + 8))))
resultsperday = trim (mid (rez, (instr (rez, "<resultsperday>") + 15), (instr(rez,"</resultsperday>") -(instr (rez, "<resultsperday>") + 15))))
lastresulttime = trim (mid (rez, (instr (rez, "<lastresulttime>") + 16), (instr(rez,"</lastresulttime>") -(instr (rez, "<lastresulttime>") + 16))))
rank = trim (mid (rez, (instr (rez, "<rank>") + 6), (instr(rez,"</rank>") -(instr (rez, "<rank>") + 6))))
ranktotalusers = trim (mid (rez, (instr (rez, "<ranktotalusers>") + 16), (instr(rez,"</ranktotalusers>") -(instr (rez, "<ranktotalusers>") + 16))))
top_rankpct = trim (mid (rez, (instr (rez, "<top_rankpct>") + 13), (instr(rez,"</top_rankpct>") -(instr (rez, "<top_rankpct>") + 13))))
num_samerank = trim (mid (rez, (instr (rez, "<num_samerank>") + 14), (instr(rez,"</num_samerank>") -(instr (rez, "<num_samerank>") + 14))))
regdate = trim (mid (rez, (instr (rez, "<regdate>") + 9), (instr(rez,"</regdate>") -(instr (rez, "<regdate>") + 9))))
usertime = trim (mid (rez, (instr (rez, "<usertime>") + 10), (instr(rez,"</usertime>") -(instr (rez, "<usertime>") + 10))))

result = replace(result, "%b", vbcrlf)
result = replace(result, "<name>", name)
result = replace(result, "<numresults>", numresults)
result = replace(result, "<cputime>", cputime)
result = replace(result, "<avecpu>", avecpu)
result = replace(result, "<resultsperday>", resultsperday)
result = replace(result, "<lastresulttime>", lastresulttime)
result = replace(result, "<regdate>", regdate)
result = replace(result, "<usertime>", usertime)
result = replace(result, "<rank>", rank)
result = replace(result, "<ranktotalusers>", ranktotalusers)
result = replace(result, "<num_samerank>", num_samerank)
result = replace(result, "<top_rankpct>", 100-top_rankpct)
else
result = "Username not found" & vbcrlf & "Have you changed the mail" & vbcrlf & "address in setiprogress.vbs?"
Set fso = CreateObject("Scripting.FileSystemObject")
fso.deleteFile(tmppath & "\setiprogress2.tmp")
set fso = nothing
end if
setionline = result
'msgbox result
End function

' /Micke_
 
Last edited:
Soldato
Joined
18 Oct 2002
Posts
10,573
Location
Seattle
Here's how its looking on mine. Not bothered with any PNGs yet, might add them later:

edit: I'm not convinced that temp is right, I'd expect it to be about 10 degrees warmer as thats air cooled after 7 hours up time, give or take.

desktop.jpg
 
Caporegime
Joined
16 May 2003
Posts
25,368
Location
::1
Another visitor to digitalblasphemy.com ;)

When I can find the time, I'll stick my updated one on too.
While this thread's running, any chance of some help with the football script?
All I get is league not found :confused:
 
Last edited:
Associate
Joined
13 Nov 2002
Posts
2,308
Location
Bedfordshire
Originally posted by tolien72
Another visitor to digitalblasphemy.com ;)

When I can find the time, I'll stick my updated one on too.
While this thread's running, any chance of some help with the football script?
All I get is league not found :confused:

If you want to post it to me tolien I'll have a look when I get a chance.... [mails below siggy]

Jem I get the functions ok? Try running ONLY this script on a temp ini file if it works then it may be because of global named variables screwing them up, but without knowing exactly what else your running its a little hard....
 
Associate
Joined
4 Aug 2003
Posts
453
Location
Bristol, UK
how about a piccy of the rip i did of this script, availible to all who want it, all you have to do is edit the seti info, the rest should be ok for all systems, take a peek!
desktop.txt


e-mail me if ya wanna copy. as soon as i figure out how to export it.


Aarron_C
 
Caporegime
Joined
16 May 2003
Posts
25,368
Location
::1
Originally posted by Sp!ke_UK
If you want to post it to me tolien I'll have a look when I get a chance.... [mails below siggy]

Jem I get the functions ok? Try running ONLY this script on a temp ini file if it works then it may be because of global named variables screwing them up, but without knowing exactly what else your running its a little hard....

On it's way to ya m8y
 
Associate
Joined
4 Aug 2003
Posts
453
Location
Bristol, UK
if like me you spent ages looking for a way then here it is


example:
Add Meter
->Memory

(where it says memory properties, select the type and the return value you want but for the unit, let it give you it as a percentage, then make the meter a progressbar, and there you have it!)

(to add the cool number there as well do the same as above but dont change it to a progressbar and in the text field delete everything in there and put %V%, then resize the meter to fit your progress bar and then center it and there you go. something that will look like mine)

hope that helps.
 
Back
Top Bottom