Copy link to clipboard
Copied
I have a single frame per page and I'm trying to place a folder of images 1 per page. When I run this code I get the first image on every page. Why is that?
var myFunction = function(){
var sourceFolder = Folder.selectDialog("Select the source folder");
var myFiles = sourceFolder.getFiles();
for (i = 0; i < myFiles.length; i++){
for (j=0; i < myDoc.pages.length; j++){
myDoc.pages[j].rectangles[0].place(myFiles[i]);
}
}
}
myFunction();
You are looping through the pages per file. So
image 1: page 1, page 2, page 3...
In your snippet you don't need to loop through the pages.
for (i = 0; i < myFiles.length; i++){
myDoc.pages[i].rectangles[0].place(myFiles[i]);
}
btw. I would check if there are enough pages and add if necessary/you have more files than pages.
Copy link to clipboard
Copied
You are looping through the pages per file. So
image 1: page 1, page 2, page 3...
In your snippet you don't need to loop through the pages.
for (i = 0; i < myFiles.length; i++){
myDoc.pages[i].rectangles[0].place(myFiles[i]);
}
btw. I would check if there are enough pages and add if necessary/you have more files than pages.