1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
| Const ForReading = 1
DIM P(108)
dim co, v , w , x , y , z
co = 0
for i = 0 to 108
p(i) = 0
next
Set fso = CreateObject("Scripting.FileSystemObject")
Set Fold = fso.GetFolder("C:\Users\user.user-HP\Desktop\History poker\PokerPlayer") ' Dossier de test à modificher selon ce que tu as.
For Each Fichier In Fold.Files
If UCase(Right(Fichier.Name,4)) = ".TXT" Then
w=0 : x=0 : y = 0 : z = 0 : v = 0
Set F = fso.OpenTextFile(Fichier.Path, ForReading, False)
Do While Not F.AtEndOfStream
Ret = F.ReadLine ' Lecture du fichier ligne par ligne
If Instr(Ret, "PokerPlayer a fini le tournoi en ") >0 Then
w=1
for j = 1 to 9
if recupnumeric(ret,1) = j then
p(j) = p(j)+1
v=1
end if
next
co=1
Exit Do
elseif instr(ret, "PokerPlayer a fini ") >0 then
if instr(Ret, "la 3e place ")>0 then
x=1
p(3)=p(3)+1
end if
if instr(Ret, "la 2e place ")>0 then
y=1
p(2)=p(2)+1
end if
co=1
exit do
elseif instr(ret, "PokerPlayer remporte le tournoi ") >0 then
z=1
p(1) = p(1)+1
co=1
exit do
end if
Loop
F.Close
if co = 0 then
msgbox "1" & chr(13) & chr(13) & fichier.path
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile(fichier)
end if
co = 0
End If
Next
for i = 1 to 108
p(0) = p(i) + p(0)
next
wscript.echo p(0)
wscript.echo "nbr de 1ere place : " & p(1)
wscript.echo "nbr de 2nd place : " & p(2)
wscript.echo "nbr de 1eme place : "& p(1)
for i = 3 to 9
wscript.echo "nbr de " & i & "eme place : " & p(i)
next
Function RecupNumeric(strsoumis, Occurrence)
'StrSoumis, phrase ou chercher le nombre
'Occurrence, choix de la position du chiffre a récupérer
Dim Cpt ' compteur
Dim NumOccurrence ' compteur d'Occurrence
Dim NumericStr ' conteneur de l'entrée soumise
Dim StrNumeric ' conteneur de tout se qui semble numérique
Dim CharLue ' conteneur du caractère scanné
Dim UneDecimale ' drapeau pour ne se limiter qu'a un séparateur décimal
NumericStr = CStr(StrSoumis)
If Len(NumericStr) = 0 Then GestErr
NumOccurrence = 1
For Cpt = 1 To Len(NumericStr)
CharLue = Mid(NumericStr, Cpt, 1)
If (CharLue = "." Or CharLue = ",") And StrNumeric = "" Then CharLue = ""
If (CharLue = "." Or CharLue = ",") And UneDecimale = True Then CharLue = ""
If IsNumeric(CharLue) Or CharLue = "." Or CharLue = "," Or CharLue = "-" Then StrNumeric = StrNumeric & CharLue
If CharLue = "." Or CharLue = "," Then
If UneDecimale = False Then UneDecimale = True Else Exit For
End If
If StrNumeric <> "" Then
If CharLue = " " And Cpt < Len(NumericStr) Then
If Not IsNumeric(Mid(NumericStr, Cpt + 1, 1)) Then
If NumOccurrence = Occurrence Then
Exit For
Else
StrNumeric = "": UneDecimale = False: NumOccurrence = NumOccurrence + 1
End If
End If
End If
End If
Next
If NumOccurrence <> Occurrence Then StrNumeric = "0"
StrNumeric = Replace(StrNumeric, ".", ",")
If IsNumeric(StrNumeric) Then RecupNumeric = CDbl(StrNumeric)
Exit Function
GestErr:
Err.Clear
RecupNumeric = 0
End Function |
Partager