Copy link to clipboard
Copied
Hi all! 🙂
I have found this script written by @Kasyan Servetsky on an old post, and it's exactly what I need. However, somehow it's not working for me. When I select the folder, I get this message "Found no InDesign documents" even if there are indd files in the folder and its sub-folders. Could anyone have a look please? Thanks in advance!
var files;
var folder = Folder.selectDialog("Select a folder with InDesign documents");
if (folder != null) {
files = GetFiles(folder);
if (files.length > 0) {
// turn off warnings: missing fonts, links, etc.
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
for (i = 0; i < files.length; i++) {
app.open(files);
}
// turn on warnings
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
}
else {
alert("Found no InDesign documents");
}
}
function GetFiles(theFolder) {
var files = [],
fileList = theFolder.getFiles(),
i, file;
for (i = 0; i < fileList.length; i++) {
file = fileList;
if (file instanceof Folder) {
files = files.concat(GetFiles(file));
}
else if (file instanceof File && file.name.match(/\.indd$/i)) {
files.push(file);
}
}
return files;
}
Sorry! Here's a mistake:
var files;
var folder = Folder.selectDialog("Select a folder with InDesign documents");
if (folder != null) {
files = GetFiles(folder);
if (files.length > 0) {
// turn off warnings: missing fonts, links, etc.
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
for (i = 0; i < files.length; i++) {
app.open(files);
}
// turn on warnings
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTE
...
Copy link to clipboard
Copied
Sorry! Here's a mistake:
var files;
var folder = Folder.selectDialog("Select a folder with InDesign documents");
if (folder != null) {
files = GetFiles(folder);
if (files.length > 0) {
// turn off warnings: missing fonts, links, etc.
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
for (i = 0; i < files.length; i++) {
app.open(files);
}
// turn on warnings
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
}
else {
alert("Found no InDesign documents");
}
}
function GetFiles(theFolder) {
var files = [],
fileList = theFolder.getFiles(),
i, file;
for (i = 0; i < fileList.length; i++) {
file = fileList[0];
if (file instanceof Folder) {
files = files.concat(GetFiles(file));
}
else if (file instanceof File && file.name.match(/\.indd$/i)) {
files.push(file);
}
}
return files;
}
Also, check out my batch processor script.
— Kas