Copy link to clipboard
Copied
Hello,
Is it possible with a script to delete the files of an indesign book and to add all the files present in the same folder as the book.
Regards
Claire T
Copy link to clipboard
Copied
It is possible, but sounds kind of risky.
When you say delete, do you mean actually to delete the files off the harddrive, or just remove them from the book file?
Ariel
Copy link to clipboard
Copied
just remove the files from the book file
Claire TANGUY
Mail : ctanguy@galilee.fr
Skype : Formgal
Le 10/10/2018 à 12:56, TᴀW a écrit :
Script with an Indesign book
created by Tá´€W <https://forums.adobe.com/people/T%E1%B4%80W> in
/InDesign Scripting/ - View the full discussion
<https://forums.adobe.com/message/10669420#10669420>
Copy link to clipboard
Copied
Hi Formgali,
Check below link:
Re: How to remove all the contents of a book in scripting
Thanks,
Prabu G
Copy link to clipboard
Copied
This script removes the files from a book and adds .indd files to the book that are stored at the same location as the book file
book = app.activeBook;
//if more than one book is open ask user if the script is targeting the correct book
if (app.books.length > 1)
{
var x = confirm("Remove all Docs from the book\n" + book.name + "?");
}
//exit script if users clicks "no"
if (x == false) {exit();}
//remove existing bookContents
if (book.bookContents.length > 0)
{
book.automaticPagination = false;
book.bookContents.everyItem().remove();
}
//get indd files from the location where the book file is stored
folder = Folder(File(book.filePath).fullName);
bContents = folder.getFiles("*.indd");
//add files to the book
for (var i = 0; i < bContents.length; i++)
{
book.bookContents.add(bContents);
}
book.automaticPagination = true;
alert("Done");