Results 1 to 2 of 2

Thread: !!!the Ultimate Question!!!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2001
    Location
    UK
    Posts
    99

    Exclamation !!!the Ultimate Question!!!

    ok dudes, here is the code
    <vbcode>
    Private Sub GetHomeDIR()
    Dim userhome As String
    Dim UsrHme As String
    userhome = FreeFile()
    FileOpen(userhome, TbUserhomeFile.Text, OpenMode.Input, OpenAccess.Read)

    Do
    UsrHme = LineInput(userhome)
    If UsrHme > "User: " Then
    'UsrHme.Trim(" " & "User: ")
    Debug.WriteLine(UsrHme)
    Else
    Debug.WriteLine("Error!!!")
    End If
    If UsrHme.StartsWith("P" then '< "Path: " Then
    'UsrHme.Trim(" " & "Path: ")
    Debug.WriteLine(UsrHme)
    Else
    Debug.WriteLine("Error!!!")
    End If
    Loop Until EOF(userhome)
    FileClose(userhome)
    End Sub
    </vbcode>

    now, here is what everything does:
    userhome = path to text file
    UsrHme = 1 line of the text file

    there is a whole load more code but u guys done need it all, basicly the problem is i need to say if UsrHme contains "User: " then cut off "User: " and remove all spaces, this also need to be the same for path as you can see, here is a sample of the text file im working with.

    Object Class: User
    Current context: mh0.dar.dfee
    User: DGORDON
    Home Directory:
    Volume Name: DFEE-DAR-807_USERS_NS.SHARED.
    Path: Dummy_HD
    Name Space Type: DOS
    User: JWRIGHT1
    Home Directory:
    Volume Name: DFEE-DAR-807_USERS_NS.SHARED.
    Path: JWRIGHT1
    Name Space Type: DOS
    User: ACARTER
    Home Directory:
    Volume Name: DFEE-DAR-807_USERS_NS.SHARED.
    Path: ACARTER
    Name Space Type: DOS
    User: ACURLE
    Home Directory:
    Volume Name: DFEE-DAR-807_USERS_NS.SHARED.
    Path: ACURLE
    Name Space Type: DOS
    User: AROGERS
    Home Directory:
    Volume Name: DFEE-DAR-807_USERS_NS.SHARED.
    Path: AROGERS
    Name Space Type: DOS
    User: AWIDMER
    Home Directory:
    Volume Name: DFEE-DAR-807_USERS_NS.SHARED.
    Path: AWIDMER
    Name Space Type: DOS
    User: SCUTHBERTSON
    Home Directory:
    Volume Name: DFEE-DAR-807_USERS_NS.SHARED.
    Path: SCUTHBER
    Name Space Type: DOS
    User: CTATE
    Home Directory:
    Volume Name: DFEE-DAR-807_USERS_NS.SHARED.
    Path: CTATE
    Name Space Type: DOS
    User: RCOPELAND
    Home Directory:
    Volume Name: DFEE-DAR-807_USERS_NS.SHARED.
    Path: RCOPELAN
    Name Space Type: DOS
    User: BDUTTON
    Home Directory:
    Volume Name: DFEE-DAR-807_USERS_NS.SHARED.
    Path: BDUTTON
    Name Space Type: DOS
    User: BHODGSON
    Home Directory:
    Volume Name: DFEE-DAR-807_USERS_NS.SHARED.
    Path: BHODGSON
    Name Space Type: DOS
    User: CMATHIESON
    Home Directory:
    Volume Name: DFEE-DAR-807_USERS_NS.SHARED.
    Path: CMATHIES
    Name Space Type: DOS
    User: MTARELLI
    Home Directory:
    Volume Name: DFEE-DAR-803_USERS.SHARED.
    Path: MTARELLI
    Name Space Type: DOS


    As you can all see there is alot of crap i dont want, this just need to be ignored, the out put is from nlist, a novel exportation tool, and the idea is to get the users name and home directory, i have everything else ready i just need this to work then i have all the infomation i need to make the scripts work.

    Also does anyone know if ASDI works with .net?, coz thats the next part, useing ADSI from .net to connect to active directory and make groups and users, so... if anyone has any thought on this, it would be ace, also, check out my other post, its mostly irelevent now but i would still like to know, and if you read this PLEASE try to answer, its totaly important guys manythanks to all who read and help me

  2. #2
    Hyperactive Member
    Join Date
    Dec 2001
    Location
    Dublin, Ireland
    Posts
    262
    if UsrHme.IndexOf("User:") > -1 then
    UsrHme = UsrHme.Replace("User:", "").trim
    end if

    IndexOf searches for an instance of the specified string and returns the poition it is found. It returns -1 if it is not found.
    Replace replaces the first string specified with the second - in this case we replace it with nothing - ""
    Trim removes all leading and trailing spaces.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width