Skip to main content
Inspiring
September 6, 2022
Answered

Accepting Track changes in tables

  • September 6, 2022
  • 1 reply
  • 641 views

We are trying to create a script to accept track changes 

app.activeDocument.stories.everyItem().changes.everyItem().accept();
app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().changes.everyItem().accept();
this is what we've used the first line has cleared the changes in the document outside tables but the second line hasn't cleared the changes in tables. We are using a plugin called SuperTrack but that should link to the track changes in Indesign is this something some one could help with please?
This topic has been closed for replies.
Correct answer Pickory

Hi @Alex25077296wbvx,

Your code will still not get all the tables in the document. It will work only on the 1st level of nested tables. To get all the tables however deep they are nested in a table, try the following code

/*
https://community.adobe.com/t5/indesign-discussions/accepting-track-changes-in-tables/td-p/13181717

Script to get an array of all the talbes present in a document
Pre Requisite:- The script needs an open document
Warning :- No elaborate error checking

Author:- Manan Joshi
Guthub Repo :- https://github.com/Manan-Joshi/InDesign-Scripts.git
*/
function getTables(pCol){
    var retval = [];
    var tables = pCol.everyItem().tables.everyItem().getElements()
    retval = retval.concat(tables)
    for(var i = 0; i < tables.length; i++){
        retval = retval.concat(getTables(tables[i].cells))
    }
    return retval
}

var tables = getTables(app.documents[0].stories)

-Manan


There is a conversation here:

https://community.adobe.com/t5/indesign-discussions/find-change-specific-tables/m-p/9760163

 

Search for the anchored character.

"<0016>"

1 reply

Peter Kahrel
Community Expert
Community Expert
September 6, 2022

Both 

app.documents[0].stories.everyItem().tables.everyItem().changes.everyItem().accept();

and

app.documents[0].stories.everyItem().tables.everyItem().cells.everyItem().changes.everyItem().accept();

work fine over here. Maybe contact the plug-in developer and report the problem.

Legend
September 7, 2022

Are the stories locked, or checked out to InCopy?