Indesign Script: Mark as Resolved the pdf comment

New Here ,
Apr 11, 2022 Apr 11, 2022

Copy link to clipboard

Copied

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.

TOPICS
Scripting

Views

172

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Apr 11, 2022 Apr 11, 2022
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) {...

Likes

Translate

Translate
Adobe Community Professional ,
Apr 11, 2022 Apr 11, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 11, 2022 Apr 11, 2022

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 11, 2022 Apr 11, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 11, 2022 Apr 11, 2022

Copy link to clipboard

Copied

This is working but there is another problem. How can apply the script only to open_status comments. Currently it is applying to first comment regardless of its status?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 11, 2022 Apr 11, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 11, 2022 Apr 11, 2022

Copy link to clipboard

Copied

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)
    }   
}; 

 

 

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 11, 2022 Apr 11, 2022

Copy link to clipboard

Copied

Got it, this one actually changes the status of all the open comments to resolved. What I am trying to do is set the comment which I'm currently working on, to 'Mark as resolved'. I am not exaclty sure, but if I can create a varible containing all the OPEN_STATUS comments and apply changeStatus(CommentStatusEnum.RESOLVED_STATUS) to the firstItem(), practically I can achieve what I'm trying to do. I don't know how to explain it, I'm really sorry.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 11, 2022 Apr 11, 2022

Copy link to clipboard

Copied

LATEST

I don't know this is proper, but breaking the for loop solved my problem. Thank you rob day for the excellent help, so much appreciated. This is my final code (Doesn't always follow the order in pdf comments panel):

//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)
		break
    }   
}; 
 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines