forked from Pulover/PuloversMacroCreator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExtractLangFiles.ahk
41 lines (36 loc) · 929 Bytes
/
ExtractLangFiles.ahk
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
#NoEnv
SetWorkingDir %A_ScriptDir%
xlLastCell = 11
XL := ComObjCreate("Excel.Application")
XL.Workbooks.Open(A_ScriptDir "\Languages.xls")
XL.Sheets("Lang_Files").Activate
Xl.Range(Xl.Range("A1"), Xl.Range("A1").SpecialCells(xlLastCell)).Copy
ClipWait
If !InStr(Clipboard, "LoadLang_")=1
{
MsgBox Error
return
}
PMC := {}, nLang := []
Loop, Parse, Clipboard, `n, `r
{
Label := "", a := A_Index
StringSplit, Line, A_LoopField, `t
Loop, 2
Label .= (a = 1) ? Line%A_Index% : Line%A_Index% "`t"
Loop, % Line0 - 2
{
i := A_Index + 2
PMC.Lang[A_Index] .= Label . Line%i% "`n"
If InStr(Label, "LoadLang_")
nLang[A_Index] := SubStr(Line%i%, 1, 2)
}
}
FileDelete, %A_ScriptDir%\Lang\*.Lang
For each, Lan in PMC.Lang
FileAppend, % Lan, % A_ScriptDir "\Lang\" nLang[A_Index] ".Lang", UTF-8
XL.Application.CutCopyMode := False
XL.Workbooks(1).Close(0)
TrayTip,, Finished extracting Lang files.
Sleep, 2000
return