var mySel = app.activeDocument.selection[0].contents.split("\r");
for (i = 0; i<mySel.length; i++){
if(mySel[i]!=""){
var myText = String(mySel[i]);
for (j = i+1;j<mySel.length; j++){
var myText2 = String(mySel[j]);
if (myText == myText2){mySel[j] = "";}
}
}
}
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = "\\r{2,}";
app.changeGrepPreferences.changeTo = "\r";
var myS = app.activeDocument.selection[0];
myS.contents = mySel.join("\r");
app.activeDocument.selection[0].changeGrep();