Solved

Need vbscript to compare text files

Posted on 2004-09-14
4
1,152 Views
Last Modified: 2012-06-27
I need a vbscript to compare a text file with a list of serial numbers as follows:

Textfile1
12345
23456
23457

and

Textfile2
12345
23456
etc...

If they are equal then exit
if they are Not equal then i will send and e-mail ( i have the e-mail script)

One list will be the constant, and the other will warn of changes.
0
Comment
Question by:chris_v
4 Comments
 
LVL 5

Accepted Solution

by:
tzxie2000 earned 500 total points
Comment Utility
how about a compare textfile function below
public function comparetextfile(byval srcfilename as string,byval desfilename as string) as bool
{
      Try
            ' Create an instance of StreamReader to read from a file.
            Dim srcsr As StreamReader = New StreamReader(srcfilename)
            Dim dessr As StreamReader = New StreamReader(desfilename)
            Dim linesrc As String,linedes as string
            Do
                linesrc = sr.ReadLine()
                linedes=sr.readline()
                if(linesrc!=linedes) Exit do
            Loop Until linesrc Is Nothing or linedes is nothing
            srcsr.close()
            dessr.Close()
            if(linesrc is nothing and linedes is nothing) return true;
            return false;
        Catch E As Exception
            ' Let the user know what went wrong.
            Console.WriteLine("The file could not be read:")
            Console.WriteLine(E.Message)
        End Try
        return false
}
0
 
LVL 2

Author Comment

by:chris_v
Comment Utility
Found another solution..  thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
trying to start a c# program 5 81
sameEnds challenge 25 70
countClumps  challenge 10 89
matchUp  challenge 9 71
There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now