![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| | #2 (permalink) |
| | 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 Specs![]() |
| | #3 (permalink) |
| | Re: object dictionary No one studies VBScript in college. Python - yes. VBScript - no. |
My System Specs![]() |
| | #4 (permalink) |
| | 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 Specs![]() |
| | #5 (permalink) |
| | 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 Specs![]() |
![]() |
| 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 | |||