Diff/Merge Toolbar

Share completed buttons and toolbars.
User avatar
leo
GPSoftware
Posts: 36427
Joined: 07 Nov 2004, 01:30
OS: Windows 10 64-bit
Opus: Directory Opus 12
Location: London, UK
Contact:

Diff/Merge Toolbar

Postby leo » 29 May 2006, 07:35

See Also: Beyond Compare buttons
See Also: WinDiff buttons

This toolbar collects together various commands related to diffing and merging files and folders.

Image

I use this toolbar fairly often so I created a menu item that toggles it and also has a Ctrl-D hotkey for quick access. (To recreate the toggle button, copy the contents of the Code box into your clipboard, enter Customize mode in Opus, right-click an empty part of your toolbar and select Paste.)

Code: Select all

<?xml version="1.0"?>
<button display="both" hotkey="ctrl+D">
   <label>Diffing</label>
   <icon1>#dupepane</icon1>
   <function type="normal">
      <instruction>Toolbar NAME=Nudel-Side-DiffTools STATE=right TOGGLE LOCAL</instruction>
   </function>
</button>


The WinMerge icons come from WinMerge.exe itself, assuming you've installed it to the default location.

On to the toolbar itself:

The top button closes the toolbar.

I gave the buttons abbreviated names to keep the toolbar thin and because I find the short labels are easier to parse.

The "WM" buttons run WinMerge (very good, free diff/merge tool).

WM F: Diff the first selected file in the source folder with the first selected file in the destination folder.

(Aside: Adding the Select SOURCETODEST command to a button or hotkey can speed up selecting the same file in both sides.)

WM F SvS: Diff the first two selected files in the source folder.

WM D: Diff everything in the source folder against the destination folder.

The "WD" buttons do the same thing except they run WinDiff (somewhat archaic but still occasionally useful diff tool which comes with Visual Studio) instead of WinMerge.

The Bin F button checks for binary differences between the first selected file in the source folder and the first selected file in the destination folder. It uses the fc /b command that comes with Windows.

The Grep Dir button prompts you for a string and then searches for it within all files in and below the source folder. For each occurance a message is printed showing the filename, line number and actual line of text. It uses the findstr command that comes with Windows XP and above.

The MD5 buttons run a tool (attached) which generates MD5 checksums of everything in the current folder. (Note: Opus can show MD5 checksums without this tool, e.g. by running GetSizes NODESELECT MD5, but this tool can be useful if you want to save the results into a file and then diff it against the same output for a different folder.)

MD5 Files will print out MD5 checksums for all files.

MD5 to Log asks you for a log file name and writes the checksums into that file.

MD5 Dir will print a single checksum for the entire folder. (This is calculated by generating the usual MD5 output and then calculating the MD5 checksum of that. This calculation isn't standard but can provide a quick way to verify that two folders are identical.)

The XLS->VBA button runs some VBScript (attached) which automates Excel to extract all VBA code into textfiles in a sub-directory created with the same name as the selected XLS file. This provides a decent way to quickly diff XLS files for VBA changes.

Beware that the VBA output files often have extra directives in them which you should remove if you paste them back into Excel's Diabolical VBA Editor. I recommend you only use the files for diffing and not for editing or archival.

To run use the XLS->VBA script you must turn on Trust access to Visual Basic Project in Excel. In Office 2003 this option is under Tools -> Macro -> Security -> Trusted Publishers but, since Microsoft love to randomly re-arrange everything with each release of their major applications, it's probably somewhere completely different in every other version. :)

Two versions of the toolbar are attached, one made for Opus 8 and the other tweaked slightly for Opus 9.
Attachments
Nudel-DiffTools-Opus9.zip
(1000 Bytes) Downloaded 946 times
ExportVBAfromXLS.zip
(717 Bytes) Downloaded 734 times
Nudel-DiffTools.zip
(1.4 KiB) Downloaded 745 times
csmd5.zip
(30.25 KiB) Downloaded 949 times
Last edited by leo on 18 Aug 2009, 07:02, edited 6 times in total.

User avatar
leo
GPSoftware
Posts: 36427
Joined: 07 Nov 2004, 01:30
OS: Windows 10 64-bit
Opus: Directory Opus 12
Location: London, UK
Contact:

Postby leo » 26 Jul 2006, 10:18

If you want to diff two files with the same name in the source and destination directory you can save yourself the hassle of selecting the destination file by making a button like this:

Code: Select all

"C:\program files\WinMerge\WinMergeU.exe" "{filepath$}" "{destpath$}\{file$}"

You don't normally have to include quotes around the {} arguments but in this case they seem to prevent a quote appearing in the wrong place.

You can also automatically select all files in the destination with the same names as those selected in the source by running:

Code: Select all

Select SOURCETODEST

That command is also very useful for quickly checking which files two folders have in common without having to go to the synchronize tool in Opus.
Last edited by leo on 18 Aug 2009, 07:02, edited 1 time in total.

kenalcock
Registered Opus Pro User
Posts: 1030
Joined: 17 Nov 2004, 10:53
OS: Windows Vista 32-bit
Opus: Latest Beta
Location: Detroit, Michigan, USA

Postby kenalcock » 02 Dec 2006, 10:03

Attached is a two-button that makes a great addition to Nudel's DiffMerge toolbar above.

List Files S = D
  • RMB - List only files that exist in both Source and Destination, hiding everything else.
  • LMB - Unhide all files in both Source and Destination (undoing the first button).
Like many of Nudel's buttons, this one is also designed to work from a Dual Lister. If you left-click it with only a single lister window open, you will be prompted for a Destination Path, and then the command continues normally. If you happen to left-click the button with more than one single lister window open, the command will convert the window you clicked the button in to a dual lister and use the path from the other single lister window as the Destination folder.

This button does not make use of filters. It uses several select commands to "sift" through the folders and files in each file display to end up hiding all of those that do not exist in both file displays. Nothing is selected when the command completes and all items are sorted by the same field (Name - Ascending) in both file displays.

The script commands in the buttons require Windows 2000/XP/Vista.
Attachments
List Files S = D.dcf
(6.12 KiB) Downloaded 651 times
Kenneth R. Alcock
Read Help, Release Notes, & FAQs!
Discuss features/issues in forums but submit official requests here.

User avatar
leo
GPSoftware
Posts: 36427
Joined: 07 Nov 2004, 01:30
OS: Windows 10 64-bit
Opus: Directory Opus 12
Location: London, UK
Contact:

Postby leo » 11 May 2007, 11:15

Both versions of the toolbar has been updated to work around a problem which Reck discovered, when comparing the root of a drive with something else.
Last edited by leo on 18 Aug 2009, 07:02, edited 1 time in total.

User avatar
leo
GPSoftware
Posts: 36427
Joined: 07 Nov 2004, 01:30
OS: Windows 10 64-bit
Opus: Directory Opus 12
Location: London, UK
Contact:

Postby leo » 22 Aug 2008, 04:39

If you want a way to always compare Left File vs Right File (rather than Source File vs Dest File), then see this thread:

Devilder
Posts: 304
Joined: 19 May 2007, 06:59
OS: Windows 7 32-bit
Opus: Directory Opus 10

Postby Devilder » 24 Aug 2009, 13:57

Great tips.:)
I currently use this one for WinMerge

Code: Select all

C:\Program Files\WinMerge\WinMergeU.exe /r /e /x {filepath} {filepathdest}


Could it be possible, using DO's commands to first check if there's an equally named file in the destination tab, and only when it doesn't find one, compare left highlighted item against right highlighted item ?

User avatar
leo
GPSoftware
Posts: 36427
Joined: 07 Nov 2004, 01:30
OS: Windows 10 64-bit
Opus: Directory Opus 12
Location: London, UK
Contact:

Postby leo » 24 Aug 2009, 14:14

You can't do that using Opus's commands alone but you could do it by adding in a bit of VBScript (or similar) glue between Opus and WinMerge.

brassdfoo
Posts: 36
Joined: 03 Sep 2010, 19:35
OS: Windows 7 64-bit
Opus: Directory Opus 9

Re: Diff/Merge Toolbar

Postby brassdfoo » 06 Sep 2010, 22:31

For this one...

Code: Select all

<?xml version="1.0"?>
<button display="both" label_pos="right" separate="yes">
   <label>Bin F</label>
   <tip>Binary Compare -- Files -- Source vs Destination</tip>
   <icon1>#dupepane</icon1>
   <function type="batch">
      <instruction>fc /b {filepath$} {filepathdest$}</instruction>
      <instruction>pause</instruction>
      <instruction>@nodeselect</instruction>
   </function>
</button>


How can I make it compare two selected files in the source. Currently it compares between source and dest.

I tried

Code: Select all

fc /b {filepath$} {filepath$}
which just compares each of the files to itself.

User avatar
leo
GPSoftware
Posts: 36427
Joined: 07 Nov 2004, 01:30
OS: Windows 10 64-bit
Opus: Directory Opus 12
Location: London, UK
Contact:

Re: Diff/Merge Toolbar

Postby leo » 07 Sep 2010, 00:44

brassdfoo wrote:How can I make it compare two selected files in the source. Currently it compares between source and dest.

I tried

Code: Select all

fc /b {filepath$} {filepath$}
which just compares each of the files to itself.


It's a slight kludge (since it'll go wrong if three or more files are selected), but if you pass it the list of all selected files then it works with two files in the same place:

Code: Select all

fc /b {allfilepath$}

brassdfoo
Posts: 36
Joined: 03 Sep 2010, 19:35
OS: Windows 7 64-bit
Opus: Directory Opus 9

Re: Diff/Merge Toolbar

Postby brassdfoo » 07 Sep 2010, 22:47

Thanks heaps leo, that works great. Tested on more then 2 selected files and it still seemed to work comparing just the first 2. Thanks a lot.


Return to “Buttons & Toolbars”