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 - object dictionary

Reply
 
Old 03-18-2009   #1 (permalink)
vbscript newbie


 
 

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
Old 03-21-2009   #2 (permalink)
Python42


 
 

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
Quote:

> 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
Old 03-21-2009   #3 (permalink)
gimme_this_gimme_that


 
 

Re: object dictionary

No one studies VBScript in college. Python - yes. VBScript - no.
My System SpecsSystem Spec
Old 03-22-2009   #4 (permalink)
Python42


 
 

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
Quote:

> 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
Old 03-23-2009   #5 (permalink)
gina enrique


 
 

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
Reply

Thread Tools


Similar Threads
Thread Forum
Dictionary Object VB Script
datalist -- Object reference not set to an instance of an object. .NET General
Dictionary<TKey,TValue> as a Dictionary key in C# 2.0 .NET General
Testing object arrays using Compare-Object and -contains PowerShell
Adding canonical aliases for Compare-Object, Measure-Object, New-Object PowerShell


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