[TVM] The ECCp CoolMon Script

Status
Not open for further replies.
Ok, here's the script:
Code:
' Change this to your Coolmon directory
const outFile = "C:\Program Files\DaisyManSoftware\ECCP109.txt"

' Change this to your username
const userName = "RessurectionJoe"  ' <-- CHANGE THIS

set http = createobject("microsoft.xmlhttp") 
set fso = CreateObject("Scripting.FileSystemObject") 
set fOutput = fso.CreateTextFile(outFile,true) 

' Get ECCP109 data
http.open "GET",sourceURL,False 
http.send 

' Create array with each line as an element 
htmlArray = Split(http.responsetext, vbLf) 

' Loop through the array, and find our user
for i = 0 To UBound(htmlArray) 
  if (InStr(htmlArray(i),userName) > 0) then 
    a = InStr(htmlArray(i - 1), "  <td> ") + 7 
    b = InStr(htmlArray(i - 1), " </td>") - a 
    fOutput.WriteLine Mid(htmlArray(i - 1), a, b) ' User Rank
    a = InStr(htmlArray(i + 1), "  <td> ") + 7 
    b = InStr(htmlArray(i + 1), " </td>") - a 
    fOutput.Write Mid(htmlArray(i + 1), a, b) ' DP Submitted
    foutput.write " - "
    a = InStr(htmlArray(i + 2), "  <td> ") + 7 
    b = InStr(htmlArray(i + 2), " </td>") - a 
    fOutput.WriteLine Mid(htmlArray(i + 2), a, b) ' New DP
    a = InStr(htmlArray(i + 3), "  <td> ") + 7 
    b = InStr(htmlArray(i + 3), " </td>") - a 
    fOutput.WriteLine Mid(htmlArray(i + 3), a, b) ' Days Inactive
    exit for ' All done
  end if
next

Here's how it works:
1) Copy and paste the code in to a text file and rename it to eccp109.vbs
2) Save it to your coolmon folder (mine is DaisyManSoftware)
3) Create an empty text file and name it ECCP109.txt and place it in the same folder.
4) Put this something like this in your coolmon display items:
Code:
<NAME=FILEDATA FORMAT="C:\Program Files\DaisyManSoftware\eccp109.txt">
5) Have a drink if it works.

alcoholic.gif
 

TheAdmiral

Ars Scholae Palatinae
1,343
Cool, I fixed it!

The 'SourceURL' bit needed changing to the stats page.

So the completed code should be as so:

Code:
' Change this to your Coolmon directory
const outFile = "C:\Program Files\DaisyManSoftware\ECCP109.txt"

' Change this to your username
const userName = "RessurectionJoe"  ' <-- CHANGE THIS

set http = createobject("microsoft.xmlhttp")
set fso = CreateObject("Scripting.FileSystemObject")
set fOutput = fso.CreateTextFile(outFile,true)

' Get ECCP109 data
http.open "GET","http://www.nd.edu/~cmonico/eccp109/team138.html",False
http.send

' Create array with each line as an element
htmlArray = Split(http.responsetext, vbLf)

' Loop through the array, and find our user
for i = 0 To UBound(htmlArray)
  if (InStr(htmlArray(i),userName) > 0) then
    a = InStr(htmlArray(i - 1), "  <td> ") + 7
    b = InStr(htmlArray(i - 1), " </td>") - a
    fOutput.WriteLine Mid(htmlArray(i - 1), a, b) ' User Rank
    a = InStr(htmlArray(i + 1), "  <td> ") + 7
    b = InStr(htmlArray(i + 1), " </td>") - a
    fOutput.Write Mid(htmlArray(i + 1), a, b) ' DP Submitted
    foutput.write " - "
    a = InStr(htmlArray(i + 2), "  <td> ") + 7
    b = InStr(htmlArray(i + 2), " </td>") - a
    fOutput.WriteLine Mid(htmlArray(i + 2), a, b) ' New DP
    a = InStr(htmlArray(i + 3), "  <td> ") + 7
    b = InStr(htmlArray(i + 3), " </td>") - a
    fOutput.WriteLine Mid(htmlArray(i + 3), a, b) ' Days Inactive
    exit for ' All done
  end if
next

It worked for me, and it can work for you!
Just send $20 to...
 
Status
Not open for further replies.