🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #20491

Re: Change case of selected text? (AS)

#20491
From: Aaron Andrade
Date: Wed, 03 Jul 2002 22:31
56 lines
2295 bytes
Well, I'm close. My version integrates it into a search & replace... Unfortunately I'm getting sentence case with small caps, and I can't figure it out. It's on ID's end, I'm sure of that. How do I get that first letter to go small caps?  

-- What we're searching for 

set this_text to {"DFID", "WHO", "UNICEF", "GEM"} 

tell application "InDesign 2.0.1" 

set find preferences to nothing 

set change preferences to nothing 

end tell 

-- Replace with small caps 

repeat with y from 1 to count of this_text 

tell application "InDesign 2.0.1" 

search stories of active document with find attributes � 

{applied font:"ITC Galliard", find text:(item y of this_text)} 

end tell 

makeLowerCase(item y of this_text) 

set the_new_text to result 

--display dialog the_new_text 

tell application "InDesign 2.0.1" 

	search stories of active document with change attributes {change text:(the_new_text), capitalization:small caps} 

end tell 

end repeat 

-- AND HERE I'M REPEATING CARL'S SUBROUTINE 

on makeLowerCase(text_to_change) 
	set the_upper_string to "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 
	set the_lower_string to "abcdefghijklmnopqrstuvwxyz" 
	set the_new_text to "" 
	repeat with thisChar in text_to_change 
		set x to offset of thisChar in the_upper_string 
		if x is not 0 then 
			set the_new_text to (the_new_text & character x of the_lower_string) as string 
		else 
			set the_new_text to (the_new_text & thisChar) as string 
		end if 
	end repeat 
	return the_new_text 
end makeLowerCase
Technical Details
Message-ID: <ef973c0.12@WebX.aaQKaf7vad4>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!iad-peer.news.verio.net!news.verio.net!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <ef973c0.-1@WebX.aaQKaf7vad4>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f939a,7eef1716469144d7
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-07-03 15:39:55 PST
From: "Aaron Andrade" <aaronandrade@sprintmail.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!iad-peer.news.verio.net!news.verio.net!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Change case of selected text? (AS)
Message-ID: <ef973c0.12@WebX.aaQKaf7vad4>
Date: Wed, 3 Jul 2002 15:31:55 -0700
References: <ef973c0.-1@WebX.aaQKaf7vad4>
Lines: 61
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit