🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #19488

Re: Auto Numbering

#19488
From: Olav Kvern
Date: Tue, 10 Dec 2002 22:23
56 lines
3554 bytes
Adam--

Try something like this:



--Paragraph numbering example 
tell application "InDesign 2.0.1" 
	--Create an example document. 
	set find preferences to nothing 
	set change preferences to nothing 
	set myDocument to make document 
	tell myDocument 
		set myListStyle to make paragraph style with properties {name:"myListStyle"} 
		set myListColor to make color with properties {color value:{0, 100, 100, 0}, name:"myListColor"} 
		set myNumberStyle to make character style with properties {name:"myNumberStyle", fill color:myListColor} 
		set myPage to page 1 
		set myBounds to my myGetPageBounds(myPage, myDocument) 
		set myString to "1." & tab & "This is the first numbered paragraph." & return 
		set myString to myString & "2." & tab & "This is the second numbered paragraph." & return 
		set myString to myString & "3." & tab & "This is the third numbered paragraph." & return 
		set myString to myString & "4." & tab & "This is the fourth numbered paragraph." & return 
		set myString to myString & "5." & tab & "This is the fifth numbered paragraph." & return 
		set myString to myString & "6." & tab & "This is the sixth numbered paragraph." & return 
		set myString to myString & "7." & tab & "This is the seventh numbered paragraph." & return 
		set myString to myString & "8." & tab & "This is the eighth numbered paragraph." & return 
		set myString to myString & "9." & tab & "This is the ninth numbered paragraph." & return 
		set myString to myString & "10." & tab & "This is the tenth numbered paragraph." & return 
		set myTextFrame to make text frame with properties {geometric bounds:myBounds, contents:myString} 
		set applied paragraph style of parent story of myTextFrame to myListStyle 
		--User find/change to apply the character style. 
		set myFoundItems to search for "^9.^t" with find attributes {applied paragraph style:myListStyle} with change attributes {applied character style:myNumberStyle} 
		set myFoundItems to search for "^9^9.^t" with find attributes {applied paragraph style:myListStyle} with change attributes {applied character style:myNumberStyle} 
	end tell 
end tell

on myGetPageBounds(myPage, myDocument) 
	tell application "InDesign 2.0.1" 
		set myMarginPreferences to margin preferences of myPage 
		set myDocumentPreferences to document preferences of myDocument 
		tell myPage 
			set myX1 to margin left of myMarginPreferences 
			set myY1 to margin top of myMarginPreferences 
			set myX2 to (page width of myDocumentPreferences) - (margin right of myMarginPreferences) 
			set myY2 to (page height of myDocumentPreferences) - (margin bottom of myMarginPreferences) 
		end tell 
	end tell 
	return {myY1, myX1, myY2, myX2} 
end myGetPageBounds 




Thanks,

Ole
Technical Details
Message-ID: <1de6d01c.17@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!news.stealth.net!news.stealth.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de6d01c.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,e7d83a70f4be8fa9
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-12-10 14:38:09 PST
From: "Olav Kvern" <okvern@adobe.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!news.stealth.net!news.stealth.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Auto Numbering
Message-ID: <1de6d01c.17@WebX.la2eafNXanI>
Date: Tue, 10 Dec 2002 14:23:01 -0800
References: <1de6d01c.-1@WebX.la2eafNXanI>
Lines: 73
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit