drumminfreak
Member
- Joined
- Oct 31, 2011
- Messages
- 5
- Programming Experience
- Beginner
Hi I haven't posted in a while.... and hoping this is the right place to find an answer.
I'm trying to write a Fixture Creator, ive got most of it done (maybe the long way round but it works upto this point) and i'm stuck.
OK.
What i've got!
Text file called "Playersort1" full of data set out like:
Player1
v
Player12
Player2
v
Player11
and so on.
code that looks like this:
Dim Player AsStringDim Test1 AsString
Dim readText AsString
Dim fso, inputFile, outputFile
Dim str AsString
fso = CreateObject("Scripting.FileSystemObject")
inputFile = fspenTextFile(store() & "PlayerSort1.txt")
str = inputFile.ReadAll
'*******************************************************************************************************
For i AsInteger = 1 To 20
If System.IO.File.Exists(Players() & "Player" & i & ".txt") Then
readText = (Players() & "Player" & i & ".txt")
Dim textParser AsNewTextBox textParser.Multiline = False
textParser.Text = My.Computer.FileSystem.ReadAllText(readText)
Player = "Player" & i
readText = (Players() & Player & ".txt") If System.IO.File.Exists(readText) Then
textParser.Multiline = False
textParser.Text = My.Computer.FileSystem.ReadAllText(readText)
Test1 = textParser.Lines(0)
str = Replace(str, Player, Test1)
outputFile = fso.CreateTextFile(store() & "PlayerSort2.txt", True)
outputFile.Write(str)
outputFile.close() inputFile.close()
EndIf
Else
Exit Sub
End If
Next
End Sub
*******************************************************
Now obviously it replaces all the "Player#" in the text file to their actual names.
The output is fine until it gets to double figures (Player10 +)
For example if Player1 is "Fred"
Then Player10, Player11 and Player12 come out like "Fred0", "Fred1" and "Fred2"
If this is making sense to anyone and they know how i can go about fixing it. Please please please tell me....
I'm trying to write a Fixture Creator, ive got most of it done (maybe the long way round but it works upto this point) and i'm stuck.
OK.
What i've got!
Text file called "Playersort1" full of data set out like:
Player1
v
Player12
Player2
v
Player11
and so on.
code that looks like this:
Dim Player AsStringDim Test1 AsString
Dim readText AsString
Dim fso, inputFile, outputFile
Dim str AsString
fso = CreateObject("Scripting.FileSystemObject")
inputFile = fspenTextFile(store() & "PlayerSort1.txt")
str = inputFile.ReadAll
'*******************************************************************************************************
For i AsInteger = 1 To 20
If System.IO.File.Exists(Players() & "Player" & i & ".txt") Then
readText = (Players() & "Player" & i & ".txt")
Dim textParser AsNewTextBox textParser.Multiline = False
textParser.Text = My.Computer.FileSystem.ReadAllText(readText)
Player = "Player" & i
readText = (Players() & Player & ".txt") If System.IO.File.Exists(readText) Then
textParser.Multiline = False
textParser.Text = My.Computer.FileSystem.ReadAllText(readText)
Test1 = textParser.Lines(0)
str = Replace(str, Player, Test1)
outputFile = fso.CreateTextFile(store() & "PlayerSort2.txt", True)
outputFile.Write(str)
outputFile.close() inputFile.close()
EndIf
Else
Exit Sub
End If
Next
End Sub
*******************************************************
Now obviously it replaces all the "Player#" in the text file to their actual names.
The output is fine until it gets to double figures (Player10 +)
For example if Player1 is "Fred"
Then Player10, Player11 and Player12 come out like "Fred0", "Fred1" and "Fred2"
If this is making sense to anyone and they know how i can go about fixing it. Please please please tell me....