Skip to main content
Participating Frequently
January 5, 2016
Answered

Script for selecting multiple tables in indesign and editing

  • January 5, 2016
  • 1 reply
  • 3033 views

Hi and I hope you can help.

I need a script that will select all tables in a large indd doc that has tables imported from word.

I have read another simliar question on here Need to select ALL tables

but i don't have the scripting knowledge to alter it to suit my needs. I hope someone can help. Also hope i'm not asking too much either but here goes.

I need to select all the tables and make the stroke weight 0.25pt

Then select the top row of each column and fill it with 10% black and make the top row (or cell heights) 'exactly' (not 'At least') 5.09mm height

That would do me really, but is it possible to adjust the column widths of all these tables too using a script and the cell style?

It would be cell 1 of row 1 'exactly' 112.956mm (cell style 1) and cell 2 row 1 'exactly' 4.956 (cell style 2)

Cell 1 (the only cell) of row 2 117.912mm (cell style 3)

And cell 1 ( the only cell) of row 3 (cell style 3)

I really hope you can help, as it will save me a load of time.

Thanks a million - in the mean time i will continue to plod through them all manually hoping someone can help before i've done them all - but it looks like taking me days.

Thanks again

Andy

From word: (ignore the bit of text that says J'Anson v Stuart' - thats just the start of the next table)

start_zpsiby9gwys.jpg

Finished formatting:

finished%20look_zpsjukz9xeo.jpg

I added the number 2 in the second cell row 1 all on my own

This topic has been closed for replies.
Correct answer tpk1982

Hi ,

Use the below updated for top row height.

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().bottomEdgeStrokeWeight = "0.25pt"; 

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().topEdgeStrokeWeight = "0.25pt"; 

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().leftEdgeStrokeWeight = "0.25pt"; 

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().rightEdgeStrokeWeight = "0.25pt"; 

try

{

app.activeDocument.colors.item("Black10%").name;

}

catch (e){

app.activeDocument.colors.add({name:"Black10%", model:ColorModel.process, colorValue:[0, 0, 0, 10]});

}

app.activeDocument.stories.everyItem().tables.everyItem().rows[0].fillColor = "Black10%"; 

app.activeDocument.stories.everyItem().tables.everyItem().rows[0].properties = {autoGrow:false, minimumHeight:"5.09mm", maximumHeight:"5.09mm"};

Thanks,

Karthi

1 reply

tpk1982
Legend
January 6, 2016

Hi,

The following script will be useful to change stroke weight and apply 10& black color.. am quite busy..will give you full script ASAP. For now you can use this

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().bottomEdgeStrokeWeight = "0.25";

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().topEdgeStrokeWeight = "0.25";

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().leftEdgeStrokeWeight = "0.25";

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().rightEdgeStrokeWeight = "0.25";

app.activeDocument.colors.add({name:"Black10%", model:ColorModel.process, colorValue:[0, 0, 0, 10]});

app.activeDocument.stories.everyItem().tables.everyItem().cells.item(0).fillColor = "Black10%";

Regards,

Karthi

tpk1982
tpk1982Correct answer
Legend
January 6, 2016

Hi ,

Use the below updated for top row height.

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().bottomEdgeStrokeWeight = "0.25pt"; 

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().topEdgeStrokeWeight = "0.25pt"; 

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().leftEdgeStrokeWeight = "0.25pt"; 

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().rightEdgeStrokeWeight = "0.25pt"; 

try

{

app.activeDocument.colors.item("Black10%").name;

}

catch (e){

app.activeDocument.colors.add({name:"Black10%", model:ColorModel.process, colorValue:[0, 0, 0, 10]});

}

app.activeDocument.stories.everyItem().tables.everyItem().rows[0].fillColor = "Black10%"; 

app.activeDocument.stories.everyItem().tables.everyItem().rows[0].properties = {autoGrow:false, minimumHeight:"5.09mm", maximumHeight:"5.09mm"};

Thanks,

Karthi

Participating Frequently
January 6, 2016

Karthi thanks a lot.

But i get a syntax error:

Expected expression, property or key form, etc. but found unknown token.

Script editor highlights the first "." after the first "app" in the script

Script doesn't run in indd. Thanks for you efforts though. Anything i can do?