🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #18153

Re: Change the font of characters (AS)

#18153
From: Kari Puikkonen
Date: Wed, 16 Apr 2003 22:21
41 lines
2047 bytes
Olivier,

Wouldn't this be easier to do with styles:



tell application "InDesign 2.0.2"

	set paraStyle to "BodyText" -- name of paragraph style to have run-in head  
	set runinStyle to "TimesStyle" -- name of character style to be applied  
	set sepChar to "	" as text -- separator character 

	set theStories to object reference of stories of document 1 
	repeat with theStory in theStories 
		try 
			set theParaStyles to name of applied paragraph style of object reference of paragraphs of theStory 
			repeat with x from 1 to count of theParaStyles 
				if paraStyle = contents of item x of theParaStyles then 
					applyRunin(x, theStory, sepChar, runinStyle) of me 
				end if 
			end repeat 
		end try 
	end repeat 
end tell

on applyRunin(paraNum, storyRef, sepChar, charStyle) 
	tell application "InDesign 2.0.2" 
		set theText to paragraph paraNum of storyRef 
	end tell 
	set theEnd to (offset of sepChar in theText) - 1

	if theEnd > 0 then 
		tell application "InDesign 2.0.2" 
			set the applied character style of characters 1 through theEnd of paragraph paraNum of storyRef to character style charStyle of document 1 
		end tell 
	end if 
end applyRunin



Kari
Technical Details
Message-ID: <1de8bfdc.3@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de8bfdc.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,f7431b34e5085098
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-04-16 15:37:50 PST
From: "Kari Puikkonen" <kari.puikkonen@welho.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Change the font of characters (AS)
Message-ID: <1de8bfdc.3@WebX.la2eafNXanI>
Date: Wed, 16 Apr 2003 15:21:54 -0700
References: <1de8bfdc.-1@WebX.la2eafNXanI>
Lines: 41
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit