Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 85594

Re: Can you crrect my script?

$
0
0

Try this,

 

var book = app.activeBook,     _content = [],     overlap = []; 
for(var i =book.bookContents.length-1;i>=0;i--) 
{         _content.push(book.bookContents[i].name + "\t" + (book.bookContents[i].documentPageRange.replace(/-[^-]+$/g,"")) + "\r");         if(book.bookContents[i].documentPageRange == book.bookContents[i-1].documentPageRange)         {                 overlap.push(book.bookContents[i].name + "\t" +book.bookContents[i].documentPageRange + "\r" + book.bookContents[i-1].name + "\t" +book.bookContents[i-1].documentPageRange);             }     }
if(overlap.length >0)
{        alert(overlap.reverse())    }
_content.reverse();
var con = "";
for(var i =0;i<_content.length;i++)
{        con+=_content[i] + "\r";    }
WriteToFile(con);
function WriteToFile(text) {        file = new File("~/Desktop/Book contents and page number.txt");        file.encoding = "UTF-8";        file.open("w");        file.write(text);        file.close();        file.execute();    }

 

Regards,

Chinna


Viewing all articles
Browse latest Browse all 85594

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>