🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #8978

Re: Are there policies for usage of labels?

#8978
From: Gerald_Singelmann
Date: Mon, 18 Sep 2006 15:20
86 lines
2936 bytes
Thank you Dave,

now I remember wondering about those commands some time ago.
Just to be sure: in the line 

      		tell aThing to insert label value aLayer key "gslg"




it really needs the "tell aThing", doesn't it?

In case anyone finds this helpful, these two scripts remember the layers of grouped items (1) so that the layers can be restored when ungrouping (2). Several of my customers absolutely need that feature.

 
tell application "Adobe InDesign CS2" 
	set aDoc to active document 
	set aSel to selection 
	set aCount to count aSel 
	if aSel is not {} then 
		set aSel to {} 
		repeat with n from 1 to aCount 
			copy item n of selection to end of aSel 
		end repeat 
	end if

	repeat with n from 1 to (count aSel) 
		set aThing to item n of selection 
		set aLayer to (id of item layer of aThing) as text 
		tell aThing to insert label value aLayer key "gslg" 
		tell aThing to set ha to extract label key "gslg" 
	end repeat

	if aCount > 1 then 
		tell aDoc 
			set myGroup to make group with properties {group items:aSel} 
			select myGroup 
		end tell 
	end if 
end tell 




and



 
tell application "Adobe InDesign CS2" 
	set aDoc to active document 
	set aSel to selection 
	repeat with n from 1 to (count aSel)

		set aThing to item n of aSel 
		if class of aThing is group then 
			set aGroup to every page item in aThing 
			set actLayer to item layer of aThing 
			ungroup aThing 
			repeat with m from (count aGroup) to 1 by -1 
				set anotherThing to item m of aGroup 
				tell anotherThing to set aLayer to (extract label key "gslg") as integer 
				set aLayer to my getLayerByID(aLayer, aDoc, actLayer) 
				set item layer of anotherThing to aLayer 
			end repeat 
		end if 
	end repeat 
end tell

on getLayerByID(n, aDoc, actLayer) 
	tell application "Adobe InDesign CS2" 
		set allLayers to every layer of aDoc 
		repeat with m from 1 to count allLayers 
			set aLayer to item m of allLayers 
			set anID to id of aLayer 
			if anID is n then return aLayer 
		end repeat 
		return actLayer 
	end tell 
end getLayerByID 




Thank you
Gerald
Technical Details
Message-ID: <3bc1a682.1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed.kamp.net!newsfeed.kamp.net!news.germany.com!news.isoc.lu!webcrossing
References: <3bc1a682.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,bb0ad9c2d1a7e9a8
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Gerald_Singelmann@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed.kamp.net!newsfeed.kamp.net!news.germany.com!news.isoc.lu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: Are there policies for usage of labels?
Message-ID: <3bc1a682.1@webcrossing.la2eafNXanI>
Date: Mon, 18 Sep 2006 08:20:04 -0700
References: <3bc1a682.-1@webcrossing.la2eafNXanI>
Lines: 78
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit