This content has been marked as final. Show 7 replies
As far as I know, you are speaking japanese to an italian ;-)
Your instructions look unappropriate:
mYfolder may point to a folder object, not a file.
myFolder = Folder("/c/junk/junk2/image2/");
myFiles = myFolder.getFiles("*");
This will return a array of files by defaut, no need to reconstruct one.
myFileCounter is indeep myFiles.length;
var myRectangle = myDocument.rectangles.item(myCounter)
means they already exist or you have yo add them with coordinates.
But I am not the specialist here ;-)
Hope it helps
Thank you for the quick response. You may have caught one error: the four pages contain text frames, not rectangles. Despite the change, nothing happens when the script runs.
Here with CS3, it runs well :
//Given 4 rectangles placed on a page of a Indesign document.
//Import image files
var myFolder = Folder("/Users/KimLien/Documents/Loïc/Tests");
var myDocument = app.activeDocument;
myFiles = myFolder.getFiles();
for (var myCounter = 0; myCounter < 4; myCounter++)
var myFile = myFiles[myCounter];
var myRectangle = myDocument.rectangles.item(myCounter);
Thank you for the code. When the following line executes, I get the error shown below:
The file C:\Users\mp\documents\tmp000001 was not found.
I'm using the "c:\\junk\\junk2\\image2" path.
When I am confused with writing system path, I use this technique to check them out (waiting to get more confidence on dealing with them ;-))
var myFolder = Folder.selectDialog();
By the way, did you have a look on the scripting documentation, it has a big part on dealing with files and folders objects ?
The script is fine. The error I received was caused by a problem with one of the files I was trying to import.