Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim myFile As String, text As String, textline As String, posLat As Integer, posLong As Integer, myPath As String, OtherNumber As Integer, NumberToLetter As String, Startnumber As Integer
- Dim CheckAgainst, CheckAgainst2, InformationText, ProtectionLine As String
- Dim ProperLinePosition As Integer, DontSkip As Boolean
- Sub setEU4File()
- 'myPath = (Application.DefaultFilePath & "\")
- ' myPath = "C:\Program Files (x86)\Steam\steamapps\common\Europa Universalis IV\history\provinces\"
- 'C:\Users\Tjeerdsma\Documents\Paradox Interactive\Europa Universalis IV\mod\Imperialism-Reinvigorated\history\provinces
- myPath = (Application.DefaultFilePath & "\Paradox Interactive\Europa Universalis IV\mod\Imperialism-Reinvigorated\history\provinces\")
- Dim fname As Variant
- 'BASE VARIABLES
- Startnumber = 1 'NUMBER TO START LOOKING FOR
- BaseLimit = 5000 'FILES IT WILL LOOK FOR PAST STARTNUMBER
- OtherNumber = 1 'RESET NUMBER FOR PROPER FUNCTIONING
- 'LOOP ALL FILES
- For Base = 1 To BaseLimit
- 'MsgBox myPath
- fname = Dir(myPath & CStr(Startnumber) & "-*.txt")
- 'MsgBox fname
- 'CONVERT NUM TO LETTER SUB
- Number2Letter
- 'WRITE DOWN EASY INFO INTO CONVERTEDINFO SHEET
- Worksheets("ConvertedInfo").Cells(OtherNumber, 3).Value = Startnumber
- fullstring = CStr(fname)
- ComplexName = Replace(fullstring, (CStr(Startnumber) & " - "), "")
- ComplexName = Replace(ComplexName, ".txt", "")
- Worksheets("ConvertedInfo").Cells(OtherNumber, 4).Value = ComplexName
- Worksheets("ConvertedInfo").Cells(OtherNumber, 5).Value = Worksheets("ConvertedInfo").Cells(OtherNumber, 4).Value
- 'COPY OVER INFO INTO BASEINFO SHEET
- If fname <> "" Then
- myFile = myPath & fname
- OpenEU4File
- End If
- Startnumber = Startnumber + 1
- OtherNumber = OtherNumber + 1
- Next Base
- End Sub
- Sub OpenEU4File()
- 'myFile = Application.GetOpenFilename()
- Open myFile For Input As #1
- Number = 1
- text = ""
- Do Until EOF(1)
- Line Input #1, textline
- ComplexRange = NumberToLetter + CStr(Number)
- 'MsgBox ComplexRange
- Worksheets("BaseInfo").Range(ComplexRange) = textline
- 'text = text & textline & vbNewLine
- 'MsgBox text
- Number = Number + 1
- 'WRITE DOWN COMPLEX INFO INTO CONVERTEDINFO SHEET
- 'CHECK FOR CERTAIN LINE AND DO X
- InformationText = textline
- ProtectionLine = "= {" 'Tries to make sure history things dont get looked into
- If InStr(InformationText, ProtectionLine) <> 0 Then
- Close #1
- Exit Sub
- Else
- CheckAgainst = "capital ="
- CheckAgainst2 = "capital"
- ProperLinePosition = 10
- DontSkip = True
- WriteThings 'Runs code with previous Variables
- CheckAgainst = "culture ="
- CheckAgainst2 = "culture"
- ProperLinePosition = 11
- DontSkip = True
- WriteThings 'Runs code with previous Variables
- CheckAgainst = "religion ="
- CheckAgainst2 = "religion"
- ProperLinePosition = 13
- DontSkip = True
- WriteThings 'Runs code with previous Variables
- CheckAgainst = "hre ="
- CheckAgainst2 = "hre"
- ProperLinePosition = 15
- DontSkip = True
- WriteThings 'Runs code with previous Variables
- CheckAgainst = "is_city ="
- CheckAgainst2 = "is_city"
- ProperLinePosition = 17
- DontSkip = True
- WriteThings 'Runs code with previous Variables
- CheckAgainst = "owner ="
- CheckAgainst2 = "owner"
- ProperLinePosition = 18
- DontSkip = True
- WriteThings 'Runs code with previous Variables
- CheckAgainst = "controller ="
- CheckAgainst2 = "controller"
- ProperLinePosition = 19
- DontSkip = True
- WriteThings 'Runs code with previous Variables
- CheckAgainst = "add_core ="
- CheckAgainst2 = "add_core"
- ProperLinePosition = 21
- DontSkip = True
- WriteThings 'Runs code with previous Variables
- CheckAgainst = "base_tax ="
- CheckAgainst2 = "base_tax"
- ProperLinePosition = 23
- DontSkip = True
- WriteThings 'Runs code with previous Variables
- CheckAgainst = "base_production ="
- CheckAgainst2 = "base_production"
- ProperLinePosition = 24
- DontSkip = True
- WriteThings 'Runs code with previous Variables
- CheckAgainst = "base_manpower ="
- CheckAgainst2 = "base_manpower"
- ProperLinePosition = 25
- DontSkip = True
- WriteThings 'Runs code with previous Variables
- CheckAgainst = "trade_goods ="
- CheckAgainst2 = "trade_goods"
- ProperLinePosition = 30
- DontSkip = True
- WriteThings 'Runs code with previous Variables
- 'CheckAgainst = "latent_trade_goods ="
- 'CheckAgainst2 = "latent_trade_goods"
- 'ProperLinePosition = 31
- 'DontSkip = True
- 'WriteThings 'Runs code with previous Variables
- End If
- Loop
- Close #1
- End Sub
- Sub WriteThings()
- If InStr(InformationText, CheckAgainst) <> 0 Then
- ConvertedInformation = InformationText
- RemoveCodeSign = Worksheets("ConvertedInfo").Cells(1, 1)
- RemoveCheckAgainst = (CheckAgainst & " ")
- ConvertedInformation = Replace(ConvertedInformation, RemoveCheckAgainst, "")
- ConvertedInformation = Replace(ConvertedInformation, Chr(34), "")
- Worksheets("ConvertedInfo").Cells(OtherNumber, ProperLinePosition).Value = ConvertedInformation
- 'MsgBox InformationText
- ElseIf InStr(InformationText, CheckAgainst2) <> 0 Then 'SPECIAL FIX FOR LANDSHUT
- ConvertedInformation = InformationText
- RemoveCodeSign = Worksheets("ConvertedInfo").Cells(1, 1)
- ConvertedInformation = Replace(ConvertedInformation, CheckAgainst2, "")
- If DontSkip = True Then
- ConvertedInformation = Replace(ConvertedInformation, vbTab, "")
- End If
- ConvertedInformation = Replace(ConvertedInformation, "= ", "")
- ConvertedInformation = Replace(ConvertedInformation, Chr(34), "")
- Worksheets("ConvertedInfo").Cells(OtherNumber, ProperLinePosition).Value = ConvertedInformation
- 'MsgBox InformationText
- End If
- End Sub
- Sub Number2Letter()
- 'Convert To Column Letter
- If OtherNumber = 0 Then
- Else
- NumberToLetter = Split(Cells(1, OtherNumber).Address, "$")(1)
- End If
- 'MsgBox NumberToLetter
- 'DEBUG
- 'MsgBox "Column " & ColumnNumber & " = Column " & PasteRangeColumn
- End Sub
- Sub Testing5()
- Cells(2, 1).Value = Chr(34)
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement