User:Dhtwiki/sandbox/GOCE barnstar scripts

Attachment #1 edit

[-- Attachment #1 --]
[. . .]
(Instructions and script updated October 2017)

1) Open "GOCE Drive.vbs" script and the current month's raw data with a
text editing program.
2) Update the months in the script in four places: the names of the raw
data and the results file, and the rollover column headers.
3) Clean up the raw data as best you can.
a) Remove any unused lines such as "# {{Completed}} [[]] ()".
b) Remove extra commentary and text.
c) Remove entirely sections of users who did not do any copyediting.
4) Adjust the paths to the two text files as you prefer.
5) Run the script.
6) It will almost certainly not work the first time; you'll get an error
window saying what happened. Click OK.
7) Open the results file in a text editor and see where it stopped.
8) Look at the next user's section in the raw text and correct the problem.
9) Repeat steps 4-7 until no error window pops up.
10) Copy entire results file to barnstars subpage for completed drive.

The script isn't perfect; it doesn't handle a lot of corner cases and weird
text, because the overhead wouldn't be worth it compared to the ease of
just fixing the raw file.  The most common issue is the script complaining
about CInt type mismatch. The code looks for numbers in parentheses to get
the article word counts, and is designed to ignore disambiguation
parentheses, but it gets confused if there are more than two sets of
parentheses on a single line, so you'll need to remove extras. Let me know
if you have any other questions or issues with it.


Find and replace strings:

Find: # {{Completed}} [[]] ()
Replace with nothing (regex off)

Find: \# \{\{Working\}\}.*$
Replace with nothing (regex on)

Find: \{\{checked\}\}.*$
Replace with nothing (regex on)

Find: \{\{y\}\}.*$
Replace with nothing (regex on)
[. . .]

Attachment #2 edit

[-- Attachment #2: GOCE Drive.vbs.txt --]
[. . .]
                                                                                                                                                                                                  
Dim objFS                                                                                                                                                                                         
Dim objFile                                                                                                                                                                                       
Dim objInput                                                                                                                                                                                      
Dim objOutput
Dim strText
Dim strName                                                                                                                                                                                       
Dim strLine                                                                                                                                                                                       
Dim strArticleWordCount                                                                                                                                                                           
Dim nStart                                                                                                                                                                                        
Dim nFinish                                                                                                                                                                                       
Dim nRawWordTotal                                                                                                                                                                                 
Dim nGrandWordTotal                                                                                                                                                                               
Dim nBonusWordTotal                                                                                                                                                                               
Dim nNewRolloverTotal                                                                                                                                                                             
Dim nOldRolloverTotal
Dim nArticleCount                                                                                                                                                                                 
Dim nOldArticleCount                                                                                                                                                                              
Dim nArticleWordCount                                                                                                                                                                             
Dim nLargestArticle                                                                                                                                                                               
Dim nFiveKCount                                                                                                                                                                                   
Dim TempWordCount                                                                                                                                                                                 
Dim strAward
Dim nEveryoneRaw                                                                                                                                                                                  
Dim nEveryoneArticle                                                                                                                                                                              
Dim nEveryoneOld                                                                                                                                                                                  
Dim nEveryoneFiveK                                                                                                                                                                                
                                                                                                                                                                                                  
nRawWordTotal = 0.0                                                                                                                                                                               
nGrandWordTotal = 0.0                                                                                                                                                                             
nBonusWordTotal = 0.0                                                                                                                                                                             
nNewRolloverTotal = 0.0
nOldRolloverTotal = 0.0
nArticleCount = 0
nOldArticleCount = 0
nArticleWordCount = 0.0                                                                                                                                                                           
nLargestArticle = 0
nFiveKCount = 0                                                                                                                                                                                   
nTempWordCount = 0                                                                                                                                                                                
strAward = ""                                                                                                                                                                                     
strRollover = ""
nEveryoneRaw = 0.0
nEveryoneArticle = 0                                                                                                                                                                              
nEveryoneOld = 0                                                                                                                                                                                  
nEveryoneFiveK = 0                                                                                                                                                                                
                                                                                                                                                                                                  
Set objFS = CreateObject("Scripting.FileSystemObject")                                                                                                                                            
Set objInput = objFS.OpenTextFile("C:\Users\Joe\Documents\GOCE-2015-March.txt")
Set objOutput = objFS.CreateTextFile("C:\Users\Joe\Documents\GOCE-2015-March-Results.txt", True)
strText = objInput.ReadLine                                                                                                                                                                       
objOutput.WriteLine "{|class=" & Chr(34) & "wikitable sortable" & Chr(34)
objOutput.WriteLine "|-"                                                                                                                                                                          
objOutput.WriteLine "!Name"                                                                                                                                                                       
objOutput.WriteLine "!Raw total"                                                                                                                                                                  
objOutput.WriteLine "!Bonus total"                                                                                                                                                                
objOutput.WriteLine "!Old rollover total (DO NOT USE FOR MAY)"
objOutput.WriteLine "!Grand total"                                                                                                                                                                
objOutput.WriteLine "!New rollover total (USE THIS NUMBER FOR MAY)"                                                                                                                               
objOutput.WriteLine "!Article count"                                                                                                                                                              
objOutput.WriteLine "!Old article count"                                                                                                                                                          
objOutput.WriteLine "!Largest article"                                                                                                                                                            
objOutput.WriteLine "!5k article count"
objOutput.WriteLine "!Word count award"
objOutput.WriteLine "|-"                                                                                                                                                                          
Do While objInput.AtEndOfStream <> True                                                                                                                                                           
        If InStr(1, strText, "==", 1) Then                                                                                                                                                        
                nStart = InStr(1, strText, "==", 1) + 2                                                                                                                                           
                nFinish = InStr (nStart, strText, "==", 1)                                                                                                                                        
                strName = Mid(strText, nStart, nFinish - nStart)                                                                                                                                  
                GetTotals                                                                                                                                                                         
                GetNewRolloverTotal                                                                                                                                                               
        End If                                                                                                                                                                                    
        strLine = "|" & strName
        objOutput.WriteLine strLine                                                                                                                                                               
        strLine = "|" & nRawWordTotal                                                                                                                                                             
        objOutput.WriteLine strLine                                                                                                                                                               
        strLine = "|" & nBonusWordTotal                                                                                                                                                           
        objOutput.WriteLine strLine                                                                                                                                                               
        strLine = "|" & nOldRolloverTotal                                                                                                                                                         
        objOutput.WriteLine strLine
        strLine = "|" & nGrandWordTotal                                                                                                                                                           
        objOutput.WriteLine strLine                                                                                                                                                               
        strLine = "|" & nNewRolloverTotal                                                                                                                                                         
        objOutput.WriteLine strLine                                                                                                                                                               
        strLine = "|" & nArticleCount                                                                                                                                                             
        objOutput.WriteLine strLine                                                                                                                                                               
        strLine = "|" & nOldArticleCount                                                                                                                                                          
        objOutPut.WriteLine strLine                                                                                                                                                               
        strLine = "|" & nLargestArticle
        objOutput.WriteLine strLine
        strLine = "|" & nFiveKCount
        objOutput.WriteLine strLine
        strLine = "|" & strAward                                                                                                                                                                  
        objOutput.WriteLine strLine
        strLine = "|-"                                                                                                                                                                            
        objOutput.WriteLine strLine                                                                                                                                                               
        nRawWordTotal = 0.0                                                                                                                                                                       
        nGrandWordTotal = 0.0
        nBonusWordTotal = 0.0
        nNewRolloverTotal = 0.0                                                                                                                                                                   
        nOldRolloverTotal = 0.0                                                                                                                                                                   
        nArticleCount = 0                                                                                                                                                                         
        nOldArticleCount = 0                                                                                                                                                                      
        nArticleWordCount = 0.0                                                                                                                                                                   
        nLargestArticle = 0                                                                                                                                                                       
        nFiveKCount = 0                                                                                                                                                                           
        nTempWordCount = 0                                                                                                                                                                        
        strName = ""                                                                                                                                                                              
        strAward = ""                                                                                                                                                                             
        strRollover = ""                                                                                                                                                                          
Loop                                                                                                                                                                                              
        strLine = "| Totals"                                                                                                                                                                      
        objOutput.WriteLine strLine                                                                                                                                                               
        strLine = "|" & nEveryoneRaw                                                                                                                                                              
        objOutput.WriteLine strLine                                                                                                                                                               
        strLine = "|0"                                                                                                                                                                            
        objOutput.WriteLine strLine                                                                                                                                                               
        strLine = "|0"                                                                                                                                                                            
        objOutput.WriteLine strLine                                                                                                                                                               
        strLine = "|0"                                                                                                                                                                            
        objOutput.WriteLine strLine                                                                                                                                                               
        strLine = "|0"                                                                                                                                                                            
        objOutput.WriteLine strLine                                                                                                                                                               
        strLine = "|" & nEveryoneArticle                                                                                                                                                          
        objOutput.WriteLine strLine                                                                                                                                                               
        strLine = "|" & nEveryoneOld                                                                                                                                                              
        objOutput.WriteLine strLine                                                                                                                                                               
        strLine = "|0"                                                                                                                                                                            
        objOutput.WriteLine strLine                                                                                                                                                               
        strLine = "|" & nEveryoneFiveK
        objOutput.WriteLine strLine                                                                                                                                                               
        strLine = "|n/a"                                                                                                                                                                          
        objOutput.WriteLine strLine                                                                                                                                                               
        strLine = "|-"                                                                                                                                                                            
        objOutput.WriteLine strLine                                                                                                                                                               
Set objFS = Nothing                                                                                                                                                                               
objOutput.WriteLine "|}"                                                                                                                                                                          
objInput.Close                                                                                                                                                                                    
objOutput.Close                                                                                                                                                                                   
Sub GetTotals                                                                                                                                                                                     
  'MsgBox "Trying to get next line"                                                                                                                                                               
        Do While objInput.AtEndOfStream <> True                                                                                                                                                   
                strText = objInput.ReadLine                                                                                                                                                       
                If InStr(1, strText, "==", 1) Then                                                                                                                                                
                        Exit Sub                                                                                                                                                                  
                End If                                                                                                                                                                            
                If InStr(1, strText, "{Completed}", 1) Then
                        nStart = InStr(1, strText, "(", 1) + 1
                        nFinish = InStr (nStart, strText, ")", 1)
                        nArticleCount = nArticleCount + 1                                                                                                                                         
                        If nStart > 0 Then
                                strArticleWordCount = Mid(strText, nStart, nFinish - nStart)                                                                                                      
                                If IsNumeric (strArticleWordCount) <> True Then                                                                                                                   
                                        nStart = InStr(nFinish, strText, "(", 1) + 1                                                                                                              
                                        nFinish = InStr (nStart, strText, ")", 1)
                                        strArticleWordCount = Mid(strText, nStart, nFinish - nStart)
                                End If                                                                                                                                                            
                                nArticleWordCount = CInt(strArticleWordCount)                                                                                                                     
                                If nLargestArticle = 0 Then                                                                                                                                       
                                        nLargestArticle = nArticleWordCount                                                                                                                       
                                ElseIf nLargestArticle < nArticleWordCount Then                                                                                                                   
                                        nLargestArticle = nArticleWordCount                                                                                                                       
                                End If                                                                                                                                                            
                                nTempWordCount = nArticleWordCount                                                                                                                                
                                Do While nTempWordCount > 5000                                                                                                                                    
                                        nFiveKCount = nFiveKCount + 1                                                                                                                             
                                        nTempWordCount = nTempWordCount - 5000                                                                                                                    
                                Loop                                                                                                                                                              
                                nRawWordTotal = nRawWordTotal + nArticleWordCount                                                                                                                 
                                If InStr(1, strText, "*O", 1) Then                                                                                                                                
                                        nOldArticleCount = nOldArticleCount + 1                                                                                                                   
                                        nArticleWordCount = nArticleWordCount * 1.5                                                                                                               
                                        nGrandWordTotal = nGrandWordTotal + nArticleWordCount                                                                                                     
                                ElseIf InStr(1, strText, "*R", 1) Then                                                                                                                            
                                        nArticleWordCount = nArticleWordCount * 1.5                                                                                                               
                                        nGrandWordTotal = nGrandWordTotal + nArticleWordCount                                                                                                     
                                Else                                                                                                                                                              
                                        nGrandWordTotal = nGrandWordTotal + nArticleWordCount                                                                                                     
                                End If                                                                                                                                                            
                        End If                                                                                                                                                                    
                ElseIf InStr(1, strText, "rollover-words", 1) Then                                                                                                                                
                        nStart = InStr(1, strText, "=", 1) + 1                                                                                                                                    
                        nFinish = Len (strText)                                                                                                                                                   
                        strRollover = Mid(strText, nStart, nFinish - nStart + 1)                                                                                                                  
                        Trim(strRollover)                                                                                                                                                         
                        If IsNumeric (strRollover) Then                                                                                                                                           
                                nOldRolloverTotal = CLng(strRollover)
                        End If                                                                                                                                                                    
                        'MsgBox "Name: " & strName & vbCrLf & "Bonus: " & nBonusWordTotal & vbCrLf & "Grand: " & nGrandWordTotal & vbCrLf & "Raw: " & nRawWordTotal                               
                        nBonusWordTotal = nGrandWordTotal - nRawWordTotal                                                                                                                         
                        nGrandWordTotal = nGrandWordTotal + nOldRolloverTotal                                                                                                                     
                        nEveryoneRaw = nEveryoneRaw + nRawWordTotal                                                                                                                               
                        nEveryoneArticle = nEveryoneArticle + nArticleCount                                                                                                                       
                        nEveryoneOld = nEveryoneOld + nOldArticleCount                                                                                                                            
                        nEveryoneFiveK = nEveryoneFiveK + nFiveKCount                                                                                                                             
                End If                                                                                                                                                                            
        Loop                                                                                                                                                                                      
End Sub                                                                                                                                                                                           
                                                                                                                                                                                                  
Sub GetNewRolloverTotal                                                                                                                                                                           
        If nGrandWordTotal > 100000 Then                                                                                                                                                          
                nNewRolloverTotal = nGrandWordTotal - 100000                                                                                                                                      
                strAward = "Most Excellent Caretaker"                                                                                                                                             
        ElseIf nGrandWordTotal > 80000 Then                                                                                                                                                       
                nNewRolloverTotal = nGrandWordTotal - 80000                                                                                                                                       
                strAward = "Order of Superior Scribe"                                                                                                                                             
        ElseIf nGrandWordTotal > 60000 Then                                                                                                                                                       
                nNewRolloverTotal = nGrandWordTotal - 60000
                strAward = "Diligence"                                                                                                                                                            
        ElseIf nGrandWordTotal > 40000 Then                                                                                                                                                       
                nNewRolloverTotal = nGrandWordTotal - 40000                                                                                                                                       
                strAward = "Modern GOCE"                                                                                                                                                          
        ElseIf nGrandWordTotal > 30000 Then                                      
                nNewRolloverTotal = nGrandWordTotal - 30000                                                                                                                                       
                strAward = "Old school LOCE"                                                                                                                                                      
        ElseIf nGrandWordTotal > 20000 Then                                                                                                                                                       
                nNewRolloverTotal = nGrandWordTotal - 20000                                                                                                                                       
                strAward = "Tireless Contributor"                                                                                                                                                 
        ElseIf nGrandWordTotal > 12000 Then                                                                                                                                                       
                nNewRolloverTotal = nGrandWordTotal - 12000                                                                                                                                       
                strAward = "Cleanup"                                                                                                                                                              
        ElseIf nGrandWordTotal > 8000 Then                                                                                                                                                        
                nNewRolloverTotal = nGrandWordTotal - 8000                                                                                                                                        
                strAward = "Working Wikipedian"                                                                                                                                                   
        ElseIf nGrandWordTotal > 4000 Then                                                                                                                                                        
                nNewRolloverTotal = nGrandWordTotal - 4000                                                                                                                                        
                strAward = "Modest"                                                                                                                                                               
        Else                                                                                                                                                                                      
                If nRawWordTotal > 0 Then                                                                                                                                                         
                        nNewRolloverTotal = nGrandWordTotal                                                                                                                                       
                        If strAward = "" Then                                                                                                                                                     
                                If nArticleCount > 0 Then                                                                                                                                         
                                        strAward = "Minor"                                                                                                                                        
                                End If                                                                                                                                                            
                        End If                                                                                                                                                                    
                End If                                                                                                                                                                            
        End If                                                                                                                                                                                    
End Sub                                                                                                                                                                                           


[-- Attachment #2: goce.txt --]                                                                                   
[. . .]                                                            
                                                                                                                  
Dim objFS                                                                                                         
Dim objFile                                                                                                       
Dim objInput                                                                                                      
Dim objOutput                                                                                                     
Dim strText                                                                                                       
Dim strName                                                                                                       
Dim strLine                                                                                                       
Dim strArticleWordCount                                                                                           
Dim nStart                                                                                                        
Dim nFinish                                                                                                       
Dim nRawWordTotal                                                                                                 
Dim nGrandWordTotal                                                                                               
Dim nBonusWordTotal                                                                                               
Dim nNewRolloverTotal                                                                                             
Dim nOldRolloverTotal                                                                                             
Dim nArticleCount                                                                                                 
Dim nOldArticleCount                                                                                              
Dim nArticleWordCount                                                                                             
Dim nLargestArticle                                                                                               
Dim nFiveKCount                                                                                                   
Dim TempWordCount                                                                                                 
Dim strAward                                                                                                      
Dim nEveryoneRaw                                                                                                  
Dim nEveryoneArticle                                                                                              
Dim nEveryoneOld                                                                                                  
Dim nEveryoneFiveK                                                                                                
                                                                                                                  
nRawWordTotal = 0.0                                                                                               
nGrandWordTotal = 0.0                                                                                             
nBonusWordTotal = 0.0                                                                                             
nNewRolloverTotal = 0.0                                                                                           
nOldRolloverTotal = 0.0                                                                                           
nArticleCount = 0                                                                                                 
nOldArticleCount = 0                                                                                              
nArticleWordCount = 0.0                                                                                           
nLargestArticle = 0                                                                                               
nFiveKCount = 0     
nTempWordCount = 0                                                                                                
strAward = ""                                                                                                     
strRollover = ""                                                                                                  
nEveryoneRaw = 0.0                                                                                                
nEveryoneArticle = 0                                                                                              
nEveryoneOld = 0                                                                                                  
nEveryoneFiveK = 0                                                                                                
                                                                                                                  
Set objFS = CreateObject("Scripting.FileSystemObject")                                                            
Set objInput = objFS.OpenTextFile("C:\Users\afwi2\Documents\Wikipedia\GOCE-input.txt")                            
Set objOutput = objFS.CreateTextFile("C:\Users\afwi2\Documents\Wikipedia\GOCE-2020-January-Results.txt", True)    
strText = objInput.ReadLine                                                                                       
objOutput.WriteLine "{|class=" & Chr(34) & "wikitable sortable" & Chr(34)                                         
objOutput.WriteLine "|-"                                                                                          
objOutput.WriteLine "!Name"                                                                                       
objOutput.WriteLine "!Raw total"                                                                                  
objOutput.WriteLine "!Bonus total"                                                                                
objOutput.WriteLine "!Old rollover total (DO NOT USE FOR MARCH)"                                                  
objOutput.WriteLine "!Grand total"                                                                                
objOutput.WriteLine "!New rollover total (USE THIS NUMBER FOR MARCH)"                                             
objOutput.WriteLine "!Article count"                                                                              
objOutput.WriteLine "!Old article count"                                                                          
objOutput.WriteLine "!Largest article"                                                                            
objOutput.WriteLine "!5k article count"                                                                           
objOutput.WriteLine "!Word count award"                                                                           
objOutput.WriteLine "|-"                                                                                          
Do While objInput.AtEndOfStream <> True                                                                           
        If InStr(1, strText, "==", 1) Then                                                                        
                nStart = InStr(1, strText, "==", 1) + 2                                                           
                nFinish = InStr (nStart, strText, "==", 1)                                                        
                strName = Mid(strText, nStart, nFinish - nStart)                                                  
                GetTotals                                                                                         
                GetNewRolloverTotal                                                                               
        End If                                                                                                    
        strLine = "|" & strName                                                                                   
        objOutput.WriteLine strLine                                                                               
        strLine = "|" & nRawWordTotal                                                                             
        objOutput.WriteLine strLine                                                                               
        strLine = "|" & nBonusWordTotal                                                                           
        objOutput.WriteLine strLine                                                                               
        strLine = "|" & nOldRolloverTotal                                                                         
        objOutput.WriteLine strLine                                                                               
        strLine = "|" & nGrandWordTotal                                                                           
        objOutput.WriteLine strLine                                                                               
        strLine = "|" & nNewRolloverTotal                                                                         
        objOutput.WriteLine strLine                                                                               
        strLine = "|" & nArticleCount                                                                             
        objOutput.WriteLine strLine                                                                               
        strLine = "|" & nOldArticleCount                                                                          
        objOutPut.WriteLine strLine                                                                               
        strLine = "|" & nLargestArticle                                                                           
        objOutput.WriteLine strLine                                                                               
        strLine = "|" & nFiveKCount                                                                               
        objOutput.WriteLine strLine          
        strLine = "|" & strAward                                                                                  
        objOutput.WriteLine strLine                                                                               
        strLine = "|-"                                                                                            
        objOutput.WriteLine strLine                                                                               
        nRawWordTotal = 0.0                                                                                       
        nGrandWordTotal = 0.0                                                                                     
        nBonusWordTotal = 0.0                                                                                     
        nNewRolloverTotal = 0.0                                                                                   
        nOldRolloverTotal = 0.0                                                                                   
        nArticleCount = 0                                                                                         
        nOldArticleCount = 0                                                                                      
        nArticleWordCount = 0.0                                                                                   
        nLargestArticle = 0                                                                                       
        nFiveKCount = 0                                                                                           
        nTempWordCount = 0                                                                                        
        strName = ""                                                                                              
        strAward = ""                                                                                             
        strRollover = ""                                                                                          
Loop                                                                                                              
        strLine = "| Totals"                                                                                      
        objOutput.WriteLine strLine                                                                               
        strLine = "|" & nEveryoneRaw                                                                              
        objOutput.WriteLine strLine                                                                               
        strLine = "|0"                                                                                            
        objOutput.WriteLine strLine                                                                               
        strLine = "|0"                                                                                            
        objOutput.WriteLine strLine                                                                               
        strLine = "|0"                                                                                            
        objOutput.WriteLine strLine                                                                               
        strLine = "|0"                                                                                            
        objOutput.WriteLine strLine                                                                               
        strLine = "|" & nEveryoneArticle                                                                          
        objOutput.WriteLine strLine                                                                               
        strLine = "|" & nEveryoneOld                                                                              
        objOutput.WriteLine strLine                                                                               
        strLine = "|0"                                                                                            
        objOutput.WriteLine strLine                                                                               
        strLine = "|" & nEveryoneFiveK                                                                            
        objOutput.WriteLine strLine                                                                               
        strLine = "|n/a"                                                                                          
        objOutput.WriteLine strLine                                                                               
        strLine = "|-"                                                                                            
        objOutput.WriteLine strLine                                                                               
Set objFS = Nothing                                                                                               
objOutput.WriteLine "|}"                                                                                          
objInput.Close                                                                                                    
objOutput.Close                                                                                                   
Sub GetTotals                                                                                                     
  'MsgBox "Trying to get next line"                                                                               
        Do While objInput.AtEndOfStream <> True                                                                   
                strText = objInput.ReadLine                                                                       
                If InStr(1, strText, "==", 1) Then                                                                
                        Exit Sub                                                                                  
                End If                                                  
                If InStr(1, strText, "{Completed}", 1) Then                                                       
                        nStart = InStr(1, strText, "(", 1) + 1                                                    
                        nFinish = InStr (nStart, strText, ")", 1)                                                 
                        nArticleCount = nArticleCount + 1                                                         
                        If nStart > 0 Then                                                                        
                                strArticleWordCount = Mid(strText, nStart, nFinish - nStart)                      
                                If IsNumeric (strArticleWordCount) <> True Then                                   
                                        nStart = InStr(nFinish, strText, "(", 1) + 1                              
                                        nFinish = InStr (nStart, strText, ")", 1)                                 
                                        strArticleWordCount = Mid(strText, nStart, nFinish - nStart)              
                                End If                                                                            
                                nArticleWordCount = CInt(strArticleWordCount)                                     
                                If nLargestArticle = 0 Then                                                       
                                        nLargestArticle = nArticleWordCount                                       
                                ElseIf nLargestArticle < nArticleWordCount Then                                   
                                        nLargestArticle = nArticleWordCount                                       
                                End If                                                                            
                                nTempWordCount = nArticleWordCount                                                
                                Do While nTempWordCount > 5000                                                    
                                        nFiveKCount = nFiveKCount + 1                                             
                                        nTempWordCount = nTempWordCount - 5000                                    
                                Loop                                                                              
                                nRawWordTotal = nRawWordTotal + nArticleWordCount                                 
                                If InStr(1, strText, "*O", 1) Then                                                
                                        nOldArticleCount = nOldArticleCount + 1                                   
                                        nArticleWordCount = nArticleWordCount * 1.5                               
                                        nGrandWordTotal = nGrandWordTotal + nArticleWordCount                     
                                ElseIf InStr(1, strText, "*R", 1) Then                                            
                                        nArticleWordCount = nArticleWordCount * 1.5                               
                                        nGrandWordTotal = nGrandWordTotal + nArticleWordCount                     
                                Else                                                                              
                                        nGrandWordTotal = nGrandWordTotal + nArticleWordCount                     
                                End If                                                                            
                        End If                                                                                    
                ElseIf InStr(1, strText, "rollover-words", 1) Then                                                
                        nStart = InStr(1, strText, "=", 1) + 1                                                    
                        nFinish = Len (strText)                                                                   
                        strRollover = Mid(strText, nStart, nFinish - nStart + 1)                                  
                        Trim(strRollover)                                                                         
                        If IsNumeric (strRollover) Then                                                           
                                nOldRolloverTotal = CLng(strRollover)                                             
                        End If                                                                                    
                        'MsgBox "Name: " & strName & vbCrLf & "Bonus: " & nBonusWordTotal & vbCrLf & "Grand: " & nGrandWordTotal & vbCrLf & "Raw: " & nRawWordTotal                                                               
                        nBonusWordTotal = nGrandWordTotal - nRawWordTotal                                         
                        nGrandWordTotal = nGrandWordTotal + nOldRolloverTotal                                     
                        nEveryoneRaw = nEveryoneRaw + nRawWordTotal                                               
                        nEveryoneArticle = nEveryoneArticle + nArticleCount                                       
                        nEveryoneOld = nEveryoneOld + nOldArticleCount                                            
                        nEveryoneFiveK = nEveryoneFiveK + nFiveKCount                                             
                End If                                                                                            
        Loop                                                                                                      
End Sub                    

Attachment #3 – Old instructions edit

[-- Attachment #3: Jonesey's instruxions.txt --]                                                                  
[. . .]                                                            
                                                                                                                  
1) Copy the user tracking section of the drive page into the GOCE-input.txt file.                                 
2) Clean up the raw data as best you can.                                                                         
a) Remove any unused lines such as "# {{Completed}} [[]] ()".                                                     
b) Remove extra commentary and text. (e.g. {{y}} username etc.)                                                   
c) Remove entirely sections of users who did not do any copyediting.                                              
3) Run the script.                                                                                                
4) It will almost certainly not work the first time; you'll get an error window saying what happened (it will probably say error in line 157). Click OK.                                                                       
5) Open the results file in a text editor and see where it stopped.                                               
6) a) Look at the next user's section in the raw text and correct the problem. If it gets stuck on line 157, look at the output file to see the last editor it processed. The next editor has a typo. Look for incorrect punctuation like [ or { instead of (. Look for dual parens and extra text. Look for *0 (zero) instead of *O.     
b) (only if there are problems:) The code looks for numbers in parentheses at the end of each line to get the article word counts, so it gets confused if there are parenthetical notes after the word count.                  
c) (only if there are problems:) Look for problems like "'''*O'''" (remove bolding), "R*" (should be *R), unclosed parens around word counts or square brackets around word counts instead of parens.                               
7) Repeat steps 3-6 until no error window pops up.                                                                
8) Copy the entire results file (GOCE-output.txt) to the barnstars subpage for the completed drive.

Python script (not GOCE script proper) edit

[Python script]
from vb2py.vbfunctions import *
from vb2py.vbdebug import *

objFS = Variant()
objFile = Variant()
objInput = Variant()
objOutput = Variant()
strText = Variant()
strName = Variant()
strLine = Variant()
strArticleWordCount = Variant()
nStart = Variant()
nFinish = Variant()
nRawWordTotal = Variant()
nGrandWordTotal = Variant()
nBonusWordTotal = Variant()
nNewRolloverTotal = Variant()
nOldRolloverTotal = Variant()
nArticleCount = Variant()
nOldArticleCount = Variant()
nArticleWordCount = Variant()
nLargestArticle = Variant()
nFiveKCount = Variant()
TempWordCount = Variant()
strAward = Variant()
nEveryoneRaw = Variant()
nEveryoneArticle = Variant()
nEveryoneOld = Variant()
nEveryoneFiveK = Variant()

def GetTotals():
    #MsgBox "Trying to get next line"
    while objInput.AtEndOfStream != True:
        strText = objInput.ReadLine
        if InStr(1, strText, '==', 1):
            return
        if InStr(1, strText, '{Completed}', 1):
            nStart = InStr(1, strText, '(', 1) + 1
            nFinish = InStr(nStart, strText, ')', 1)
            nArticleCount = nArticleCount + 1
            if nStart > 0:
                strArticleWordCount = Mid(strText, nStart, nFinish - nStart)
                if IsNumeric(strArticleWordCount) != True:
                    nStart = InStr(nFinish, strText, '(', 1) + 1
                    nFinish = InStr(nStart, strText, ')', 1)
                    strArticleWordCount = Mid(strText, nStart, nFinish - nStart)
                nArticleWordCount = CInt(strArticleWordCount)
                if nLargestArticle == 0:
                    nLargestArticle = nArticleWordCount
                elif nLargestArticle < nArticleWordCount:
                    nLargestArticle = nArticleWordCount
                nTempWordCount = nArticleWordCount
                while nTempWordCount > 5000:
                    nFiveKCount = nFiveKCount + 1
                    nTempWordCount = nTempWordCount - 5000
                nRawWordTotal = nRawWordTotal + nArticleWordCount
                if InStr(1, strText, '*O', 1):
                    nOldArticleCount = nOldArticleCount + 1
                    nArticleWordCount = nArticleWordCount * 1.5
                    nGrandWordTotal = nGrandWordTotal + nArticleWordCount
                elif InStr(1, strText, '*R', 1):
                    nArticleWordCount = nArticleWordCount * 1.5
                    nGrandWordTotal = nGrandWordTotal + nArticleWordCount
                else:
                    nGrandWordTotal = nGrandWordTotal + nArticleWordCount
        elif InStr(1, strText, 'rollover-words', 1):
            nStart = InStr(1, strText, '=', 1) + 1
            nFinish = Len(strText)
            strRollover = Mid(strText, nStart, nFinish - nStart + 1)
            Trim(strRollover)
            if IsNumeric(strRollover):
                nOldRolloverTotal = CLng(strRollover)
            #MsgBox "Name: " & strName & vbCrLf & "Bonus: " & nBonusWordTotal & vbCrLf & "Grand: " & nGrandWordTotal & vbCrLf & "Raw: " & nRawWordTotal
            nBonusWordTotal = nGrandWordTotal - nRawWordTotal
            nGrandWordTotal = nGrandWordTotal + nOldRolloverTotal
            nEveryoneRaw = nEveryoneRaw + nRawWordTotal
            nEveryoneArticle = nEveryoneArticle + nArticleCount
            nEveryoneOld = nEveryoneOld + nOldArticleCount
            nEveryoneFiveK = nEveryoneFiveK + nFiveKCount

nRawWordTotal = 0.0
nGrandWordTotal = 0.0
nBonusWordTotal = 0.0
nNewRolloverTotal = 0.0
nOldRolloverTotal = 0.0
nArticleCount = 0
nOldArticleCount = 0
nArticleWordCount = 0.0
nLargestArticle = 0
nFiveKCount = 0
nTempWordCount = 0
strAward = ''
strRollover = ''
nEveryoneRaw = 0.0
nEveryoneArticle = 0
nEveryoneOld = 0
nEveryoneFiveK = 0
objFS = CreateObject('Scripting.FileSystemObject')
objInput = objFS.OpenTextFile('C:\\Users\\afwi2\\Documents\\Wikipedia\\GOCE-input.txt')
objOutput = objFS.CreateTextFile('C:\\Users\\afwi2\\Documents\\Wikipedia\\GOCE-2020-January-Results.txt', True)
strText = objInput.ReadLine
objOutput.WriteLine('{|class=' + Chr(34) + 'wikitable sortable' + Chr(34))
objOutput.WriteLine('|-')
objOutput.WriteLine('!Name')
objOutput.WriteLine('!Raw total')
objOutput.WriteLine('!Bonus total')
objOutput.WriteLine('!Old rollover total (DO NOT USE FOR MARCH)')
objOutput.WriteLine('!Grand total')
objOutput.WriteLine('!New rollover total (USE THIS NUMBER FOR MARCH)')
objOutput.WriteLine('!Article count')
objOutput.WriteLine('!Old article count')
objOutput.WriteLine('!Largest article')
objOutput.WriteLine('!5k article count')
objOutput.WriteLine('!Word count award')
objOutput.WriteLine('|-')
while objInput.AtEndOfStream != True:
    if InStr(1, strText, '==', 1):
        nStart = InStr(1, strText, '==', 1) + 2
        nFinish = InStr(nStart, strText, '==', 1)
        strName = Mid(strText, nStart, nFinish - nStart)
        GetTotals()
        GetNewRolloverTotal()
    strLine = '|' + strName
    objOutput.WriteLine(strLine)
    strLine = '|' + nRawWordTotal
    objOutput.WriteLine(strLine)
    strLine = '|' + nBonusWordTotal
    objOutput.WriteLine(strLine)
    strLine = '|' + nOldRolloverTotal
    objOutput.WriteLine(strLine)
    strLine = '|' + nGrandWordTotal
    objOutput.WriteLine(strLine)
    strLine = '|' + nNewRolloverTotal
    objOutput.WriteLine(strLine)
    strLine = '|' + nArticleCount
    objOutput.WriteLine(strLine)
    strLine = '|' + nOldArticleCount
    objOutPut.WriteLine(strLine)
    strLine = '|' + nLargestArticle
    objOutput.WriteLine(strLine)
    strLine = '|' + nFiveKCount
    objOutput.WriteLine(strLine)
    strLine = '|' + strAward
    objOutput.WriteLine(strLine)
    strLine = '|-'
    objOutput.WriteLine(strLine)
    nRawWordTotal = 0.0
    nGrandWordTotal = 0.0
    nBonusWordTotal = 0.0
    nNewRolloverTotal = 0.0
    nOldRolloverTotal = 0.0
    nArticleCount = 0
    nOldArticleCount = 0
    nArticleWordCount = 0.0
    nLargestArticle = 0
    nFiveKCount = 0
    nTempWordCount = 0
    strName = ''
    strAward = ''
    strRollover = ''
strLine = '| Totals'
objOutput.WriteLine(strLine)
strLine = '|' + nEveryoneRaw
objOutput.WriteLine(strLine)
strLine = '|0'
objOutput.WriteLine(strLine)
strLine = '|0'
objOutput.WriteLine(strLine)
strLine = '|0'
objOutput.WriteLine(strLine)
strLine = '|0'
objOutput.WriteLine(strLine)
strLine = '|' + nEveryoneArticle
objOutput.WriteLine(strLine)
strLine = '|' + nEveryoneOld
objOutput.WriteLine(strLine)
strLine = '|0'
objOutput.WriteLine(strLine)
strLine = '|' + nEveryoneFiveK
objOutput.WriteLine(strLine)
strLine = '|n/a'
objOutput.WriteLine(strLine)
strLine = '|-'
objOutput.WriteLine(strLine)
objFS = None
objOutput.WriteLine('|}')
objInput.Close()
objOutput.Close()