Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Tutorials on arrays in VBScript?

Reply
 
Old 01-08-2009   #1 (permalink)
Christopher Beard


 
 

Tutorials on arrays in VBScript?

I commonly use the FOR %%I IN in a batch file to pull a list from a text file
and execute a command plugging in each line from the text file. I would like
to be able to do this in VBScript, but can't seem to find the right
tutorials. I know I need to load the data into an array, but I'm not sure
what to do from there. Can anyone help with a "how to" or tutorials? Thanks!
Christopher Beard

My System SpecsSystem Spec
Old 01-08-2009   #2 (permalink)
Pegasus \(MVP\)


 
 

Re: Tutorials on arrays in VBScript?


"Christopher Beard" <ChristopherBeard@xxxxxx> wrote in
message news:74FF5ECF-BFCE-4F87-8F2F-344EB08D9E79@xxxxxx
Quote:

>I commonly use the FOR %%I IN in a batch file to pull a list from a text
>file
> and execute a command plugging in each line from the text file. I would
> like
> to be able to do this in VBScript, but can't seem to find the right
> tutorials. I know I need to load the data into an array, but I'm not sure
> what to do from there. Can anyone help with a "how to" or tutorials?
> Thanks!
> Christopher Beard
You *can* load the data into an array but you don't have to - you can
equally easily read the text file on a line by line basis. Download a copy
of script56.chm from the Microsoft site, then have a look at these methods:

For arrays:
- oFSO.OpenTextFile.ReadAll
- split

For a line-by-line read:
- oFSO.OpenTextFile.ReadLine
- oFSO.OpenTextFile.AtEndOfStream

The Scripting Guy files can also be of tremendous help:
http://www.microsoft.com/downloads/d...displaylang=en


My System SpecsSystem Spec
Old 01-08-2009   #3 (permalink)
Christopher Beard


 
 

Re: Tutorials on arrays in VBScript?

I will research this info. Thank you very much!

"Pegasus (MVP)" wrote:
Quote:

>
> "Christopher Beard" <ChristopherBeard@xxxxxx> wrote in
> message news:74FF5ECF-BFCE-4F87-8F2F-344EB08D9E79@xxxxxx
Quote:

> >I commonly use the FOR %%I IN in a batch file to pull a list from a text
> >file
> > and execute a command plugging in each line from the text file. I would
> > like
> > to be able to do this in VBScript, but can't seem to find the right
> > tutorials. I know I need to load the data into an array, but I'm not sure
> > what to do from there. Can anyone help with a "how to" or tutorials?
> > Thanks!
> > Christopher Beard
>
> You *can* load the data into an array but you don't have to - you can
> equally easily read the text file on a line by line basis. Download a copy
> of script56.chm from the Microsoft site, then have a look at these methods:
>
> For arrays:
> - oFSO.OpenTextFile.ReadAll
> - split
>
> For a line-by-line read:
> - oFSO.OpenTextFile.ReadLine
> - oFSO.OpenTextFile.AtEndOfStream
>
> The Scripting Guy files can also be of tremendous help:
> http://www.microsoft.com/downloads/d...displaylang=en
>
>
>
My System SpecsSystem Spec
Old 01-08-2009   #4 (permalink)
Richard Mueller [MVP]


 
 

Re: Tutorials on arrays in VBScript?

I have an example VBScript program that reads names from a text file and
adds them to a group. The program demonstrates how to read lines from a file
and is linked here:

http://www.rlmueller.net/Add%20Users...0Group%201.htm

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--

"Christopher Beard" <ChristopherBeard@xxxxxx> wrote in
message news:F6148C01-49DC-4431-AA3D-578EB94A7A2E@xxxxxx
Quote:

>I will research this info. Thank you very much!
>
> "Pegasus (MVP)" wrote:
>
Quote:

>>
>> "Christopher Beard" <ChristopherBeard@xxxxxx> wrote in
>> message news:74FF5ECF-BFCE-4F87-8F2F-344EB08D9E79@xxxxxx
Quote:

>> >I commonly use the FOR %%I IN in a batch file to pull a list from a text
>> >file
>> > and execute a command plugging in each line from the text file. I would
>> > like
>> > to be able to do this in VBScript, but can't seem to find the right
>> > tutorials. I know I need to load the data into an array, but I'm not
>> > sure
>> > what to do from there. Can anyone help with a "how to" or tutorials?
>> > Thanks!
>> > Christopher Beard
>>
>> You *can* load the data into an array but you don't have to - you can
>> equally easily read the text file on a line by line basis. Download a
>> copy
>> of script56.chm from the Microsoft site, then have a look at these
>> methods:
>>
>> For arrays:
>> - oFSO.OpenTextFile.ReadAll
>> - split
>>
>> For a line-by-line read:
>> - oFSO.OpenTextFile.ReadLine
>> - oFSO.OpenTextFile.AtEndOfStream
>>
>> The Scripting Guy files can also be of tremendous help:
>> http://www.microsoft.com/downloads/d...displaylang=en
>>
>>
>>

My System SpecsSystem Spec
Old 01-09-2009   #5 (permalink)
Christopher Beard


 
 

Re: Tutorials on arrays in VBScript?

Awesome! Thank you very much!

"Richard Mueller [MVP]" wrote:
Quote:

> I have an example VBScript program that reads names from a text file and
> adds them to a group. The program demonstrates how to read lines from a file
> and is linked here:
>
> http://www.rlmueller.net/Add%20Users...0Group%201.htm
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
> "Christopher Beard" <ChristopherBeard@xxxxxx> wrote in
> message news:F6148C01-49DC-4431-AA3D-578EB94A7A2E@xxxxxx
Quote:

> >I will research this info. Thank you very much!
> >
> > "Pegasus (MVP)" wrote:
> >
Quote:

> >>
> >> "Christopher Beard" <ChristopherBeard@xxxxxx> wrote in
> >> message news:74FF5ECF-BFCE-4F87-8F2F-344EB08D9E79@xxxxxx
> >> >I commonly use the FOR %%I IN in a batch file to pull a list from a text
> >> >file
> >> > and execute a command plugging in each line from the text file. I would
> >> > like
> >> > to be able to do this in VBScript, but can't seem to find the right
> >> > tutorials. I know I need to load the data into an array, but I'm not
> >> > sure
> >> > what to do from there. Can anyone help with a "how to" or tutorials?
> >> > Thanks!
> >> > Christopher Beard
> >>
> >> You *can* load the data into an array but you don't have to - you can
> >> equally easily read the text file on a line by line basis. Download a
> >> copy
> >> of script56.chm from the Microsoft site, then have a look at these
> >> methods:
> >>
> >> For arrays:
> >> - oFSO.OpenTextFile.ReadAll
> >> - split
> >>
> >> For a line-by-line read:
> >> - oFSO.OpenTextFile.ReadLine
> >> - oFSO.OpenTextFile.AtEndOfStream
> >>
> >> The Scripting Guy files can also be of tremendous help:
> >> http://www.microsoft.com/downloads/d...displaylang=en
> >>
> >>
> >>
>
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Tutorials General Discussion


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46