gnucash-on-windows master: Multiple changes pushed
Geert Janssens
gjanssens at code.gnucash.org
Thu Oct 5 13:26:48 EDT 2017
Updated via https://github.com/Gnucash/gnucash-on-windows/commit/6e365508 (commit)
via https://github.com/Gnucash/gnucash-on-windows/commit/9b30fa5d (commit)
via https://github.com/Gnucash/gnucash-on-windows/commit/c82d18e0 (commit)
via https://github.com/Gnucash/gnucash-on-windows/commit/8b7638b6 (commit)
from https://github.com/Gnucash/gnucash-on-windows/commit/211beda7 (commit)
commit 6e3655087a4483f52a0d473619e0e6c0010b4297
Author: Geert Janssens <geert at kobaltwit.be>
Date: Thu Oct 5 19:26:19 2017 +0200
Remove the now unused HTTPDownload function
diff --git a/bootstrap_win_dev.vbs b/bootstrap_win_dev.vbs
index 8626947..f886072 100644
--- a/bootstrap_win_dev.vbs
+++ b/bootstrap_win_dev.vbs
@@ -417,49 +417,6 @@ Sub Welcome
End Sub
-' Download a file over http
-Sub HTTPDownload( myURL, myPath )
-' This Sub downloads the FILE specified in myURL to the path specified in myPath.
-'
-' myURL must always end with a file name
-' myPath may be a directory or a file name; in either case the directory must exist
-'
-' Based on a script written by Rob van der Woude
-' http://www.robvanderwoude.com
-
- ' Standard housekeeping
- Dim i, objFile, objHTTP, strFile, strMsg
-
- ' Check if the specified target file or folder exists,
- ' and build the fully qualified path of the target file
- If objFso.FolderExists( myPath ) Then
- strFile = objFso.BuildPath( myPath, Mid( myURL, InStrRev( myURL, "/" ) + 1 ) )
- ElseIf objFso.FolderExists( Left( myPath, InStrRev( myPath, "\" ) - 1 ) ) Then
- strFile = myPath
- Else
- stdout.WriteLine "ERROR: Target folder not found."
- AbortScript
- End If
-
- ' Create or open the target file
- Set objFile = objFso.OpenTextFile( strFile, ForWriting, True )
-
- ' Create an HTTP object
- Set objHTTP = CreateObject( "MSXML2.ServerXMLHTTP" )
-
- ' Download the specified URL
- objHTTP.Open "GET", myURL, False
- objHTTP.Send
-
- ' Write the downloaded byte stream to the target file
- For i = 1 To LenB( objHTTP.ResponseBody )
- objFile.Write Chr( AscB( MidB( objHTTP.ResponseBody, i, 1 ) ) )
- Next
-
- ' Close the target file
- objFile.Close( )
-End Sub
-
' Download a binary type file over http
Sub HTTPDownloadBinaryFile( myURL, myPath )
' This Sub downloads the FILE specified in myURL to the path specified in myPath.
commit 9b30fa5d12c9eccef4a69a6ef1a1ee6939b03c73
Merge: 211beda c82d18e
Author: Geert Janssens <geert at kobaltwit.be>
Date: Thu Oct 5 19:19:36 2017 +0200
Merge branch 'master' of https://github.com/wonhoseo/gnucash-on-windows
commit c82d18e0162ac3dca987fa90bf82e93bb282d6f5
Author: Wonho Seo <cforgeleader at gmail.com>
Date: Sat Aug 12 17:46:23 2017 +0900
Update bootstrap_win_dev.vbs
bug fix oStream.SaveToFile strFile
diff --git a/bootstrap_win_dev.vbs b/bootstrap_win_dev.vbs
index b9fbc3b..8626947 100644
--- a/bootstrap_win_dev.vbs
+++ b/bootstrap_win_dev.vbs
@@ -461,7 +461,7 @@ Sub HTTPDownload( myURL, myPath )
End Sub
' Download a binary type file over http
-Sub HTTPDownloadBinaryFile( myURL, myPath )
+Sub HTTPDownloadBinaryFile( myURL, myPath )
' This Sub downloads the FILE specified in myURL to the path specified in myPath.
'
' myURL must always end with a file name
@@ -469,12 +469,11 @@ Sub HTTPDownloadBinaryFile( myURL, myPath )
'
' Based on a script written by Rob van der Woude
' http://www.robvanderwoude.com
-' Ref: https://stackoverflow.com/questions/29367130/downloading-a-file-in-vba-and-storing-it
+' Ref: https://stackoverflow.com/questions/29367130/downloading-a-file-in-vba-and-storing-it
' Standard housekeeping
Dim i, objFile, objHTTP, strFile, strMsg
-
Const adSaveCreateOverWrite = 2, adSaveCreateNotExist = 1
Const adTypeBinary = 1
@@ -489,9 +488,6 @@ Sub HTTPDownloadBinaryFile( myURL, myPath )
AbortScript
End If
- ' Create or open the target file
- 'Set objFile = objFso.OpenTextFile( strFile, ForWriting, True )
-
' Create an HTTP object
Set objHTTP = CreateObject( "MSXML2.ServerXMLHTTP" )
@@ -501,19 +497,17 @@ Sub HTTPDownloadBinaryFile( myURL, myPath )
' Write the downloaded byte stream to the target file
If objHTTP.Status = 200 Then
- ' Create the target stream
- Set oStream = CreateObject("ADODB.Stream")
- oStream.Open
- oStream.Type = adTypeBinary
- oStream.Write objHTTP.responseBody
- oStream.SaveToFile filePath, adSaveCreateOverWrite ' 1 = no overwrite, 2 = overwrite
- ' Close the target file
- oStream.Close
- End If
-
+ ' Create the target stream
+ Set oStream = WScript.CreateObject( "ADODB.Stream" )
+ oStream.Open
+ oStream.Type = adTypeBinary
+ oStream.Write objHTTP.responseBody
+ oStream.SaveToFile strFile, adSaveCreateOverWrite ' 1 = no overwrite, 2 = overwrite
+ ' Close the target file
+ oStream.Close
+ End If
End Sub
-
' Extract a zip file strZipFile into strFolder
Function ExtractAll(strZipFile, strFolder)
Set objShell = CreateObject("Shell.Application")
commit 8b7638b6014ecf31b43321c5eabc68fcddfccdbe
Author: Wonho Seo <cforgeleader at gmail.com>
Date: Sat Aug 12 17:10:32 2017 +0900
Update bootstrap_win_dev.vbs
add sub procedure HTTPDownloadBinaryFile for download mingw-get.zip file(bug fix)
diff --git a/bootstrap_win_dev.vbs b/bootstrap_win_dev.vbs
index 00feb3f..b9fbc3b 100644
--- a/bootstrap_win_dev.vbs
+++ b/bootstrap_win_dev.vbs
@@ -163,7 +163,7 @@ Else
If Not objFso.FileExists(strMingwGetZip) Then
stdout.Write "Downloading mingw-get.zip (slow!)... "
strMingwGetZipUrl = "https://github.com/Gnucash/gnucash-on-windows/raw/master/mingw-get.zip"
- HTTPDownload strMingwGetZipUrl, strMingwGetZip
+ HTTPDownloadBinaryFile strMingwGetZipUrl, strMingwGetZip
stdout.WriteLine "Success"
End If
@@ -460,7 +460,60 @@ Sub HTTPDownload( myURL, myPath )
objFile.Close( )
End Sub
+' Download a binary type file over http
+Sub HTTPDownloadBinaryFile( myURL, myPath )
+' This Sub downloads the FILE specified in myURL to the path specified in myPath.
+'
+' myURL must always end with a file name
+' myPath may be a directory or a file name; in either case the directory must exist
+'
+' Based on a script written by Rob van der Woude
+' http://www.robvanderwoude.com
+' Ref: https://stackoverflow.com/questions/29367130/downloading-a-file-in-vba-and-storing-it
+
+ ' Standard housekeeping
+ Dim i, objFile, objHTTP, strFile, strMsg
+
+
+ Const adSaveCreateOverWrite = 2, adSaveCreateNotExist = 1
+ Const adTypeBinary = 1
+
+ ' Check if the specified target file or folder exists,
+ ' and build the fully qualified path of the target file
+ If objFso.FolderExists( myPath ) Then
+ strFile = objFso.BuildPath( myPath, Mid( myURL, InStrRev( myURL, "/" ) + 1 ) )
+ ElseIf objFso.FolderExists( Left( myPath, InStrRev( myPath, "\" ) - 1 ) ) Then
+ strFile = myPath
+ Else
+ stdout.WriteLine "ERROR: Target folder not found."
+ AbortScript
+ End If
+
+ ' Create or open the target file
+ 'Set objFile = objFso.OpenTextFile( strFile, ForWriting, True )
+
+ ' Create an HTTP object
+ Set objHTTP = CreateObject( "MSXML2.ServerXMLHTTP" )
+
+ ' Download the specified URL
+ objHTTP.Open "GET", myURL, False
+ objHTTP.Send
+
+ ' Write the downloaded byte stream to the target file
+ If objHTTP.Status = 200 Then
+ ' Create the target stream
+ Set oStream = CreateObject("ADODB.Stream")
+ oStream.Open
+ oStream.Type = adTypeBinary
+ oStream.Write objHTTP.responseBody
+ oStream.SaveToFile filePath, adSaveCreateOverWrite ' 1 = no overwrite, 2 = overwrite
+ ' Close the target file
+ oStream.Close
+ End If
+
+End Sub
+
' Extract a zip file strZipFile into strFolder
Function ExtractAll(strZipFile, strFolder)
Set objShell = CreateObject("Shell.Application")
Summary of changes:
bootstrap_win_dev.vbs | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
More information about the gnucash-changes
mailing list