T***@adobeforums.com
2009-02-13 20:33:24 UTC
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?
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?