Script to go to first page
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.
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.
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){}
}
}
}
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();
}
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.