🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.scripting.indesign
7 messages
7 total messages Started by MarkPeterson Thu, 29 Jan 2009 15:35
Place Images
#1622
Author: MarkPeterson
Date: Thu, 29 Jan 2009 15:35
18 lines
1386 bytes
(CS3) I'm attempting to modify the ImageCatalog script. The purpose of following script is to place the four images contained in the "image2" folder in four text frames (one text frame per page) in a four-page document. Nothing happens when the script runs.

//Import image files
var myFolder = File("c:\\junk\\junk2\\image2");
var myDocument = app.activeDocument;
var myFiles = new Array;
myFiles = myFolder.getFiles("*");

for (var myFileCounter = 0; myFileCounter < myFiles.length; myFileCounter++){ myFiles.push([myFileCounter]); }

//Place image files
//Number of frames

var myNumberOfFrames = "4";

for (var myCounter = 0; myCounter < myNumberOfFrames; myCounter++){ var myFile = myFiles[myCounter]; var myRectangle = myDocument.rectangles.item(myCounter); myRectangle.place(File(myFile)); }

What am I doing wrong?
Re: Place Images
#1626
Author: loic_aigon
Date: Thu, 29 Jan 2009 16:12
15 lines
1105 bytes
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
Loic
Re: Place Images
#1627
Author: MarkPeterson
Date: Thu, 29 Jan 2009 16:42
5 lines
795 bytes
Hi Loic,
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.

Thanks,
Mark
Re: Place Images
#1639
Author: loic_aigon
Date: Thu, 29 Jan 2009 21:34
10 lines
1061 bytes
Hi Mark,

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); 	myRectangle.place(File(myFile)); }
Re: Place Images
#1643
Author: MarkPeterson
Date: Thu, 29 Jan 2009 23:52
12 lines
834 bytes
Loic,

Thank you for the code. When the following line executes, I get the error shown below:

myRectangle.place(File(myFile));

Error:
The file C:\Users\mp\documents\tmp000001 was not found.

I'm using the "c:\\junk\\junk2\\image2" path.

Mark
Re: Place Images
#1644
Author: loic_aigon
Date: Fri, 30 Jan 2009 07:47
7 lines
934 bytes
Hi Mark,
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();
$.writeln(myFolder.fullName);

By the way, did you have a look on the scripting documentation, it has a big part on dealing with files and folders objects ?
Re: Place Images
#1564
Author: MarkPeterson
Date: Fri, 30 Jan 2009 18:36
6 lines
717 bytes
Hi Loic,

The script is fine. The error I received was caused by a problem with one of the files I was trying to import.

Thanks,
Mark
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads