Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9001551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:27:06+00:00 2026-06-16T00:27:06+00:00

I have no formal background in scripting, so I apologize upfront for my ignorance.

  • 0

I have no formal background in scripting, so I apologize upfront for my ignorance. I’m trying to find a way download csv files from the internet to a file location using vbscript. After referencing the web, I am able to do this successfully in one case using arguments for the URL and new file location/name. However, I would like to string this together into a for loop to repeat many times, so adding arguments to the command line doesn’t seem like it will work. I realize variables cannot have periods. Is there a way to pull a comma separated arguments w/o having to paste it into the command line? Or alternative, is there a way to package variables into the for loop if they have periods (such as web pages do)?

this one seems to work if I add a single website and file location as the two arguments in command line:

Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
BinaryStream.Type = adTypeBinary
BinaryStream.Open
BinaryStream.Write BinaryGetURL(Wscript.Arguments(0))
BinaryStream.SaveToFile Wscript.Arguments(1), adSaveCreateOverWrite
Function BinaryGetURL(URL)
Dim Http
Set Http = CreateObject("WinHttp.WinHttpRequest.5.1")
Http.Open "GET", URL, False
Http.Send
BinaryGetURL = Http.ResponseBody
End Function

I cant get this one to work when I try to build the parameters based on variable arrays. Seems to fail at “function” w/ syntax error (periods in variables):

myWebSite = split(commaseparateURLs,",")
myFileLocation = split (commaseparateFiles,",")
num_WebSite = UBound(myFileLocation)
for i = 0 to num_WebSite
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
BinaryStream.Type = adTypeBinary
BinaryStream.Open
BinaryStream.Write BinaryGetURL(myWebSite(i))
BinaryStream.SaveToFile myFileLocation(i), adSaveCreateOverWrite
Function BinaryGetURL(URL)
Dim Http
Set Http = CreateObject("WinHttp.WinHttpRequest.5.1")
Http.Open "GET", URL, False
Http.Send
BinaryGetURL = Http.ResponseBody
End Function
Next    

Any little nudge on this one will help. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:27:07+00:00Added an answer on June 16, 2026 at 12:27 am

    You have the Function definition for GetBinaryFile in the middle of the for loop. Functions must be the root of the file, not inside other code.

    I’ve also formatted your code by indenting the code in blocks and adding white space. These makes it much more clear what code is inside a Function and which code is inside the for loop.

    Const adTypeBinary = 1
    Const adSaveCreateOverWrite = 2
    
    myWebSite = split(commaseparateURLs,",")
    myFileLocation = split (commaseparateFiles,",")
    num_WebSite = UBound(myFileLocation)
    
    for i = 0 to num_WebSite
        Dim BinaryStream
        Set BinaryStream = CreateObject("ADODB.Stream")
        BinaryStream.Type = adTypeBinary
        BinaryStream.Open
        BinaryStream.Write BinaryGetURL(myWebSite(i))
        BinaryStream.SaveToFile myFileLocation(i), adSaveCreateOverWrite
    Next
    
    Function BinaryGetURL(URL)
        Dim Http
        Set Http = CreateObject("WinHttp.WinHttpRequest.5.1")
        Http.Open "GET", URL, False
        Http.Send
        BinaryGetURL = Http.ResponseBody
    End Function 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

BACKGROUND I have a scenario where I must repeatedly find certain words in text,
I have an app that needs to fetch background media from the server even
I do not have a formal background in Natural Language Processing was wondering if
I am new to programming and come from a non-CS background (no formal degree).
I have a rather simple C++-problem, but coming from a C-background I am not
I have a video with transparent background in .avi format (Made from Adobe After
Background I have a simple socket server setup that I am trying to allow
I have a ProgressDialog that retrieves in background data from database by executing php
Background I have a secured folder containing secret report files (in pdf format). Each
Background: I have an iterative hash algorithm I need to compute from a Python

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.