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.
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) {
...
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
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.
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
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?
Copy link to clipboard
Copied
Is there a way to apply the status to currectly active comment?
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)
}
};
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.
Copy link to clipboard
Copied
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
}
};