#target indesign
main ();
function main ()
{
var mySel = app.activeDocument.selection[0]
var i = mySel.parentStory.contents.substring(0, mySel.index).split('\r').length
var par = mySel.parentStory.contents.substring(0, mySel.index).split('\r')
var word
var j
var first
var a, b, v, g, d, e, jo, zh, z, i, k, l, m, n, o, p, r, s, t, y, f, x, c, ch, sh, sch, tvz, u, mz, ee, jy, ja
for (var z = 0; z<=i;z++)
{
//word = par[z].words[номер слова].contents.
j = par[z].lines[0].words.length
for(var x=0;x<=j;x++)
{
word = par[z].words[x].contents.
first = word[x].characters[0].contents
switch (word[x])
{
case "а" && "А" :
a+= word[x] + " " + par[z] + 0xD ;
break ;
case "б" && "Б" :
b+= word[x] + " " + par[z] + 0xD ;
break ;
case "в" && "В" :
v+= word[x] + " " + par[z] + 0xD ;
break ;
case "г" && "Г" :
g+= word[x] + " " + par[z] + 0xD;
break;
case "д" && "Д" :
d+= word[x] + " " + par[z] + 0xD;
break;
case "е" && "Е" :
e+= word[x] + " " + par[z] + 0xD ;
break;
case "ё" && "Ё" :
jo+= word[x] + " " + par[z] + 0xD ;
break;
case "ж" && "Ж" :
zh+= word[x] + " " + par[z] + 0xD ;
break;
case "з" && "З" :
z+= word[x] + " " + par[z] + 0xD ;
break;
case "и" && "И" :
i+= word[x] + " " + par[z] + 0xD ;
break;
case "к" && "К" :
k+= word[x] + " " + par[z] + 0xD ;
break;
case "л" && "Л" :
l+= word[x] + " " + par[z] + 0xD ;
break;
case "м" && "М" :
m+= word[x] + " " + par[z] + 0xD ;
break;
case "н" && "Н" :
n+= word[x] + " " + par[z] + 0xD;
break;
case "о" && "О" :
o+= word[x] + " " + par[z] + 0xD;
break;
case "п" && "П" :
p+= word[x] + " " + par[z] + 0xD;
break;
case "р" && "Р" :
r+= word[x] + " " + par[z] + 0xD ;
break;
case "с" && "С" :
s+= word[x] + " " + par[z] + 0xD ;
break;
case "т" && "Т" :
t+= word[x] + " " + par[z] + 0xD ;
break;
case "у" && "У" :
y+= word[x] + " " + par[z] + 0xD ;
break;
case "ф" && "Ф" :
f+= word[x] + " " + par[z] + 0xD;
break;
case "х" && "Х" :
x+= word[x] + " " + par[z] + 0xD ;
break;
case "ц" && "Ц" :
c+= word[x] + " " + par[z] + 0xD ;
break;
case "ч" && "Ч" :
ch+= word[x] + " " + par[z] + 0xD ;
break;
case "ш" && "Ш" :
sh+= word[x] + " " + par[z] + 0xD;
break;
case "щ" && "Щ" :
sch+= word[x] + " " + par[z] + 0xD;
break;
case "ъ" && "Ъ" :
tvz+= word[x] + " " + par[z] + 0xD ;
break;
case "ы" && "Ы" :
u+= word[x] + " " + par[z] + 0xD ;
break;
case "ь" && "Ь" :
mz+= word[x] + " " + par[z] + 0xD ;
break;
case "э" && "Э" :
ee+= word[x] + " " + par[z] + 0xD ;
break;
case "ю" && "Ю" :
jy+= word[x] + " " + par[z] + 0xD ;
break;
case "я" && "Я" :
ja+= word[x] + " " + par[z] + 0xD ;
break;
}
}
}
app.mySelection[0].contents+=app.mySelection[0].contents + "Г: "+ g+ "Д: "+ d+ "Е: " + e+ "Ё: " +jo+ "Ж: " + zh+ "З: " + z+ "И: " + i+ "К: " + k+ "Л: " + l+ "М: " + m+ "Н: " + n+"О: " + o+ "П: " + p+ "Р: " + r+ "С: " + s+ "Т: " +
t+ "У: " + y+ "Ф: "+ f+ "Х: " + x+ "Ц: " + c+ "Ч: " + ch+ "Ш: " + sh+ "Щ: " + sch+ "Ъ: " +tvz+ "Ы: " + u + "Ь: " + mz+ "Э: "+ ee + "Ю: " +jy + "Я: " + ja
}