Skip to main content
Participating Frequently
April 11, 2022
Answered

Indesign Script: Mark as Resolved the pdf comment

  • April 11, 2022
  • 1 reply
  • 737 views

Hi,

I would like to know the ExtendScript code for 'Mark as Resolved' a pdf comment. Also, in the pdf comments panel, is there a method to navigate to the next comment using scripting? Thanks in advance.

This topic has been closed for replies.
Correct answer rob day

Is there a way to apply the status to currectly active comment?


Is there a way to apply the status to currectly active comment?

 

I don’t see a way to get the acive comment, but I don‘t use PDF comments, so maybe someone else can help

 

You should be able to loop through all the comments, and check the status–if it’s open then change it to resolved:

 

 

//the active document’s comments
var pc=app.activeDocument.pdfComments;  

//sets all comments to resolved
for (var i = 0; i < pc.length; i++){
    if ( pc[i].commentStatus == CommentStatusEnum.OPEN_STATUS) {
        pc[i].changeStatus(CommentStatusEnum.RESOLVED_STATUS)
    }   
}; 

 

 

 

 

1 reply

rob day
Community Expert
Community Expert
April 11, 2022

Here is the PDFComment API page:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#PDFComment.html

 

//the active document’s comments
var pc=app.activeDocument.pdfComments;  

//sets all comments to resolved
for (var i = 0; i < pc.length; i++){
    pc[i].commentStatus = CommentStatusEnum.RESOLVED_STATUS
};   

//sets the 2nd comment to unresolved
pc[0].nextItem().commentStatus = CommentStatusEnum.OPEN_STATUS
MetallizrAuthor
Participating Frequently
April 11, 2022

Thank you for the reply, this is what I was looking for. Could you please tell me the code for 'Mark as Resolved' for the active/selected comment? I tried to use your solution to:

var pc=app.activeDocument.pdfComments;  
pc.firstItem().commentStatus = CommentStatusEnum.RESOLVED_STATUS

but it is returning an error

Javascript Error!
Error Number: 30474
Error string: 'commentStatus' is a read only property.
rob day
Community Expert
Community Expert
April 11, 2022

Sorry I didn’t test my code. Try the changeStatus method:

 

pc.firstItem().changeStatus(CommentStatusEnum.RESOLVED_STATUS)

 

 

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#PDFComment.html#d1e304203__d1e304545