Write Para and character styles in txt file
Hi All,
I am very beginner in inDesign scripting and i just practicing the basic scripts.
i use the below code for collecting all the paragraph and character styling.
is this correct and secured way to collect all styles? can any one suggest me.
app.activeDocument.paragraphStyles.name;
app.activeDocument.characterStyles.name;
----
My Full script
var doc=app.activeDocument;
var docPath = doc.filePath.fsName;
var paraCount=doc.paragraphStyles.length;
var charcount=doc.characterStyles.length;
writeFile ();
function writeFile(){
var fh=File(docPath+"\\StyleList.txt");
fh.open("w");
if(fh!=-1){
//Paragraph style list Append
var strgP="";
for(var i=0; i < paraCount; i++){
var k=i+1;
var styleName = doc.paragraphStyles.name;
strgP += "Para style No " +k +": "+styleName + "\n";
}
//character style list append
var strgC="";
for(var i=0; i < charcount; i++){
var k=i+1;
var styleName = doc.characterStyles.name;
strgC += "Char style No " +k +": "+styleName + "\n";
}
fh.write(strgP +"\n\n"+ strgC);
fh.close();
}
else{
alert("Style file not created ...");
}
}
Thanks in Advance,
Arasu