Copy link to clipboard
Copied
With thanks to our AI cohabitants. You need to have predefined a swatch in your doc called "BlankCell"; mine is simply a light yellow tint.
-- For every blank (and unfilled with swatch) cell in every table, replace contents with "<><>" and color it with swatch "BlankCell"
-- 3/25, thanks to chatGPT
tell application "Adobe InDesign 2025"
tell active document
-- set theBlankStyle to cell style "BlankCell"
set blankSwatch to swatch "BlankCell"
repeat with s from 1 to count of stories
tell story s
repeat with t from 1 to count of tables
tell table t
repeat with r from 1 to count of rows
tell row r
repeat with c from 1 to count of cells
tell cell c
--set cellContent to contents
if contents is "" and name of fill color is "None" then
--beep
set contents to "–"
--set applied cell style to theBlankStyle
set fill color to blankSwatch
end if
end tell
end repeat
end tell
end repeat
end tell
end repeat
end tell
end repeat
end tell
end tell
say "All done!"
Copy link to clipboard
Copied
Just in case - JS version so will work on a PC as well - no AI involved 😉
var myCells = app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().getElements();
for ( var a = 0; a < myCells.length; a++ )
{
if (myCells[a].texts[0].contents == '')
{
myCells[a].fillColor = 'RED';
};
};
Swatch / Color "RED" needs to be defined.
Copy link to clipboard
Copied
Cool, Robert! Yeah JS makes much more sense for cross-compatibility; I bias toward AS only because it's less cryptic.
Copy link to clipboard
Copied
Are you aware, that your code will mark as "empty" - overset cells?
But if that's the purpose of your code - you should be chekcing "overflows" property:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Cell.html
That's why I'm checking myCells[a].texts[0].contents - not myCells[a].contents
Copy link to clipboard
Copied
@Robert at ID-Tasker, thank you for flagging that! Definitely not what I intended. When I have time I'll amend the code.