Thread View: adobe.scripting.indesign
2 messages
2 total messages
Started by Tomasz_Bujlow
Fri, 13 Feb 2009 20:33
Placing InDesign snippets on a page
Author: Tomasz_Bujlow
Date: Fri, 13 Feb 2009 20:33
Date: Fri, 13 Feb 2009 20:33
37 lines
2581 bytes
2581 bytes
Hello,
I have hot problem with placing InDesign snippets on a page. To put a snippet I use this method:
var mySnippet = app.activeDocument.pages.item(0).place(File("/c/test/snippet9.idms"));
But I would like to put this snippet in a specific location on a page (for example: LEFT=0, TOP=0. I cannot just move this "mySnippet" now, because InDesign will complain, that this snippet contains "Image" and "Story", which are not objects. o avoid this problem with "Image" I am rewriting this "mySnippet" to new array - and instead of "Image" I use its parent, which is frame containing this image:
var myObjectList = new Array;
for(var myCounter = 0;myCounter < mySnippet.length; myCounter++) { var objecto = mySnippet[myCounter];
if (objecto.constructor.name == "Image")
{
objecto = objecto.parent;
}
if (objecto.constructor.name != "Story")
{
myObjectList.push(objecto);
}
}
Now, I can group these objects and move the group to anothe location (but still it is not fixed one, by only movement some pixels in given direction):
var myGroup2 = app.activeDocument.pages.item(0).groups.add(myObjectList);
myGroup2.move ([36,50]);
As you saw above, I am excluding Story object... And this is next problem. Just because for example snippet contains many text frames, which are not added to group and not moved to proper location).
This "Story" object is completely empty and does not have any references to these text frames - why?
I can move also all text frames on a page by appending them to group - but then - it will act on all text frames, not only on frames from this snippet:
for(var myCounter = 0;myCounter < app.activeDocument.pages.item(0).textFrames.length; myCounter++) { newobjecto = app.activeDocument.pages.item(0).textFrames.item(0); myObjectList.push(newobjecto); }
So, reasuming I would like how to put any snippet to FIXED location on a page (e.g. LEF=200, TOP=300) - everything, what the snippet contains. What is the easiest solution?
Re: Placing InDesign snippets on a page
Author: Tomasz_Bujlow
Date: Sun, 15 Feb 2009 20:20
Date: Sun, 15 Feb 2009 20:20
5 lines
739 bytes
739 bytes
I will reply myself:
var mySnippet = app.activeDocument.pages.item(0).place(File("/c/test/snippet1.inds"), [20, 30]);
where [20,30] is [left, top]
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