I know next to nothing about scripting, although I have spent considerable amount of time examining the js_developer_guide.pdf and similar resources.
I need to show/hide all annotations of a particular color, for example all annotations that have a "red " fill color. The below script seems to find and hide only the first instance of a "red" annotation. It doesn't continue on to find and hide all other "red" annotations. Any help would be greatly appreciated.
var myAnnotList = this.getAnnots();
for (var i=0; i<myAnnotList.length; i++)
if (color.equal(myAnnotList[i].fillColor, color.red))
myAnnotList[i].hidden = true;
The script looks fine to me. Maybe the problem is with the file?
Thank you. I'll try some more!
It could be that the color of the annotations is not exactly red (like if a
custom color was used), so they aren't being hidden.
You can have the script print out the fill color of each annot to test it