Windows Vista Forums

object dictionary
  1. #1


    vbscript newbie Guest

    object dictionary

    hello im trying to create a script that will compare two text files. The
    script should compare the text file word per line. I already have a
    script for this but i used array to split the line. Now here is my
    problem i am required to use object dictionary no array must be used.
    Can you please help me how to split line into word using dictionary.
    Thank you

    Do While Tfile1.AtEndOfStream <> True
    y = y+1
    Stra = Tfile1.ReadLine

    If Tfile2.AtEndOfStream <> True then
    Stra1 = Tfile2.ReadLine
    Else
    Stra1 = " "
    End if

    Stra = Stra + " "
    Stra1 = Stra1 + " "
    Arr1 = Split(Stra)
    Arr2 = Split(Stra1)
    Ctra = Ubound(Arr1)

    For x =1 to Ctra



    If (Arr1(x-1)) <> (Arr2(x-1)) then
    Strc = " "" " + Arr1(x-1) + " "" Line " + Cstr(y) + " In
    Textfile 1 "
    Strc1 = " "" " + Arr2(x-1) + " "" Line " + Cstr(y) + " In
    Textfile 2 "
    Strc = Strc + Strc1

    Ofile.WriteLine(Strc)

    *** Sent via Developersdex http://www.developersdex.com ***

      My System SpecsSystem Spec

  2. #2


    Python42 Guest

    Re: object dictionary

    This sounds a lot like you are trying to get someone to do your homework
    assignment for you. Mostly because

    1) there are already free programs out there that will do this for you
    2) you are very specific about how the comparison is to be done

    I suggest you just do it yourself or you won't learn anything.

    "vbscript newbie" <winsome08@xxxxxx> wrote in message
    news:uFZEpR5pJHA.4028@xxxxxx

    > hello im trying to create a script that will compare two text files. The
    > script should compare the text file word per line. I already have a
    > script for this but i used array to split the line. Now here is my
    > problem i am required to use object dictionary no array must be used.
    > Can you please help me how to split line into word using dictionary.
    > Thank you
    >
    > Do While Tfile1.AtEndOfStream <> True
    > y = y+1
    > Stra = Tfile1.ReadLine
    >
    > If Tfile2.AtEndOfStream <> True then
    > Stra1 = Tfile2.ReadLine
    > Else
    > Stra1 = " "
    > End if
    >
    > Stra = Stra + " "
    > Stra1 = Stra1 + " "
    > Arr1 = Split(Stra)
    > Arr2 = Split(Stra1)
    > Ctra = Ubound(Arr1)
    >
    > For x =1 to Ctra
    >
    > If (Arr1(x-1)) <> (Arr2(x-1)) then
    > Strc = " "" " + Arr1(x-1) + " "" Line " + Cstr(y) + " In
    > Textfile 1 "
    > Strc1 = " "" " + Arr2(x-1) + " "" Line " + Cstr(y) + " In
    > Textfile 2 "
    > Strc = Strc + Strc1
    >
    > Ofile.WriteLine(Strc)
    >
    > *** Sent via Developersdex http://www.developersdex.com ***


      My System SpecsSystem Spec

  3. #3


    gimme_this_gimme_that Guest

    Re: object dictionary

    No one studies VBScript in college. Python - yes. VBScript - no.

      My System SpecsSystem Spec

  4. #4


    Python42 Guest

    Re: object dictionary

    This sounds a lot like you are trying to get someone to do your homework
    assignment for you. Mostly because

    1) there are already free programs out there that will do this for you
    2) you are very specific about how the comparison is to be done

    I suggest you just do it yourself or you won't learn anything.


    "vbscript newbie" <winsome08@xxxxxx> wrote in message
    news:uFZEpR5pJHA.4028@xxxxxx

    > hello im trying to create a script that will compare two text files. The
    > script should compare the text file word per line. I already have a
    > script for this but i used array to split the line. Now here is my
    > problem i am required to use object dictionary no array must be used.
    > Can you please help me how to split line into word using dictionary.
    > Thank you
    >
    > Do While Tfile1.AtEndOfStream <> True
    > y = y+1
    > Stra = Tfile1.ReadLine
    >
    > If Tfile2.AtEndOfStream <> True then
    > Stra1 = Tfile2.ReadLine
    > Else
    > Stra1 = " "
    > End if
    >
    > Stra = Stra + " "
    > Stra1 = Stra1 + " "
    > Arr1 = Split(Stra)
    > Arr2 = Split(Stra1)
    > Ctra = Ubound(Arr1)
    >
    > For x =1 to Ctra
    >
    > If (Arr1(x-1)) <> (Arr2(x-1)) then
    > Strc = " "" " + Arr1(x-1) + " "" Line " + Cstr(y) + " In
    > Textfile 1 "
    > Strc1 = " "" " + Arr2(x-1) + " "" Line " + Cstr(y) + " In
    > Textfile 2 "
    > Strc = Strc + Strc1
    >
    > Ofile.WriteLine(Strc)
    >
    > *** Sent via Developersdex http://www.developersdex.com ***


      My System SpecsSystem Spec

  5. #5


    gina enrique Guest

    Re: object dictionary

    Do
    intSpace = InStr(intPos, strText, " ")

    If (intSpace) Then
    strTextTrans = Mid(strText, intPos, intSpace - intPos)
    objDictionary.Add inti, strTextTrans
    intPos = intSpace + 1
    inti = inti + 1

    Else

    strLastword = Right(strText, Len(strText) - intPos + 1)
    objDictionary.Add inti, strLastword
    Exit Do
    End If
    Loop

    *** Sent via Developersdex http://www.developersdex.com ***

      My System SpecsSystem Spec

object dictionary problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Binding TextBox.Text to property in nested (multi levels) object withbindingsource, Error if grandchild object is NULL Efy .NET General 0 14 Oct 2009
Dictionary Object theNugget2009 VB Script 4 22 Sep 2009
Inherit from usercontrol - Object not set to instance of an object Nemisis .NET General 0 10 Jun 2009
Dictionary<TKey,TValue> as a Dictionary key in C# 2.0 dox .NET General 5 19 Mar 2008
Adding canonical aliases for Compare-Object, Measure-Object, New-Object Alex K. Angelopoulos [MVP] PowerShell 2 26 May 2006