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

Re: Re: Can you crrect my script?

$
0
0

Try now,

 

var book = app.activeBook,    _content = [],    overlap = [],    con = "",    con1 = "";
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-1].name + "\t" +book.bookContents[i-1].documentPageRange + "\r" + book.bookContents[i].name + "\t" +book.bookContents[i].documentPageRange);            }    }
if(overlap.length>0)
{        alert(overlap);        for(var i=0;i<overlap.length;i++)        {                con1 += overlap + "\r";            }    }


_content.reverse();

for(var i =0;i<_content.length;i++)
{        con+=_content[i] + "\r";    }
WriteToFile(con, con1);
function WriteToFile(content, overlap) {        file = new File("~/Desktop/Book contents and page number.txt");        file.encoding = "UTF-8";        file.open("w");        file.write("Contents\r\r");        file.write(content);        file.write("\r\rOverlap\r\r")        file.write(overlap);        file.close();        file.execute();    }

 

Regards,

Chinna


Viewing all articles
Browse latest Browse all 87055

Trending Articles



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