i apologize if this question has been answered but i’m stumped.
i can get the contents of a text frame i’ve applied a script label to but i am unable to get the contents of a CELL i’ve done the same thing with.
for instance, this works:
tell application "Adobe InDesign CS3"
tell text frame "CONTROL" of active document
set x to contents
display dialog (x as text)
end tell
end tell
however, if i substitute “cell” or “table cell” i get “Adobe InDesign CS3 got an error: Can’t get cell “SOMETHING”.”
i get the same error as i burrow down even as far as cell “CONTROL” of table 1 of text frame 1 of active page of active document.
same goes when i try to specify the row, too (cell “CONTROL” of row 5 of table 1…)
same too when i don’t even try the label part (cell 4 of row 5 of table 1…)
There’s a distinction between items that have both label and name properties and those with just labels in InDesign. If an item has no name property, the label can be used like a name, as in ‘text frame “Some label”’. But cells have a name property – cell “1:1” is the cell at row 1, column 1 – so you can’t use labels as names. You can, however, use a whose clause: cell 1 whose label is “Some label”.
the only way to get to something in a cell would be to either know the location of the cell before hand or cycle through ALL cells looking for one with the label i want?
Here’s a few things that might help you with cells:
tell application "Adobe InDesign CS4"
tell document 1
tell text frame 1
tell table 1
display dialog (name of cell 1) as text
--set name of cell 1 to "Harper" --name property is read only so can't set it so this will error
get contents of every cell
set label of cell 1 to "barry"
display dialog (label of cell 1) as string
return properties -- look in results window
end tell
end tell
end tell
end tell
tell application "Adobe InDesign CS4"
tell document 1
tell text frame 1
set x to contents of cell 1 of table 1 whose label is "Cell"
end tell
end tell
end tell