🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #1286

Placing InDesign snippets on a page

#1286
From: Tomasz_Bujlow
Date: Fri, 13 Feb 2009 20:33
37 lines
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?
Technical Details
Message-ID: <59b7e889.-1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossing

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,b3e00996e4067c51,start
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Tomasz_Bujlow@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Placing InDesign snippets on a page
Message-ID: <59b7e889.-1@webcrossing.la2eafNXanI>
Date: Fri, 13 Feb 2009 12:33:24 -0800
Lines: 61
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit