Hey Allen,
I am trying to compare PDF files as a whole with an already saved PDF file on my local drive. So how can I use MSAA applications in testing the whole files.
Also I am using the usual Files.Compare method .I also tried to include the hash value. The files are the same ,its just that everytime the new file is published,the timestamps change and the comparison fails as the hash value changes evertime when new file is published.
The other way I tried to use my code for comparing the files where it ignores the modification date,creation date and ID when I store one file in the Stores|Files collection but somehow the PDF files get stored with some weird characters.So that way that code also is not working.
function CompareFiles(fileName1, fileName2)
CompareFiles(fileName1, fileName2)
{
var fso, file1, file2, regEx;
var fileText1, fileText2, newText1, newText2;
var ForReading = 1;
// Creates the FileSystemObject object
fso = new ActiveXObject("Scripting.FileSystemObject");
// Reads the first text file
file1 = fso.OpenTextFile(fileName1, ForReading);
fileText1 = file1.ReadAll();
file1.Close();
// Reads the second text file
file2 = fso.OpenTextFile(fileName2, ForReading);
fileText2 = file2.ReadAll();
file2.Close();
//regEx = /\d{1,2}.\d{1,2}.\d{2,4}\s\d{1,2}:\d{1,2}\s\w{2}/gim;
regEx1 = /\/ID \[<.*>\]/;
regEx2 = /\/ModDate.*/;
regEx3 = /\/CreationDate.*/;
// Replaces the text matching the specified date/time format with <ignore>
newText1 = fileText1.replace(regEx1, "<ignore>");
newText2 = fileText2.replace(regEx1, "<ignore>");
newText1 = newText1.replace(regEx2, "<ignore>");
newText2 = newText2.replace(regEx2, "<ignore>");
newText1 = newText1.replace(regEx3, "<ignore>");
newText2 = newText2.replace(regEx3, "<ignore>");
// Compares the text
return (newText1 == newText2);
}
Thanks,
Sumedha