Plugins for Compare by Content

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
xjikka
Junior Member
Junior Member
Posts: 6
Joined: 2021-03-22, 19:46 UTC

Plugins for Compare by Content

Post by *xjikka »

Is there any way to write my own plugin for Compare by Content function, please? I'm comparing tons of sources and logs, and this feature could be very helpful for me.

As an example, simple solution can be some sort of OnPrepareLineForCompare(lpBuffer: LPWSTR; szBuffer:DWORD) function . Using this function I can simply remove / replace timestamps and other specific texts (but only for compare)

Original:
19881250 083324 515 00000 SERVER:TWExchange Create <> 20210322 220636 832 00000 SERVER:TWExchange Create
19881250 083324 505 00000 SERVER:TWSysData Create <> 20210322 220636 832 00000 SERVER:TWSvsData Create
19881250 083324 512 00001 SERVER:TWRebate Create <> 20210322 220636 833 00001 SERVER:TWRebate Create
...

using OnPrepareLineForCompare i can temporarily change content for compare so:
Prepared:
00000000 000000 000 00000 SERVER:TWExchange Create <> 00000000 000000 000 00000 SERVER:TWExchange Create
00000000 000000 000 00000 SERVER:TWSysData Create <> 00000000 000000 000 00000 SERVER:TWSvsData Create
00000000 000000 000 00000 SERVER:TWRebate Create <> 00000000 000000 000 00000 SERVER:TWRebate Create
...

and finally will be just the different char 'y' <> 'v' in the TWSysData marked red and just this line gray - as line with differences.

Thank You
User avatar
Gral
Power Member
Power Member
Posts: 1460
Joined: 2005-01-26, 15:12 UTC

Re: Plugins for Compare by Content

Post by *Gral »

Compare by content doesn't support plugins. You can configure external program instead. Popular options are WinMerge and Beyond Compare. Just add or change "CompareTool" key under [Configuration] sction in your main ini file. Of course you can also write your own utility.
xjikka
Junior Member
Junior Member
Posts: 6
Joined: 2021-03-22, 19:46 UTC

Re: Plugins for Compare by Content

Post by *xjikka »

I know Winmerge (I wrote my WinMerge filter for that), but TC Compare is way more friendly, nicer and better. Maybe I'll give a chance to Beyond Compare. Anyway, thank You.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Plugins for Compare by Content

Post by *ghisler(Author) »

If you just want to skip characters, you can already do this with an undocumented switch.
[Configuration]
CompareSkipFirstL=26
CompareSkipFirstR=26

This would skip the first 26 characters on both sides and compare only those behind. This isn't documented in the help because when you forget to remove it, it will be applied to all other files too. I recommend that you start TC with a separate ini file via /i= switch where this option is enabled so you don't accidentally use it for files without such a prefix.
Author of Total Commander
https://www.ghisler.com
xjikka
Junior Member
Junior Member
Posts: 6
Joined: 2021-03-22, 19:46 UTC

Re: Plugins for Compare by Content

Post by *xjikka »

OMG, I knew it. You're god. I created new ini as suggested and it works like a charm. Thank You very much!
xjikka
Junior Member
Junior Member
Posts: 6
Joined: 2021-03-22, 19:46 UTC

Re: Plugins for Compare by Content

Post by *xjikka »

For those, who'll find this useful too: I've set in second configuration other background color for compare, so it is immediately clear, that "alternate" compare method is used.
Post Reply