![]() This is the FileMD5.ahk script that needs to be placed in the "Lib" subdirectory (either of the script's directory or of AutoHotkey. MsgBox, 48, Files are DIFFERENT, %Name1%`n%Name2% #Autohotkey bundle files for compile windows#ago Compression when compiling the script, look for MPRESS in the compiler windows and uncheck it. ago It's a false positive, just add it to the exceptions for your anti-virus. MsgBox, 64, Files are EQUAL, %Name1%`n%Name2% I'm compiling with Scite4Autohotkey, simply right click -> Compile -> and then i pass the. MsgBox, Error opening %Name2%`nError: %A_LastError%īytesToRead := Ceil(Size1/FractionOfFileSizeToReadEachTime)įile1.Seek(Floor(Size1/Reads*(A_Index-1)))įile2.Seek(Floor(Size1/Reads*(A_Index-1))) MsgBox, Error opening %Name1%`nError: %A_LastError% This file needs to be placed either in the Lib subdirectory of the current script, or the Lib subdirectory of AutoHotkey.exe.įractionOfFileSizeToReadEachTime = 1000000 The script uses the FileMD5() function that needs to be placed into a file called FileMD5.ahk. If at any point the script encounters any difference in the between the data read from two files, it immediately exits and displays a message that the files are different.įinally, the script calculates the MD5 hashes of both files and compares them. In summary, with the options set as above, the script compares the sizes of the files and if equal it reads ten bytes at position 0 and compares them to the bytes read from the same position from the other file, ten bytes at position 100'000 and compares again, ten bytes at position 200'000 etc., up until ten bytes at position 900'000 and compares them again. If FractionOfFileSizeToReadEachTime = 100000, the amount of bytes that will be read at each position is calculated as the size of the input file divided by 100'000, so in our case it would be 10 bytes each time. If Reads = 10, the file contents will be read at 10 incrementing equally distanced positions, so in our case it will be read at byte 0, byte 100'000, byte 200'000, etc., up to byte 900'000. Let's say a file has the size of 1'000'000 bytes. The positions and the the amount of data compared are determined by two options (set inside the script as variables) - Reads and FractionOfFileSizeToReadEachTime. If they are equal, it checks the data inside the files at several positions. The script first compares the sizes of the two files to check if they are different. Usage: Add to the button bar, menu, shortcut key or alias with the following parameters: This script does not show the differences. This is a simple script to compare if two files are equal or not. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |