hello all,

i have a text file in the following format,

cn: testgroup
description: testgroup
mail: testgroep@fabrikcam.com
user1
user2
user3

cn: testgroup1
description: testgroup1
mail: testgroep1@fabrikcam.com
user1
user2
user3
user4
user5



from this file i try to create groups in active directory with vbscript, i
have the following script already,
but i can search for the strin cn:, but how do i return the next lines to a
variable?
so i seach for cn, and put the description, and mail and users in a variable
to create the group.
by the way the number of users vary per group, i can;t get it working, any
help would be appricated

greetings martin

strSearchcn = "cn:"
strSearchDis = "description:"
strSearchMail = "mail:"


Do While objFile.AtEndOfStream = True
strLine = objFile.ReadLine

If Instr(strLine, strSearchcn) Then
searchcn = Mid(strline,5)
End If

Re: seach for text help needed by mr

mr
Tue Aug 17 16:46:54 CDT 2004

hi Martijn,

you didn't mention the script host, but assuming it's wscript (or mshta),
then you may use fso (more formally known as: file scripting object), to
read and write text files.

fso can read and write individual lines, but frequently you will see
scripters read in the entire text file (readAll), and then pick it apart
using "split" in various ways. For example, using "split" with vbCrLf will
split your text "blob" into individual lines.

However, if you have unlimited time on your hands, I recommend
"doing-it-right-the-first-time", (a slogan heard in corporate america).
That is, convert your text file to an xml file. Then you will be able to
structure the information, (for example having a variable number of users
per group), and more easily be able to read the information, using
microsoft's handy-dandy "MSXML2.DOMDocument" object, with the xml document
object model.

if you are foolish enough to accept my suggestion, you will find numerous
examples of code in this n.g., by searching this group for "msxml".

cheers, jw

p.s. while it says msxml2 above, you may (and probably do) have a later
version, like: msxml3, msxml4, etc.

"martijn spelt" <_spamfree_martijn.spelt@xs4all.nl> wrote in message
news:e23QJmEhEHA.1048@tk2msftngp13.phx.gbl...
> but how do i return the next lines to a
> variable?