| |
|
1 |
Const ForReading = 1 |
| |
|
2 |
Const ForWriting = 2 |
| |
|
3 |
|
| |
|
4 |
strOldFileName = Wscript.Arguments(0) |
| |
|
5 |
strNewFileName = Wscript.Arguments(1) |
| |
|
6 |
strMajor = WScript.Arguments(2) |
| |
|
7 |
strMinor = WScript.Arguments(3) |
| |
|
8 |
strSVN = WScript.Arguments(4) |
| |
|
9 |
strCustom = WScript.Arguments(5) |
| |
|
10 |
strTextVersion = WScript.Arguments(6) |
| |
|
11 |
|
| |
|
12 |
' Validate parameters |
| |
|
13 |
if strOldFileName = "" or strNewFileName = "" or strMajor = "" or strMinor = "" or strSVN = "" or strCustom ="" or strTextVersion="" then |
| |
|
14 |
WScript.echo "Missing input parameters" |
| |
|
15 |
return 1 |
| |
|
16 |
end if |
| |
|
17 |
|
| |
|
18 |
Set objFSO = CreateObject("Scripting.FileSystemObject") |
| |
|
19 |
|
| |
|
20 |
' Read the source file |
| |
|
21 |
Set objFile = objFSO.OpenTextFile(strOldFileName, ForReading) |
| |
|
22 |
|
| |
|
23 |
strText = objFile.ReadAll |
| |
|
24 |
objFile.Close |
| |
|
25 |
|
| |
|
26 |
' Replace the text |
| |
|
27 |
strText = Replace(strText, "{major_version}", strMajor) |
| |
|
28 |
strText = Replace(strText, "{minor_version}", strMinor) |
| |
|
29 |
strText = Replace(strText, "{svn_version}", strSVN) |
| |
|
30 |
strText = Replace(strText, "{custom_version}", strCustom) |
| |
|
31 |
strText = Replace(strText, "{text_version}", strTextVersion) |
| |
|
32 |
|
| |
|
33 |
' And write the text |
| |
|
34 |
Set objFile = objFSO.OpenTextFile(strNewFileName, ForWriting) |
| |
|
35 |
objFile.WriteLine strText |
| |
|
36 |
objFile.Close |