🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #248

altering fill of selected table cells based on content

#248
From: Justin C
Date: Tue, 10 Jul 2012 10:57
46 lines
2515 bytes
InDesign CS2 & AppleScript


I'm selecting a group of cells in a table, and, if the text in
the cell is "N", I want the cell fill to be changed (there is
no fill currently, I want black with 40% tint).

Currently I have the following, cobbled together from various
resources on the web. I can't work out how to work through each
of the cells in the selection because my 'count of items in
selection' appears to be 1, I suppose that means there is one
contiguous selection only, but not the contents of that
selection.


tell application "Adobe InDesign CS2"
	-- Check we've got a document open
	if (count documents) is not equal to 0 then
		set mySelection to selection
		-- Do we have anything selected?
		if (count mySelection) is not equal to 0 then
			-- check the selection is table cells
			set myCellClasses to {column, row, table, line, cell}
			if class of item 1 of selection is in myCellClasses then
				-- 
			else
				display dialog "You have not selected any table cells"
			end if
		else
			display dialog "There is nothing selected"
		end if
	else
		display dialog "There is no InDesign document open"
	end if
end tell

I suppose I need help accessing the contents of the selection,
and then iterating over them.

Any help will be gratefully received.

   Justin.

-- 
Justin C, by the sea.
Technical Details
Message-ID: <sdetc9-mvl.ln1@zem.masonsmusic.co.uk>
Path: arc1-ca.pugleaf.net!l9ni11304pbj.0!nntp.google.com!news2.google.com!news1.google.com!npeer03.iad.highwinds-media.com!feed-me.highwinds-media.com!cyclone03.ams2.highwinds-media.com!news.highwinds-media.com!voer-me.highwinds-media.com!npeersf03.am4!fx25.am4.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,d78629a7361a70ed,start
X-Google-NewGroupId: yes
X-Google-Attributes: gida938ebf930,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Received: by 10.68.220.230 with SMTP id pz6mr24535479pbc.3.1341918483456;
        Tue, 10 Jul 2012 04:08:03 -0700 (PDT)
Path: arc1-ca.pugleaf.net!l9ni11304pbj.0!nntp.google.com!news2.google.com!news1.google.com!npeer03.iad.highwinds-media.com!feed-me.highwinds-media.com!cyclone03.ams2.highwinds-media.com!news.highwinds-media.com!voer-me.highwinds-media.com!npeersf03.am4!fx25.am4.POSTED!not-for-mail
Newsgroups: adobe.scripting.indesign
From: Justin C <justin.1207@purestblue.com>
Subject: altering fill of selected table cells based on content
User-Agent: slrn/0.9.9p1 (Darwin)
Mime-Version: 1.0
Message-ID: <sdetc9-mvl.ln1@zem.masonsmusic.co.uk>
Lines: 46
NNTP-Posting-Host: 83.104.126.146
X-Complaints-To: abuse@demon.net
X-Trace: fx25.am4 1341918482 83.104.126.146 (Tue, 10 Jul 2012 11:08:02 UTC)
NNTP-Posting-Date: Tue, 10 Jul 2012 11:08:02 UTC
Date: Tue, 10 Jul 2012 11:57:32 +0100
X-Received-Bytes: 2138
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit