Create prediffer plugin using sct (scriptlet)

Main development forum.

Create prediffer plugin using sct (scriptlet)

Postby gcalis » Tue May 19, 2015 3:41 pm

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 :)
gcalis
 
Posts: 2
Joined: Tue May 19, 2015 3:35 pm

Re: Create prediffer plugin using sct (scriptlet)

Postby jtuc » Wed May 20, 2015 6:38 am

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.
jtuc
Developer
 
Posts: 182
Joined: Sat Dec 20, 2008 11:05 am

Re: Create prediffer plugin using sct (scriptlet)

Postby gcalis » Fri May 22, 2015 7:14 am

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
gcalis
 
Posts: 2
Joined: Tue May 19, 2015 3:35 pm


Return to Developers

Who is online

Users browsing this forum: No registered users and 1 guest

cron