WgetUnCompress objArgs(1), Showpath(objArgs(2))\r
Case "GetUnzipSounds"\r
WgetSounds objArgs(1), objArgs(2), Showpath(objArgs(3)), objArgs(4)\r
- Case "Version" \r
+ Case "Version"\r
'CreateVersion(tmpFolder, VersionDir, includebase, includedest)\r
CreateVersion Showpath(objArgs(1)), Showpath(objArgs(2)), objArgs(3), objArgs(4)\r
End Select\r
' *******************\r
\r
Sub WgetSounds(PrimaryName, Freq, DestFolder, VersionFile)\r
- BaseURL = "http://files.freeswitch.org/freeswitch-sounds"\r
- Set objFSO = CreateObject("Scripting.FileSystemObject")\r
- Set objTextFile = objFSO.OpenTextFile(VersionFile,1)\r
- Do Until objTextFile.AtEndOfStream\r
- strLine = objTextFile.Readline\r
- if Len(strLine) > 2 then\r
- versionPos = InstrRev(strLine, " ", -1, 1)\r
- name = Left(strLine, versionPos-1)\r
- if name = PrimaryName Then\r
- version = Right(strLine, Len(strLine) - versionPos)\r
- Wscript.Echo "Sound name: " & name & " Version " & version\r
- URL = BaseURL & "-" & name & "-" & Freq &"-" & version & ".tar.gz"\r
- Wscript.Echo "URL: " & URL\r
- WgetUnCompress URL, Showpath(DestFolder)\r
- End If\r
- End if\r
- Loop\r
+ BaseURL = "http://files.freeswitch.org/freeswitch-sounds"\r
+ Set objFSO = CreateObject("Scripting.FileSystemObject")\r
+ Set objTextFile = objFSO.OpenTextFile(VersionFile,1)\r
+ Do Until objTextFile.AtEndOfStream\r
+ strLine = objTextFile.Readline\r
+ if Len(strLine) > 2 then\r
+ versionPos = InstrRev(strLine, " ", -1, 1)\r
+ name = Left(strLine, versionPos-1)\r
+ if name = PrimaryName Then\r
+ version = Right(strLine, Len(strLine) - versionPos)\r
+ Wscript.Echo "Sound name: " & name & " Version " & version\r
+ URL = BaseURL & "-" & name & "-" & Freq &"-" & version & ".tar.gz"\r
+ Wscript.Echo "URL: " & URL\r
+ WgetUnCompress URL, Showpath(DestFolder)\r
+ End If\r
+ End if\r
+ Loop\r
End Sub\r
\r
Sub WgetUnCompress(URL, DestFolder)\r
If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If\r
- StartPos = InstrRev(URL, "/", -1, 1) \r
+ StartPos = InstrRev(URL, "/", -1, 1)\r
strlength = Len(URL)\r
filename=Right(URL,strlength-StartPos)\r
NameEnd = InstrRev(filename, ".",-1, 1)\r
If fileext = "zip" Then\r
UnCompress Destfolder & filename, DestFolder & filebase\r
Else\r
- UnCompress Destfolder & filename, DestFolder \r
+ UnCompress Destfolder & filename, DestFolder\r
End If\r
End Sub\r
\r
Sub GetWgetEXE(DestFolder)\r
Dim oExec\r
If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If\r
- If Not FSO.FileExists(DestFolder & "wget.exe") Then \r
+ If Not FSO.FileExists(DestFolder & "wget.exe") Then\r
Slow_Wget ToolsBase & "wget.exe", DestFolder\r
- End If \r
+ End If\r
End Sub\r
\r
-Function Strip(Str)
- Set oRE = New Regexp
- oRE.Pattern = "[\W_]"
- oRE.Global = True
- Strip=oRE.Replace(Str, "")
-End Function
-
+Function Strip(Str)\r
+ Set oRE = New Regexp \r
+ oRE.Pattern = "[\W_]" \r
+ oRE.Global = True \r
+ Strip=oRE.Replace(Str, "") \r
+End Function\r
+\r
Sub UnCompress(Archive, DestFolder)\r
- batname = "tmp" & Strip(Archive) & CStr(Int(10000*Rnd)) & ".bat"
- wscript.echo("Extracting: " & Archive & " - using: " & batname)
+ batname = "tmp" & Strip(Archive) & CStr(Int(10000*Rnd)) & ".bat"\r
+ wscript.echo("Extracting: " & Archive & " - using: " & batname)\r
Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)\r
MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Archive & quote & " -y -o" & quote & DestFolder & quote )\r
MyFile.Close\r
Do\r
WScript.Echo OExec.StdOut.ReadLine()\r
Loop While Not OExec.StdOut.atEndOfStream\r
- If FSO.FileExists(Left(Archive, Len(Archive)-3))Then\r
+ wscript.echo("Ready extracting: " & Archive) \r
+ Fn = Left(Archive, Len(Archive)-3)\r
+ If FSO.FileExists(Fn) Then\r
WScript.Sleep(100)\r
- FSO.DeleteFile UtilsDir & batname, True \r
+ wscript.echo("Processing: " & Fn & " - deleting " & batname)\r
+ FSO.DeleteFile UtilsDir & batname, True\r
Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)\r
- MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Left(Archive, Len(Archive)-3) & quote & " -y -o" & quote & DestFolder & quote )\r
+ MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Fn & quote & " -y -o" & quote & DestFolder & quote )\r
MyFile.Close\r
Set oExec = WshShell.Exec(UtilsDir & batname)\r
Do\r
WScript.Echo OExec.StdOut.ReadLine()\r
Loop While Not OExec.StdOut.atEndOfStream\r
+ wscript.echo("Ready extracting: " & Fn) \r
WScript.Sleep(500)\r
- FSO.DeleteFile Left(Archive, Len(Archive)-3) ,true \r
+ wscript.echo("Deleting: " & Fn)\r
+ FSO.DeleteFile Fn,true\r
End If\r
- If FSO.FileExists(Left(Archive, Len(Archive)-3) & "tar")Then \r
+ Fn= Fn & tar\r
+ If FSO.FileExists(Fn) Then\r
WScript.Sleep(100)\r
- FSO.DeleteFile UtilsDir & batname, True \r
+ wscript.echo("Processing: " & Fn & " - deleting " & batname)\r
+ FSO.DeleteFile UtilsDir & batname, True\r
Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)\r
- MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Left(Archive, Len(Archive)-3) & "tar" & quote & " -y -o" & quote & DestFolder & quote )\r
+ MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Fn & quote & " -y -o" & quote & DestFolder & quote )\r
MyFile.Close\r
Set oExec = WshShell.Exec(UtilsDir & batname)\r
Do\r
WScript.Echo OExec.StdOut.ReadLine()\r
Loop While Not OExec.StdOut.atEndOfStream\r
+ wscript.echo("Ready extracting: " & Fn ) \r
WScript.Sleep(500)\r
- FSO.DeleteFile Left(Archive, Len(Archive)-3) & "tar",true \r
+ wscript.echo("Deleting: " & Fn)\r
+ FSO.DeleteFile Fn,true\r
End If\r
- \r
+\r
WScript.Sleep(500)\r
- If FSO.FileExists(UtilsDir & batname)Then \r
+ If FSO.FileExists(UtilsDir & batname)Then\r
FSO.DeleteFile UtilsDir & batname, True\r
End If\r
End Sub\r
\r
Sub Wget(URL, DestFolder)\r
- StartPos = InstrRev(URL, "/", -1, 1) \r
+ StartPos = InstrRev(URL, "/", -1, 1)\r
strlength = Len(URL)\r
filename=Right(URL,strlength-StartPos)\r
If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If\r
\r
- Wscript.echo("Downloading: " & URL)\r
- \r
-If UseWgetEXE Then\r
- batname = "tmp" & CStr(Int(10000*Rnd)) & ".bat"\r
- Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)\r
- MyFile.WriteLine("@cd " & quote & DestFolder & quote)\r
- MyFile.WriteLine("@" & quote & UtilsDir & "wget.exe" & quote & " " & URL)\r
- MyFile.Close\r
- Set oExec = WshShell.Exec(UtilsDir & batname)\r
- Do\r
- WScript.Echo OExec.StdOut.ReadLine()\r
- Loop While Not OExec.StdOut.atEndOfStream\r
+ If UseWgetEXE Then\r
+ Wscript.echo("Downloading (wget): " & URL)\r
+ batname = "tmp" & CStr(Int(100000*Rnd)) & ".bat"\r
+ Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)\r
+ MyFile.WriteLine("@cd " & quote & DestFolder & quote)\r
+ MyFile.WriteLine("@" & quote & UtilsDir & "wget.exe" & quote & " " & URL)\r
+ MyFile.Close\r
+ Set oExec = WshShell.Exec(UtilsDir & batname)\r
+ Do\r
+ WScript.Echo OExec.StdOut.ReadLine()\r
+ Loop While Not OExec.StdOut.atEndOfStream\r
\r
-Else\r
- xml.Open "GET", URL, False\r
- xml.Send\r
- \r
- Const adTypeBinary = 1\r
- Const adSaveCreateOverWrite = 2\r
- Const adSaveCreateNotExist = 1 \r
-\r
- oStream.type = adTypeBinary\r
- oStream.open\r
- oStream.write xml.responseBody\r
- oStream.savetofile DestFolder & filename, adSaveCreateOverWrite\r
- oStream.close\r
-End If\r
+ Else\r
+ Wscript.echo("Downloading (HTTP GET): " & URL)\r
+\r
+ xml.Open "GET", URL, False\r
+ xml.Send\r
+ \r
+ Const adTypeBinary = 1\r
+ Const adSaveCreateOverWrite = 2\r
+ Const adSaveCreateNotExist = 1\r
+\r
+ oStream.type = adTypeBinary\r
+ oStream.open\r
+ oStream.write xml.responseBody\r
+ oStream.savetofile DestFolder & filename, adSaveCreateOverWrite\r
+ oStream.close\r
+ End If\r
\r
End Sub\r
\r
Sub Slow_Wget(URL, DestFolder)\r
- StartPos = InstrRev(URL, "/", -1, 1) \r
+ StartPos = InstrRev(URL, "/", -1, 1)\r
strlength = Len(URL)\r
filename=Right(URL,strlength-StartPos)\r
If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If\r
Wscript.echo("Downloading: " & URL)\r
xml.Open "GET", URL, False\r
xml.Send\r
- \r
- const ForReading = 1 , ForWriting = 2 , ForAppending = 8 \r
-Set MyFile = fso.OpenTextFile(DestFolder & filename ,ForWriting, True)\r
-For i = 1 to lenb(xml.responseBody)\r
- MyFile.write Chr(Ascb(midb(xml.responseBody,i,1)))\r
-Next\r
-MyFile.Close()\r
+\r
+ const ForReading = 1 , ForWriting = 2 , ForAppending = 8\r
+ Set MyFile = fso.OpenTextFile(DestFolder & filename ,ForWriting, True)\r
+ For i = 1 to lenb(xml.responseBody)\r
+ MyFile.write Chr(Ascb(midb(xml.responseBody,i,1)))\r
+ Next\r
+ MyFile.Close()\r
\r
End Sub\r
\r
\r
Function FindVersionStringInConfigure(strConfigFile, strVersionString)\r
\r
-Set objRegEx = CreateObject("VBScript.RegExp")\r
-objRegEx.Pattern = "[^#]AC_SUBST\(" & strVersionString & ".*\[([^\[]*)\]"\r
- \r
-Set objFSO = CreateObject("Scripting.FileSystemObject")\r
-Set objFile = objFSO.OpenTextFile(strConfigFile, 1)\r
-strSearchString = objFile.ReadAll\r
-objFile.Close\r
-\r
-Set colMatches = objRegEx.Execute(strSearchString) \r
-\r
-strResult = ""\r
-If colMatches.Count > 0 Then\r
- For Each strMatch in colMatches \r
- strResult = objRegEx.Replace(strMatch.Value, "$1")\r
- Next\r
-End If\r
+ Set objRegEx = CreateObject("VBScript.RegExp")\r
+ objRegEx.Pattern = "[^#]AC_SUBST\(" & strVersionString & ".*\[([^\[]*)\]"\r
+\r
+ Set objFSO = CreateObject("Scripting.FileSystemObject")\r
+ Set objFile = objFSO.OpenTextFile(strConfigFile, 1)\r
+ strSearchString = objFile.ReadAll\r
+ objFile.Close\r
+\r
+ Set colMatches = objRegEx.Execute(strSearchString)\r
+\r
+ strResult = ""\r
+ If colMatches.Count > 0 Then\r
+ For Each strMatch in colMatches\r
+ strResult = objRegEx.Replace(strMatch.Value, "$1")\r
+ Next\r
+ End If\r
\r
FindVersionStringInConfigure = strResult\r
\r
End Function\r
\r
Sub FindReplaceInFile(FileName, sFind, sReplace)\r
- Const OpenAsASCII = 0 ' Opens the file as ASCII (TristateFalse) \r
- Const OpenAsUnicode = -1 ' Opens the file as Unicode (TristateTrue) \r
- Const OpenAsDefault = -2 ' Opens the file using the system default \r
- \r
- Const OverwriteIfExist = -1 \r
- Const FailIfNotExist = 0 \r
- Const ForReading = 1 \r
- \r
+ Const OpenAsASCII = 0 ' Opens the file as ASCII (TristateFalse)\r
+ Const OpenAsUnicode = -1 ' Opens the file as Unicode (TristateTrue)\r
+ Const OpenAsDefault = -2 ' Opens the file using the system default\r
+\r
+ Const OverwriteIfExist = -1\r
+ Const FailIfNotExist = 0\r
+ Const ForReading = 1\r
+\r
Set fOrgFile = FSO.OpenTextFile(FileName, ForReading, FailIfNotExist, OpenAsASCII)\r
sText = fOrgFile.ReadAll\r
fOrgFile.Close\r
End Sub\r
\r
Function ExecAndGetResult(tmpFolder, VersionDir, execStr)\r
- \r
Set MyFile = FSO.CreateTextFile(tmpFolder & "tmpExec.Bat", True)\r
MyFile.WriteLine("@" & "cd " & quote & VersionDir & quote)\r
MyFile.WriteLine("@" & execStr)\r
MyFile.Close\r
- \r
+\r
Set oExec = WshShell.Exec("cmd /C " & quote & tmpFolder & "tmpExec.Bat" & quote)\r
- \r
+\r
ExecAndGetResult = Trim(OExec.StdOut.ReadLine())\r
\r
Do\r
Loop While Not OExec.StdOut.atEndOfStream\r
- \r
+\r
FSO.DeleteFile(tmpFolder & "tmpExec.Bat")\r
\r
End Function\r
\r
Function ExecAndGetExitCode(tmpFolder, VersionDir, execStr)\r
- \r
+\r
Set MyFile = FSO.CreateTextFile(tmpFolder & "tmpExec.Bat", True)\r
MyFile.WriteLine("@" & "cd " & quote & VersionDir & quote)\r
MyFile.WriteLine("@" & execStr)\r
MyFile.WriteLine("@exit %ERRORLEVEL%")\r
MyFile.Close\r
- \r
+\r
ExecAndGetExitCode = WshShell.Run("cmd /C " & quote & tmpFolder & "tmpExec.Bat" & quote, 0, True)\r
- \r
+\r
FSO.DeleteFile(tmpFolder & "tmpExec.Bat")\r
\r
End Function\r
\r
Function GetTimeUTC()\r
\r
- iOffset = WshShell.RegRead("HKLM\System\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias")\r
- \r
- If IsNumeric(iOffset) Then\r
- GetTimeUTC = DateAdd("n", iOffset, Now())\r
- Else\r
- GetTimeUTC = Now()\r
- End If\r
+ iOffset = WshShell.RegRead("HKLM\System\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias")\r
+\r
+ If IsNumeric(iOffset) Then\r
+ GetTimeUTC = DateAdd("n", iOffset, Now())\r
+ Else\r
+ GetTimeUTC = Now()\r
+ End If\r
\r
End Function\r
\r
Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest)\r
Dim oExec\r
- \r
+\r
strVerMajor = FindVersionStringInConfigure(VersionDir & "configure.in", "SWITCH_VERSION_MAJOR")\r
strVerMinor = FindVersionStringInConfigure(VersionDir & "configure.in", "SWITCH_VERSION_MINOR")\r
strVerMicro = FindVersionStringInConfigure(VersionDir & "configure.in", "SWITCH_VERSION_MICRO")\r
strVerRev = FindVersionStringInConfigure(VersionDir & "configure.in", "SWITCH_VERSION_REVISION")\r
strVerHuman = FindVersionStringInConfigure(VersionDir & "configure.in", "SWITCH_VERSION_REVISION_HUMAN")\r
- \r
+\r
'Set version to the one reported by configure.in\r
If strVerRev <> "" Then\r
- VERSION = strVerRev\r
+ VERSION = strVerRev\r
End If\r
\r
Dim sLastFile\r
End If\r
sLastFile.Close\r
End If\r
- \r
+\r
If VERSION & " " & strVerHuman <> sLastVersion Then\r
Set MyFile = fso.CreateTextFile(tmpFolder & "lastversion", True)\r
MyFile.WriteLine(VERSION & " " & strVerHuman)\r
MyFile.Close\r
- \r
+\r
FSO.CopyFile includebase, includedest, true\r
FindReplaceInFile includedest, "@SWITCH_VERSION_REVISION@", VERSION\r
FindReplaceInFile includedest, "@SWITCH_VERSION_MAJOR@", strVerMajor\r
FindReplaceInFile includedest, "@SWITCH_VERSION_MICRO@", strVerMicro\r
FindReplaceInFile includedest, "@SWITCH_VERSION_REVISION_HUMAN@", strVerHuman\r
End If\r
- \r
+\r
End Sub\r