Skip to main content
demonjamez
Participant
April 26, 2019
Question

Search and select table columns by content and run grep find/change

  • April 26, 2019
  • 4 replies
  • 888 views

Hi all.

I have a document with lots of tables, all of which have different amounts of columns.

I need to apply brackets around all of the text within a 'Notes' column, but this column does not feature in every table.

I was thinking that a script which selected any column containing the word 'Notes' and then ran a grep search on the selection (figures only) would be a quick way to achieve this.

For the grep search I was thinking that this would work:

app.findGrepPreferences=app.changeGrepPreferences=null;

app.findGrepPreferences.findWhat="\d+";

app.changeGrepPreferences.changeTo="($1)";

app.activeDocument.changeGrep();

but am struggling with the find/select element.

I'd be very grateful of any help.

Many thanks.

This topic has been closed for replies.

4 replies

Inspiring
April 26, 2019

Here is how you would get a list of table columns with cells containing "Note" in AppleScript:'

tell application "Adobe InDesign CC 2019"

  tell document 1

  set myList to parent column of every cell of every table of every text frame where paragraph 1 of it contains "Note"

  end tell

end tell

demonjamez
Participant
April 26, 2019

Sorry, to clarify, I need help with the portion of a script that can search for the word 'Note' in multiple tables and then select those columns, where I can then have the grep script run.

Many thanks

Stefan Rakete
Inspiring
April 26, 2019

And in case you are using CC 2019: Update to 14.0.2 and do the manual Update

Fixed issues in InDesign

Community Expert
April 26, 2019

Try "(\\d+)"

-Manan

-Manan