🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #20215

Re: Select a Story

#20215
From: Olav Kvern
Date: Fri, 18 Oct 2002 20:46
50 lines
2754 bytes
Jon-- 

First, find preferences and change preferences belong to the application, so you'll have better luck if you move them out of the "tell myDocument" block. 

Next, you're telling the document to search for the string/attributes. This means that all text blocks will be affected. 

Take a look at the following example--it works on the story containing the selected text (or text frame). 



tell application "InDesign 2.0.1" 
	set myTextObjects to {insertion point, character, word, line, text style range, text, paragraph, text column, text frame} 
	my myResetFindChange 
	set mySelection to selection 
	if (count mySelection) > 0 then 
		if class of item 1 of mySelection is insertion point then 
			set myItem to parent story of parent text frame of item 1 of mySelection 
		else 
			set myItem to parent story of item 1 of mySelection 
		end if 
		my mySearch(myItem, {find text:"^9^9/"}, {applied character style:character style "Superscript" of active document}) 
		my mySearch(myItem, {find text:"^9/"}, {applied character style:character style "Superscript" of active document}) 
		my mySearch(myItem, {find text:"/^9^9"}, {applied character style:character style "Subscript" of active document}) 
		my mySearch(myItem, {find text:"/^9"}, {applied character style:character style "Subscript" of active document}) 
		my mySearch(myItem, {find text:"/"}, {applied character style:character style "Virgule" of active document}) 
	end if 
end tell 

on mySearch(myItem, myFindAttributes, myChangeAttributes) 
	tell application "InDesign 2.0.1" 
		tell myItem 
			search with find attributes myFindAttributes with change attributes myChangeAttributes 
		end tell 
		my myResetFindChange 
	end tell 
end mySearch 

on myResetFindChange() 
	tell application "InDesign 2.0.1" 
		set find preferences to nothing 
		set change preferences to nothing 
	end tell 
end myResetFindChange 




Thanks, 

Ole
Technical Details
Message-ID: <1de63069.5@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newspump.sol.net!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de63069.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,1ba7e41667d1158d,start
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-10-21 03:50:06 PST
From: "Olav Kvern" <okvern@adobe.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newspump.sol.net!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!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: Select a Story
Message-ID: <1de63069.5@WebX.la2eafNXanI>
Date: Fri, 18 Oct 2002 13:46:35 -0700
References: <1de63069.-1@WebX.la2eafNXanI>
Lines: 58
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit