Sign in to follow this  
Followers 0
Clay

File Compare

7 posts in this topic

Hi all, I am in need of some assistance.

I am working on a script and part of my script requires the ability to:

1). run an installation

2).when a License Agreement Dialog becomes available

3).extract the License Agreement and compare it to one that I have on my local system to make sure that the License Agreement is up-to-date - meaning that it matches the Agreement that I have on my local system.

I can obtain the Agreement while running the install, however I don't know how or if it is possible to compare 2 files to verify that they match. I can noyt use String compare and I can not compare them by line simply because I am scared that although the text might be the same the format might be different when I extract the Agreement from the License Agreement Dialog. Also because I am taking the Agreement from a window I can not use a binary compare.

Is there anyway to compare 2 complete files? Any Ideas?

Share this post


Link to post
Share on other sites



Couldn't you read both files to $read1 and $read2 and then just do

if $read1=$read2 then 
consolewrite("they match")
else
consolewrite("they don't match")
endif

.........


[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites

Func _CompFiles($File1, $File2)
   If FileRead($File1) = FileRead($File2) Then Return 1
   Return 0
EndFunc


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Func _CompFiles($File1, $File2)
   If FileRead($File1) = FileRead($File2) Then Return 1
   Return 0
EndFunc
Would that not be:

Func _CompFiles($File1, $File2)
   If FileRead($File1) == FileRead($File2) Then Return 1
   Return 0
EndFunc

== instead of =

Would make it case sensitive. :)

Share this post


Link to post
Share on other sites

Would that not be:

Func _CompFiles($File1, $File2)
   If FileRead($File1) == FileRead($File2) Then Return 1
   Return 0
EndFunc

== instead of =

Would make it case sensitive. :)

Depends if he wants it case sensitive or not i would guess not if its just a license compare you just need to compare the words...

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Share this post


Link to post
Share on other sites

I think stringcompare is the better/faster method here for more detail style. The -1/0/1 is usually all I need to know to carry out whatever functions I want.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0