🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #17763

Re: AS - Tab stop in paragraph

#17763
From: Olav Kvern
Date: Wed, 14 May 2003 20:02
53 lines
2659 bytes
Gang--
Just a quick note on tab stop creation--the method used above to set the position, leader, and alignment of the tab stops works fine. But if, for whatever reason, you end up creating tab stops and setting their attributes in separate steps, beware! When you create a new tab stop, InDesign puts it at 0 on the tab ruler. Since tab stop object references are assigned from left to right on the ruler, this means that the tab stop is tab stop 1. If, however, you move the tab stop by changing its alignment, its object reference will change when you move it to the right of any other tab stop on the tab ruler.
This means that subsequent property assignments will be applied to the wrong tab stop, as demonstrated in the following script:

--This script will assign the leader/alignment to the wrong tab stop. 
tell application "InDesign 2.0.2" 
	tell active document 
		tell every paragraph of story 1 
			set myTabStop to make tab stop 
			tell myTabStop 
				set position to 12 
				set alignment to left 
				set leader to "." 
			end tell 
			set myTabStop to make tab stop 
			tell myTabStop 
				set position to 24 
				set alignment to right 
				set leader to "--" 
			end tell 
		end tell 
	end tell 
end tell 


To avoid this problem, set the tab stops other properties before setting its position, as shown in the example below:

--This script will assign the leader/alignment correctlyl. 
tell application "InDesign 2.0.2" 
	tell active document 
		tell every paragraph of story 1 
			set myTabStop to make tab stop 
			tell myTabStop 
				set alignment to left 
				set leader to "." 
				set position to 12 
			end tell 
			set myTabStop to make tab stop 
			tell myTabStop 
				set alignment to right 
				set leader to "--" 
				set position to 24 
			end tell 
		end tell 
	end tell 
end tell 


Again, it's best to use "with properties"--I just thought I should mention this.

Thanks,

Ole
Technical Details
Message-ID: <1de91f47.4@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de91f47.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,c14ed4311c08166f
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-05-14 13:08:02 PST
From: "Olav Kvern" <okvern@adobe.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: AS - Tab stop in paragraph
Message-ID: <1de91f47.4@WebX.la2eafNXanI>
Date: Wed, 14 May 2003 13:02:00 -0700
References: <1de91f47.-1@WebX.la2eafNXanI>
Lines: 61
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit