![Parentheses Parentheses](/uploads/1/2/5/7/125717194/206269137.png)
throws an error
cannot use parenthesis when calling a sub
i'm calling a function, what can I do to fix this?
Code:
file1 = 'http://www.devguru.com/technologies/wsh/17413.asp'
downloadfile(file1, 'c:file.html')
function downloadfile(strFileURL, strHDLocation)
'http://blog.netnerds.net/2007/01/vbscript-download-and-save-a-binary-
file/
' Fetch the file
Set objXMLHTTP = CreateObject('MSXML2.XMLHTTP')
objXMLHTTP.open 'GET', strFileURL, false
objXMLHTTP.send()
If objXMLHTTP.Status = 200 Then
Set objADOStream = CreateObject('ADODB.Stream')
objADOStream.Open
objADOStream.Type = 1 'adTypeBinary
objADOStream.Write objXMLHTTP.ResponseBody
objADOStream.Position = 0 'Set the stream position to the
start
Set objFSO = Createobject('Scripting.FileSystemObject')
If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile
strHDLocation
Set objFSO = Nothing
objADOStream.SaveToFile strHDLocation
objADOStream.Close
Set objADOStream = Nothing
End if
Set objXMLHTTP = Nothing
end function
cannot use parenthesis when calling a sub
i'm calling a function, what can I do to fix this?
Code:
file1 = 'http://www.devguru.com/technologies/wsh/17413.asp'
downloadfile(file1, 'c:file.html')
function downloadfile(strFileURL, strHDLocation)
'http://blog.netnerds.net/2007/01/vbscript-download-and-save-a-binary-
file/
' Fetch the file
Set objXMLHTTP = CreateObject('MSXML2.XMLHTTP')
objXMLHTTP.open 'GET', strFileURL, false
objXMLHTTP.send()
If objXMLHTTP.Status = 200 Then
Set objADOStream = CreateObject('ADODB.Stream')
objADOStream.Open
objADOStream.Type = 1 'adTypeBinary
objADOStream.Write objXMLHTTP.ResponseBody
objADOStream.Position = 0 'Set the stream position to the
start
Set objFSO = Createobject('Scripting.FileSystemObject')
If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile
strHDLocation
Set objFSO = Nothing
objADOStream.SaveToFile strHDLocation
objADOStream.Close
Set objADOStream = Nothing
End if
Set objXMLHTTP = Nothing
end function
Jan 05, 2019 As a thumb rule, here are the ONLY 3 situations where you can use parenthesis safely with VBScript. Result = twoarguments(10,20): When you retrieve the return value from a function with an assignment operator, you can have any number of arguments in parenthesis. Can you count the number of OPENED and CLOSED paranthesis there, which doesn't tally. You seem to close the REPLACE function just after strCol3, so that results in not interpretting VBCRLF, as you wanted. It should look like.