Page 1 of 1

Create prediffer plugin using sct (scriptlet)

PostPosted: Tue May 19, 2015 3:41 pm
by gcalis
Hello all,
I'm trying to create a prediffer plugin using a scriptlet file, to avoid the 'hassle' of VB or CPP, but Winmerge is not appreciating ;) my efforts so far.
Is it possible at all to create a prediffer plugin in this way? This is what I've come up with:
Code: Select all
<scriptlet>

<implements type="Automation" id="dispatcher">
   <property name="PluginEvent">
             <get/>
        </property>
   <property name="PluginDescription">
             <get/>
        </property>
   <property name="PluginFileFilters">
             <get/>
        </property>
   <property name="PluginIsAutomatic">
             <get/>
        </property>
</implements>

<script language="VBS">

Option Explicit

Function get_PluginEvent()
         get_PluginEvent = "BUFFER_PREDIFF"
End Function

Function get_PluginDescription()
         get_PluginDescription = "Ignore hyphen characters in lines."
End Function

Function PluginFileFilters()
         get_PluginDescription = "\.txt$"
End Function

Function PluginIsAutomatic()
         get_PluginDescription = "True"
End Function

Function PrediffBufferW(ByRef text, ByRef size, ByRef bChanged )
 
  bChanged = False
 
  text = Replace(text, "-", "")
 
  PrediffBufferW = True
 
End Function

</script>
</scriptlet>



As you can see I'd like to create a plugin to ignore all hyphen characters in the documents I'm comparing. If there is another way to do this (without using other tools to remove the hyphens first), I'm open for suggestions :)

Re: Create prediffer plugin using sct (scriptlet)

PostPosted: Wed May 20, 2015 6:38 am
by jtuc
Try WinMerge 2011 with a line filter as follows:
Code: Select all
regexp:/(-)/g
Line filters in WinMerge 2.x are too limited to support your use case, and scriptlets don't work for anything but editor plugins.

Re: Create prediffer plugin using sct (scriptlet)

PostPosted: Fri May 22, 2015 7:14 am
by gcalis
Awesome, that works like a charm, thank you very much!

I've been using Winmerge for years but until now had not noticed Winmerge 2011 and its more advanced functionality. I've switched to Winmerge 2011 now :D