🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #18937

Search & replace in a table [AS]

#18937
From: Olivier Berquin
Date: Wed, 05 Feb 2003 11:34
43 lines
2147 bytes
Hello fellows scripters,

I've a problem with table/cells.
I would like to make a search & replace in a column !
I write this script, but it works only for the first cell of my selection.



 
tell application "InDesign 2.0.2" 
	set myTextObjects to {character, word, text, paragraph, text column, text frame, cell, column, row, table} 
	--store find/change preferences  
	set myOldFindAttributes to properties of find preferences 
	set myOldChangeAttributes to properties of change preferences 
	--clear find/change preferences  
	set find preferences to nothing 
	set change preferences to nothing

	set mySelection to selection 
	if (count mySelection) > 0 then 
		repeat with myCounter from 1 to (count mySelection) 
			set myItem to object reference of item myCounter of mySelection 
			if class of myItem is in myTextObjects then 
				tell myItem 
					search for "." replacing with "$" 
					search for "," replacing with "." 
					search for "$" replacing with "," 
				end tell 
			end if 
		end repeat 
	end if 
	--restore find/change preferences  
	set properties of find preferences to myOldFindAttributes 
	set properties of change preferences to myOldChangeAttributes 
end tell





The var. "myItem" = cells "6:8" thru "6:13" of table id 737 of text frame id 899 of page id 176 of spread id 171 of document "my_doc2.indd"

Any idea ???
Technical Details
Message-ID: <1de7b517.-1@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!newsfeed.telusplanet.net!xmission!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,85157a2bfc88ed82,start
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-02-05 03:37:40 PST
From: "Olivier Berquin" <olb@microscript.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!newsfeed.telusplanet.net!xmission!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Search & replace in a table [AS]
Message-ID: <1de7b517.-1@WebX.la2eafNXanI>
Date: Wed, 5 Feb 2003 03:34:08 -0800
Lines: 42
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit