"Smart" front end for Beyond Compare

Very nice indeed!!

:thumbsup:

Thanks a lot.

I wonder why you called the command "$BC" and not just "BC"/"BeyondCompare" or something.

On the second thought, introducing a "$"-prefix for all script commands might be a good general idea, that way you could easily recognize "externally" introduced functionality.

Just tried your smart front end, and I need to say, it is smart indeed, working flawlessly here. o) Now I wonder if I need to purchase BC, already owning a "CompareIt" license, mhh. o)

In the past I have looked at other tools as well. From my point of view Beyond Compare by far is the most userfriendly.
Meaning : it is very flexible and requires a minimum of 'clicks' and is well Explorer-integrated, supports drag and drop, etc.
Beyond Compare is really a wonderful tool and you won't be sorry.

They have a very active support forum, with developers attending.

Recently they introduced version 4 (beta version xyz, I haven't been able to let it crash though)
Have a look at youtube.com/watch?v=eGAyWvstKCI

e.g. click on a subfolder in the foldertree (left)
then ctrl-click on any other subfolder in the foldertree, you wish to compare
in my case both subfolders are listed side by side (right window panel)
I have cofigured this 'Smart front' as a button on the toolbar,
click on the Beyond Compare-button...
(with thanks to aussieboykie)

Just my 2cents :wink:

=

I started making some small changes to this script today, and ended up adding/changing so much that it's almost a new/separate script in the end.

I'm not sure what to do with this new version, since some of the changes I wanted may not be wanted by everyone, while other changes are definite improvements and would make sense to merge back into the "official" version. I'll upload it here and let AussieBoykie decide which changes, if any, he wants to keep.

I've used "2.2 LDx" as the version string, since it's based on 2.2 from the root post.

2.2 LD3: Beyond Compare.osp (14.4 KB)

History of my edits:

  • 16 November 2023 ("2.2 LD3"):
    • Fixed problem with files that have plugin-archive extensions but aren't really archives.
  • 24 August 2020 ("2.2 LD2"):
    • Small change to add a NEWWINDOW argument (passes /solo switch to make BComp.exe open a new window).
    • Also updated the default/fallback path for Beyond Compare 4.
  • 19 November 2019:
    • Fixed an issue with very high DPIs and/or the large icon size.
  • 12th October 2017:
    • Updated .osp to include high DPI icons.

Here's a summary of what I changed from the original 2.2 in the root post:

  • Requires Directory Opus 11.4 or above.

  • Ensures left and right in Beyond Compare match the left and right in Opus (even if the right is the source).

  • Allows comparing folders with archives (since BC supports this), with a new config option to disable it. (Disabling it also requires you to make changes to BC's own config, to stop it treating archives as folders.)

  • If one item is selected in the source and nothing (or the wrong kind of thing, or too many things) in the dest, it now ignores the destination selection(s) and compares the selected source item on both sides.

    For example, if C:\ and D:\ are the source/dest folders, and File.txt is selected in the source, C:\File.txt and D:\File.txt are compared.

    "Wrong kind of thing" means a file on one side and a folder on the other. (Where archives are considered folders, if that option is enabled.)

  • Fix for when Desktop is compared to another folder. (Compares /desktopdir instead of /desktop virtual folder.)

  • Gets default Beyond Compare exe path from the registry if the script config has no path or has a path that doesn't exist.

    Failing that, it uses the standard Beyond Compare install path, under the 32-bit Program Files folder.

    Default config path is now blank, and should only be set if the above methods need to be overridden.

  • Shows an error message if Beyond Compare exe isn't found.

  • If the path found/configured is for BCompare.exe, it will swap it for BComp.exe (if it exists).

    Using BComp.exe is preferable as it will open new tabs in an existing BC instance. (Could make this an option.)

  • Won't do anything if nothing is to be compared.

    (If people want the button to be able to run BC on its own, it could be a config option. For me it'd just mean having to close BC if I clicked in error, so I added the check.)

    (You can still click the button with nothing selected to launch BC against the source and destination folders, so it's still easy to quickly launch BC.)

  • Won't do anything if either thing to be compared does not exist. (This is mainly for the new case where you can select a file on one side to compare the same thing on both sides.)

  • New small icon matching the 22x22 size of Opus's other small toolbar icons, with 1 pixel padding.

    (Made by resizing the 32x32 icon to 20x20, then adding 1 pixel of padding on all sides, to match the standard icons.)

    (2017: Now also includes high DPI icons.)

  • Removed debug stuff I didn't need and tidied up some of the code, although in the end it's almost a re-write after adding all of the above.

  • Changed command name from $BC to BeyondCompare. (Change it back if you want; I just didn't like it :slight_smile:.) Also changed the description and label to work better with where they are displayed.

2 Likes

Sounds good, thank you! o)

Comparing both versions.. there's really not much left from aussie's release. o)


You have made some interesting modifications and improvements Leo. I had already planned to clean up the "path to BC" determination, recognising that most users will run the executable from the default installation location. Your code for interrogating the registry is not something I have ever come across before and looks to be a very useful snippet to keep. I also like your archive handling and use of BComp, if available, to open in tabs.

My logic for determining what to compare under various circumstances is driven by the way I typically use BC. Your logic is different but I have no doubt many others will prefer "Leo's way". I'll add a link at the top of the thread pointing to your code and description. I certainly plan to incorporate several of your improvements into "my" version and will likely post an update once done and tested.

Regards (and thanks), AB

Many thanks Leo !
:thumbsup:

=

@leo
Sorry, but one last thing..

Maybe you care to add 1 or 2 lines as to how to get this working as a button in the toolbar?
I had the previous one working (with $BC).
Deleted the button, wanted to delete the script (preferences), the last thing was not possible.
try reset, it now refers to a non-existing BC folder, again, I can't delete it,

Anyway, how to get this new .osp working under a toolbar button?

=

Look in the Customize dialog, Commands tab, under Script Commands. Just drag the command to your toolbar.

Or edit the button which runs $BC to run BeyondCompare instead.

You don't need to delete the script, the new one sbould overwrite it.

v2.3 AB (2014/05/02) is attached. Code now incorporates Leo's v2.2 LD improvements plus..

  • More flexible and rigorous handling of user supplied path/filespec (See note 1)
  • AB's added command is named $BC (vs Leo's BeyondCompare)
  • Uses AB's preferred logic for comparing selected files/folders.
    1. Compare files if exactly two files are selected in source.
    2. Compare folders if exactly two folders are selected in source.
    3. Compare relevant items if exactly one file or one folder is selected in each side of a DUAL.
    4. If none of the above and DUAL then compare sides (folders).
    5. If none of the above just open Beyond Compare main menu.

Note 1: If a path is supplied via the script configuration dialog it can be specified as a path - e.g. C:\Utilities\BC or a full filespec - e.g. C:\Utilities\BC\BCompare.exe and unintended leading/trailing spaces are ignored.

Regards, AB

Beyond Compare v2.3 AB.osp (8.56 KB)

Hi guys,

nice idea. But how do it get it working?
Neither version 2.2 from AB, nor the newest from Leo or AB are working.

Version 2.2:

  1. I copied the osp to Script Addins folder, went to configure it and changed the installation path to "C:\Program Files (x86)\Beyond Compare 3\BComp.exe" (with or without the quotes, doesn't matter)
  2. The command "$BC" showed up in the Command List and I added it a button
  3. Selected two files, hit the button and noting happens

New Version 2.3 post Leo

  1. No config possibility at all --> buttons are greyed out
  2. Nothing happens, if I click the button

Leos' version:

  1. No config possibility at all --> buttons are greyed out
  2. Command "Beyond Compare" does not even show up

Ony hints?

Regards
xbprm

Very strange. At the very least you should be able to configure. This is what I see when I navigate to and open the relevant config in scripts...


If you look in the "Other" log - Set UTILITY=OtherLog,On - do you see any error messages?

Regards, AB

This is what I see

v2.2

v2.2 LD

v2.3 post Leo

Nope.

Sorry, no I got one error. (Don't know why not the first time)

Beyond Compare 2.3 post Leo.vbs: Error at line 50, position 2
Beyond Compare 2.3 post Leo.vbs: Das Objekt unterstützt diese Eigenschaft oder Methode nicht.: 'initData.min_version' (0x800a01b6)

--> Tranlation: The object does not support member or method

Looks like you're DO version is just not uptodate (that missing property was introduced lately).

I had the same thought as soon as I saw the error. I am sitting behind a company firewall so I got no update messages. Will update manually and report back.

Ok, Dopus updated to 11.4.

Now, I can configure it properly but still nothing happens. I only get the following error

Error at line 1, position 1
$BC
^
Ungültiges Zeichen (0x800a0408) -> Translation: Invalid token
Parse error - script aborted

Button just runs "$BC"

Sounds like you created a "script-button".
You may try a "standard" button: "Standard Function (Opus or external)".

Heureka! Now, it works. Yes, it was a script button (legacy from the first implementation from AB).

Thanks all for the reply and the patience.

I was pretty happy (and surprised) when I tried to compare a file with an older version of that file that was stored in a zip and it worked. thanks AB :slight_smile: