Copy link to clipboard
Copied
Hello,
Can someone please help with a script that I can apply to a book which will leave each document on the 1st page?
Thanks in advance.
Just throw the select() function before the end of your outer for loop, like so:
var myBook = app.activeBook;
for(var n=0; n < myBook.bookContents.length; n++)
{
app.open(File(myBook.bookContents[n].fullName.toString()));
for (var i = 0; i < app.activeDocument.allPageItems.length; i++)
{
var myPageItem = document.allPageItems[i];
if(myPageItem.getElements()[0].constructor.name == "TextFrame")
{
myPageItem.select();
try{
app.scriptMenuActions.itemByID(71442).invoke();
}catch(e){}
}
}
app.activeDocument.pages[0
...Copy link to clipboard
Copied
Can you give more info?
First page of the book or each document in the book?
What is your output--PDF?
Are you looking a button or something that the user can click to go to the first page?
Do you just want the PDF just to open on a particular page?
Copy link to clipboard
Copied
It's completely unrelated to the PDF - purely for convenience with the book docs.
I currently use a script which updates all TOCs in the book documents - it's great but it leaves each document on the last master page.
So I want to either add to the end of the TOC script or use a separate one that will bring each document in the book to the first "real" page.
Thanks.
Copy link to clipboard
Copied
So if I understand correctly, the script leaves you with the last master page active? Use LayoutWindow or select() to get back to the first page, depending on your needs:
Copy link to clipboard
Copied
Thanks - that works for the active doc.
Please show me how to insert your script into the following so that it applies to all docs in the book:
var myBook = app.activeBook;
for(var n=0; n < myBook.bookContents.length; n++)
{
app.open(File(myBook.bookContents[n].fullName.toString()));
for (var i = 0; i < app.activeDocument.allPageItems.length; i++)
{
var myPageItem = document.allPageItems[i];
if(myPageItem.getElements()[0].constructor.name == "TextFrame")
{
myPageItem.select();
try{
app.scriptMenuActions.itemByID(71442).invoke();
}catch(e){}
}
}
}
Copy link to clipboard
Copied
Just throw the select() function before the end of your outer for loop, like so:
var myBook = app.activeBook;
for(var n=0; n < myBook.bookContents.length; n++)
{
app.open(File(myBook.bookContents[n].fullName.toString()));
for (var i = 0; i < app.activeDocument.allPageItems.length; i++)
{
var myPageItem = document.allPageItems[i];
if(myPageItem.getElements()[0].constructor.name == "TextFrame")
{
myPageItem.select();
try{
app.scriptMenuActions.itemByID(71442).invoke();
}catch(e){}
}
}
app.activeDocument.pages[0].select();
}
Copy link to clipboard
Copied
Thanks so much - it works perfectly!
Copy link to clipboard
Copied
Hi. I am trying to figure out how to do this exact thing. In a pdf document, I'd like to add to each page a button or link so users can go to the first page in the document.
Are you looking a button or something that the user can click to go to the first page?
Copy link to clipboard
Copied
Hi. I am trying to figure out how to do this exact thing. In a pdf document, I'd like to add to each page a button or link so users can go to the first page in the document.
Are you looking a button or something that the user can click to go to the first page?
By @virginia_9272
You need to start a new thread as the one you've replied to - is about completely different and unrelated thing.