I am open-sourcing some of my snippets or smaller tools, I won't develop any further. Hope you find this usefull. It was tested on Mac OS X, and Windows XP.
Here is also a ZIP with the source-code, and some Icons I made: http://pb.quadworks.de/OSS/TinyCompare.zip
Code: Select all
;#########################
;# Compare The Files #
;# (p) 2010 quadWorks.de #
;#########################
OpenWindow (0,0,0,360,110,"Compare The Files", #PB_Window_WindowCentered | #PB_Window_ScreenCentered | #PB_Window_BorderLess)
ButtonGadget(0, 10, 10,340, 24, ".. please chose a file ..")
ButtonGadget(1, 10, 44,340, 24, ".. please chose a file ..")
ButtonGadget(2, 82, 78, 70, 24, "Compare")
TextGadget (3,160, 84,300, 20, "Most likely different")
ButtonGadget(4, 10, 78, 20, 24, "?", #PB_Text_Center)
ButtonGadget(5, 36, 78, 40, 24, "Quit", #PB_Text_Center)
LoadFont (0, "Arial", 11)
For i = 0 To 5 : SetGadgetFont(i,FontID(0)) : Next i
AddKeyboardShortcut(0, #PB_Shortcut_Command | #PB_Shortcut_Q, #PB_Event_CloseWindow)
Repeat
Event = WaitWindowEvent(100)
Select Event
Case #PB_Event_Gadget
Gadget = EventGadget()
Select Gadget
Case 0, 1
temp$ = OpenFileRequester("Chose file", "", "", 0)
If temp$ <> ""
SetGadgetText(Gadget, "1. " + GetFilePart(temp$) + " - " + StrF(FileSize(temp$) / 1024, 3) + "kb - " + FormatDate("%yyyy-%mm-%dd %hh:%ii:%ss", GetFileDate(Temp$, #PB_Date_Modified)))
If Gadget = 0
MD5a$ = MD5FileFingerprint(temp$)
fileA$ = temp$
Else
MD5b$ = MD5FileFingerprint(temp$)
fileB$ = temp$
EndIf
GadgetToolTip(Gadget, Temp$)
EndIf
Case 2
If MD5a$ = "" Or MD5b$ = ""
MessageRequester("Information", "Please select two files to compare.")
Else
If MD5a$ = MD5b$
SetGadgetText(3, "Most likely identical")
Else
SetGadgetText(3, "Most likely different")
EndIf
EndIf
Case 4 : MessageRequester("Information", "TinyCompare compares the MD5-fingerprints of two files. If the fingerprints are identical, the chance is high, that the two files are identical.")
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow Or Event = #PB_Event_Menu Or Gadget = 5