GP SoftwareTwitter
Opus FAQsManualCommandsObjects

External Compare and Merge Tools 2.0

scripting
commands
jscript

#1

Integrating external (third party) file and folder compare tools. Select the files you want to compare and click the menu button for the compare tool of your choice.

Compare logic supported

  • Two, three and n way file/folder comparison on selected items in the source Lister
  • Two way file/folder comparison for single selected item in each Lister
  • Two way file/folder comparison for single selected item in first lister, to file with same name in second Lister
  • Two way folder comparison of source and destination when no items are selected

The script needs to know where the compare tool exe is stored. First run for specific tool the script will ask you to find the exe. This will be stored in a global variable for next use. Hold down shift when clicking the button to force re-request for exe path.

Tools supported

Application Two way file Three way file Folder compare Tested
Araxis compare & merge compare yes yes
BeyondCompare compare & merge yes
BeyondCompare3 compare & merge compare yes yes
BeyondCompare4 compare & merge compare yes yes
Devart Code compare compare & merge compare yes yes
Diffuse compare compare (n-way) yes
CompareIt compare
DiffDoc compare
EllieComputing compare & merge
Guiffy compare & merge
KDiff3 compare & merge compare yes yes
SourceGearDiff compare compare
UltraCompare compare & merge compare yes yes
TortoiseMerge compare & merge compare & merge
VisualSlickEdit compare & merge
VisualSourceSafe compare & merge
VisualStudio compare & merge yes
WinDiff compare yes
WinMerge compare & merge yes yes

Sample menu with all pre configured tools. You would prob only keep a couple of the buttons.

How to use
Assuming that you want to use one of the already configured tools (see image above).

  • Download the latest version of ExternalCompare.osp, and copy it to the dopus script folder /dopusdata\Script AddIns
  • Download the ExternalCompare.dcf and add it to your tool bar.
  • Select the files to compare and click the button relating the to tool you would like to use.
  • You will be asked to locate the compare tools executable.

Configuring a new tool

Configuration of a new tool details

The building of the command line and selecting identifying the files and folder to pass in to the tool is based on Leo's version of the "smart beyond compare script". To enable the use of different compare tools I have stored command line configuration for the different tools in to the script. I used the same command line pattern as seen here link. By using this pattern I have been able to borrow the configuration as described in that link. Have tested a couple of the tools, but I have not tested most of them, I'm sure a few tweaks will need to be made.

Command Argument codes

  • %1 = Original file (in diff, the pre-changes file, in merge, the "server" or "theirs" file, the file that is the base file after "their" changes were applied)
  • %2 = Modified file (in diff, the post-changes file, in merge the "yours" file - the base file with "your" changes applied)
  • %3 = Base file (in the 3-way merge operation, the file which both "theirs" and "yours" are derived from - the common ancestor. This doesn't mean it's the version the changes were based from, since this may be a cherry-pick merge)
  • %4 = Merged file (The output file for the merge operation - the filename that the merge tool should write to)
  • %5 = Not used - Could be additional command-line options.
  • %6 = Original file label (The label for the %1 file)
  • %7 = Modified file label (The label for the %2 file)
  • %8 = Base file label (The label for the %3 file)
  • %9 = Merged file label (The label for the %4 file)
  • %nfile = for n number of files. Pattern = "%1 %2 ..."
    Please share any new tools you setup or feedback.

Thanks and credit
In this post "Smart" front end for Beyond Compare AB and Leo wrote some scripts for comparing files and folder in Beyond compare. I have built on this piece of work to use the same file/folder selection logic but to allow other comparison tools to be used.

Thanks to AB and Leo for their work on the beyond compare script, and to James Manning for maintain the list of command line arguments.

Downloads

ExternalCompare 2.0
ExternalCompare.osp (103.2 KB)
Menu buttons with icons, as seen in image above:
ExternalCompare.dcf (15.9 KB)

Old Installs

ExternalCompare1.8:
ExternalCompare.osp (102 KB)


Dynamic icon for three button
Dynamic icon for three button
Toolbar : label text alignment
Need for {filepathleft} and {filepathright}
Multiline or JSON ScriptConfig type
Select same file
Shell extension behavior difference
"Smart" front end for Beyond Compare
Global Variable Management Dialog
Cpu locking up with synchronize
"Smart" front end for Beyond Compare
[Scripting] Set/change toolbar button image from a script
Using Opus to identify differences in similar directory trees
How to get scrolling in both panels of comparison results simultaneously
#2

Thanks wow for putting this together! I banned my old compare buttons and put yours in place - I don't look back! o))
Nice set of icons as well!


#3

I have updated both the script and menu.

The when pressing the mouse button (left or right) down the menu will now show a gray icon if you don't have that tools path configured.

Further details are in the first post.



#4

Thanks for your work on this enhancement, it's a very nice addition to DOpus! I've followed the download and setup directions in the "How to use" section, though when using the button I am not prompted for the path to my comparison tool, Beyond Compare 3. When selecting the Beyond Compare 3 option, ExternalCompare returns a dialog stating, "Windows cannot find 'ExternalCompare' Make sure you typed the name correctly, and then try again."

Admittedly, I'm new to using .osp and .dcf files, so perhaps I'm missing a detail or two. Is there anything you can think of which I have overlooked?


#5

hi haylo75, That error means that the script is not loaded. Can you open the DOpus Preferences go to the scripts section and confirm that the External compare script is there and is enabled.


#6

wowbagger, thanks for the fast reply. ExternalCompare was indeed disabled in Preferences. I have it working now, thanks again for a great addition to DOpus.


#7

Updated the version 1.7.
The folder compare logic has been improved to support tools like UltraCompare, which supports 3way folder compare .


#8

Updated the version 1.8.
Added support for diffuse. Diffuse is unique in that it supports n-way (up to 16) text file comparison.


#9

Updated the last days by using ScriptWizard, which worked good, thx for supporting it! o)

Today though, I wanted to compare a file from source to dest and the script errors at 364, maybe you like to check what's wrong? Looks like "index out of bounds" for cdf.desttab.selected(1) and only 1 file selected in dest.


#10

Hi tbone, sorry about that.
I have been working on a new version that will improve the merge functionality. It's a bit of a rewrite and thus will prob fix that issue.

I think the new version is working but I have not tested it properly.
Give it a try, let me know how it goes.
ExternalCompare.osp (103 KB)


#11

Ok, thank you! o)
I guess I'll stick to v1.4 from the update-archive until the rewrite passed your smoke tests. o)


#12

Please find attached 1.8.3 beta. I would appreciate if you could try it and give feedback

I have been trying to improve the logic used to determine the the type of comparison, Merge functionality, and n-way support. I'm not yet sure if I like how it works.

There are two modes the script can work in, merge and compare.
When doing a merge the the selected source files are compared and the the selected destination is the target of the merge.
When doing a compare the selected files in the source and destination are all compared together. This better supports n-way comparing.

Where this differs from the past is, if you have multiple files selected in the source and the destination then all will be compared. In the past up to three in the source would be compare and the destination would be ignored. Unless you had one selected in the source and one in the destination.
ExternalCompare.osp (103 KB)


#13

Hi,

at first thanks for the nice command selection.
I think, there's a bug in line 364: Although the condition before tests, if there's only one file in source and dest tab selected, it then tries to assign the second dest file (desttab.selected(1)) to path[1]. Which obviously fails. I think, it needs to be desttab.selected(0) there.

Cheers,
Andreas


#14

updated to version 2.0. Some bug fixes and code clean up. Mostly the same functionality.

@ablock42, you were correct that was a bug. Its fixed in version 2.0.


Support for dynamic column settings
#15

I've installed the menu and the script v2.0, but the buttons don't seem to be grayed out as in your screenshot. Did I miss something?


#16

The grey colour only displays when you have your mouse down.

This is because each button is a Multiple Function Button. Its the sub buttons (for left right or middle mouse buttons) that we are able to control in this way. If you only use compare (left button) and not merge (right button) you could copy out all of the left buttons and they should all be grey.

Like this
ExternalCompare-CompareOnly.dcf (7.9 KB)


#17

Ah that makes a lot of sense. I mostly compare, so I'll try that new button, thank you!


#18

Is the entry for WinMerge in the root post correct w.r.t. folder comparison? I think WinMerge can do it (and http://winmerge.org/ seems to confirm this), but the table doesn't include that. Maybe there is an issue that prevents the script from working with that part of WinMerge, or maybe it was just overlooked?


#19

This has been corrected. Was just a mistake in the post, the script appears to be configured correctly.

Thanks for raising.


#20

hello,

i noticed that someone picked up the development of winmerge.
site : https://github.com/sdottaka/winmerge-v2
It has increased functionality such as 3-way merge, image compare/merge.

will there be a update to support this?

when trying to use the merge function, it shows up this as well (merge function from winmerge)
image