InDesign - help with table contents please...

Hi There,

I’ve written a script for applying a style to a table and reformatting certain elements that can’t be applied with a pre-defined table style.

The script works ok however, I’ve had to a little workround for copying the contents from the 1st row of one table and pasting it into another.

Here’s the workround:-

tell row 1 of table 1 of text frame "icons"
			tell application "System Events"
				keystroke "c" using {command down}
			end tell
		end tell
		tell mySelection
			select row 1
			tell application "System Events"
				keystroke "v" using {command down}
			end tell
		end tell

(mySelection is a reference to the table the user highlights before running the script)

I tried numerous ways to get the contents of the 1st row of one table, and populate the 1st row of another, but no luck.

The items I’m trying to copy are anchored boxes containing icons.
The hack above works but I’d still like to find a nice way to do it in InDesign.

Thanks in advance.




this is an example to exchange the contents of two columns of a table.
Hope it helps

property column1 : 2
property column2 : 4

tell application "Adobe InDesign CS3"
	tell table 1 of text frame 1 of document 1
		set temp to contents of column column1
		set contents of column column1 to (get contents of column column2)
		set contents of column column2 to temp
	end tell
end tell

Hi Stefan,

Thanks for your help with this query.

I’ve had a play around with your code which is similar to one of the variations I’d tried.
Everything works fine if the rows or columns contain text however, I’m trying to do the same with anchored picture boxes containing a graphic.

I’m not sure if I need to refer to the ‘contents’ of the row in a different way?

Thanks again Stefan.