🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #219

Re: From XMLElement to Page Item

#219
From: seuzo
Date: Thu, 21 May 2009 00:13
32 lines
2160 bytes
Hi, jsantaelena

//Return Hash
function collectPageItem() {
	var my_collection = new Array();
	var my_doc = app.activeDocument;
	for (var i = 0; i < my_doc.allPageItems.length; i++) {
		var tmp_key = my_doc.allPageItems[i].associatedXMLElement;
		if (tmp_key != null) {my_collection["id" + tmp_key.id] =
my_doc.allPageItems[i];}
	}
	return my_collection;
}

//Return pageitem object from XMLElement
function getPageItem(my_element, my_collection) {
	var tmp_key = "id" + my_element.id;
	return my_collection[tmp_key];
}

var my_doc = app.activeDocument;
var my_root = my_doc.xmlElements.item("records");//root element
var my_element = my_root.xmlElements[1];//targetelement

var my_collection = collectPageItem();
var my_obj = getPageItem(my_element, my_collection);
my_obj.select();//select test


--
Seuzo
http://www.seuzo.jp/
Technical Details
Message-ID: <75e7734f-0497-4ce9-834c-4916d236c13a@d25g2000prn.googlegroups.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!d25g2000prn.googlegroups.com!not-for-mail
References: <188addaa-4efc-4f35-80ad-fc9f40d33437@j12g2000vbl.googlegroups.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: a938ebf930,b6f58d44d0c21f5d
X-Google-Attributes: gida938ebf930,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!d25g2000prn.googlegroups.com!not-for-mail
From: seuzo <seuzo.jp@gmail.com>
Newsgroups: adobe.scripting.indesign
Subject: Re: From XMLElement to Page Item
Date: Wed, 20 May 2009 17:13:48 -0700 (PDT)
Organization: http://groups.google.com
Lines: 33
Message-ID: <75e7734f-0497-4ce9-834c-4916d236c13a@d25g2000prn.googlegroups.com>
References: <188addaa-4efc-4f35-80ad-fc9f40d33437@j12g2000vbl.googlegroups.com>
NNTP-Posting-Host: 124.155.40.104
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Trace: posting.google.com 1242864933 32455 127.0.0.1 (21 May 2009 00:15:33 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 21 May 2009 00:15:33 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: d25g2000prn.googlegroups.com; posting-host=124.155.40.104; 
 posting-account=IVOgMgoAAAAXjPA0WqHquDf17516nM66
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; ja-jp) 
 AppleWebKit/525.28.3 (KHTML, like Gecko) Version/3.2.3 Safari/525.28.3,gzip(gfe),gzip(gfe)