This script becomes deprecated from the improved "CleanTrack.cal" script developed by sping.
I noticed that the UNDUPE.CAL script has a lot of logic faults, where it does not correctly eliminate duplicate notes.
To confirm this, download
this MIDI file, open it with Sonar, activate the Event List (Alt + 8), select the entire track and run UNDUPE.CAL (Ctrl + F1).
You will see that some duplicate notes still remain.
In this way, I created a revised version.
You can download the script at Github.