Copy link to clipboard
Copied
I'm looking for an easy solution to better manage the appearance of my sticky notes. In a previous post, I was able to get help changing sticky note color based on content. It works great!
I am now looking for a way to change sticky note icon based on content. Currently, all my sticky notes are the "Text Note" icon (because that's how they are exported from InDesign). But I'd like to be able to easily and globally change the Text Note icon to any of the other icons.
It would be even more amazing if the script could also delete the text associated with the color.
For example. If the sticky note content starts with "Help:" the Text Note icon would change to the Help icon, and then also delete "Help:" from the beginning of the sticky note contents.
This code will do that. You can expand it to process more icons and texts, of course.
this.syncAnnotScan();
var annots = this.getAnnots();
if (annots!=null) {
for (var i in annots) {
var annot = annots;
if (annot.type=="Text") {
if (/^Help:/.test(annot.contents)) {
annot.contents = annot.contents.replace(/^Help:/, "");
annot.noteIcon = "Help";
}
}
}
}
Copy link to clipboard
Copied
This code will do that. You can expand it to process more icons and texts, of course.
this.syncAnnotScan();
var annots = this.getAnnots();
if (annots!=null) {
for (var i in annots) {
var annot = annots;
if (annot.type=="Text") {
if (/^Help:/.test(annot.contents)) {
annot.contents = annot.contents.replace(/^Help:/, "");
annot.noteIcon = "Help";
}
}
}
}
Copy link to clipboard
Copied
That's amazing! Thank you so much!
Copy link to clipboard
Copied
On a related question: I am trying to combine the Change sticky note color based on content script with this one. I have exported a bunch of sticky notes as an FDF file, but I can't figure out where in the code the color is referenced.
Which part of this references color?
<</C[0.639221 0.188232 0.525497]/Contents(Purple: 7)/CreationDate(D:20170912144332-04'00')/F 28/M(D:20170912145013-04'00')/NM(4e8a7e30-c615-ff43-86da-19659fa1a871)/Name/Comment/Page 4/Popup 15 0 R/RC(<?xml version="1.0"?><body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:APIVersion="Acrobat:17.12.0" xfa:spec="2.0.2" ><p dir="ltr"><span dir="ltr" style="font-size:13.2pt;text-align:left;color:#000000;font-\
weight:normal;font-style:normal">Purple: 7</span></p></body>)/Rect[52.7047 328.113 70.7047 346.113]/Subtype/Text/T(kellyvaughn)/Type/Annot>>
Copy link to clipboard
Copied
This part:
/C[0.639221 0.188232 0.525497]
It's equivalent to the following RGB values:
RGB: 163 48 134
Hex: #A33086
Copy link to clipboard
Copied
Excellent! Thank you! How did you do the conversion from the decimal values to RGB?
And those decimal values... what are they? Not RGB, not LAB... ?
Copy link to clipboard
Copied
They are RGB, but expressed as values from 0 to 1 instead of 0 to 255.
Copy link to clipboard
Copied
I am still trying to get the script to work successfully with all the icons. Is there any part of the script that is redundant and doesn't need to be duplicated?
this.syncAnnotScan();
var annots = this.getAnnots();
if (annots!=null) {
for (var i in annots) {
var annot = annots;
if (annot.type=="Text") {
if (/^Help:/.test(annot.contents)) {
annot.contents = annot.contents.replace(/^Help:/, "");
annot.noteIcon = "Help";
}
}
}
}
this.syncAnnotScan();
var annots = this.getAnnots();
if (annots!=null) {
for (var i in annots) {
var annot = annots;
if (annot.type=="Text") {
if (/^Star:/.test(annot.contents)) {
annot.contents = annot.contents.replace(/^Star:/, "");
annot.noteIcon = "Star";
}
}
}
}
Copy link to clipboard
Copied
Yes, almost all of the second part is redundant. Use this:
this.syncAnnotScan();
var annots = this.getAnnots();
if (annots!=null) {
for (var i in annots) {
var annot = annots;
if (annot.type=="Text") {
if (/^Help:/.test(annot.contents)) {
annot.contents = annot.contents.replace(/^Help:/, "");
annot.noteIcon = "Help";
}
else if (/^Star:/.test(annot.contents)) {
annot.contents = annot.contents.replace(/^Star:/, "");
annot.noteIcon = "Star";
}
}
}
}
Copy link to clipboard
Copied
Document Geek made a nice presentation of Acrobat's Comment tools yesterday.
Everyone should see the recording: Tech Wednesday Acrobat
Copy link to clipboard
Copied
One thing to be aware of. The icons named Comment, Key, Note, Help, NewParagraph, Paragraph, and Insert are the only ones provided by the viewer if no appearance is supplied in the annotation. In other PDF viewers, they may not look exactly like the icons provided by Acrobat and Reader.
Copy link to clipboard
Copied
What is "viewer"?The software serving to display the PDF? Or the person viewing the PDF? I don't understand.
This goes for all PDF viewers?
Regardless, the icons only need to be seen in Acrobat. I I don't care how they look in Preview, Bluebeam, Goodreader, etc.
Copy link to clipboard
Copied
Ok - If it's only Acrobat and Reader, you're good.