12 Replies Latest reply on Jan 18, 2018 10:49 AM by Joel_Geraci

    Change Icon of sticky note based on Content

    Document Geek Adobe Community Professional

      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.

       

       

      Screen Shot 2017-09-01 at 4.33.11 PM.png

        • 1. Re: Change Icon of sticky note based on Content
          try67 MVP & Adobe Community Professional

          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[i];
                  if (annot.type=="Text") {
                      if (/^Help:/.test(annot.contents)) {
                          annot.contents = annot.contents.replace(/^Help:/, "");
                          annot.noteIcon = "Help";
                      }
                  }
              }
          }
          
          • 2. Re: Change Icon of sticky note based on Content
            Document Geek Adobe Community Professional

            That's amazing! Thank you so much!

            • 3. Re: Change Icon of sticky note based on Content
              Document Geek Adobe Community Professional

              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>>
              
              • 4. Re: Change Icon of sticky note based on Content
                George_Johnson MVP & Adobe Community Professional

                This part:

                 

                /C[0.639221 0.188232 0.525497]

                 

                It's equivalent to the following RGB values:

                 

                RGB: 163 48 134

                Hex: #A33086

                1 person found this helpful
                • 5. Re: Change Icon of sticky note based on Content
                  Document Geek Adobe Community Professional

                  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... ?

                  • 6. Re: Change Icon of sticky note based on Content
                    George_Johnson MVP & Adobe Community Professional

                    They are RGB, but expressed as values from 0 to 1 instead of 0 to 255.

                    • 7. Re: Change Icon of sticky note based on Content
                      Document Geek Adobe Community Professional

                      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[i];  
                              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[i];  
                              if (annot.type=="Text") {  
                                  if (/^Star:/.test(annot.contents)) {  
                                      annot.contents = annot.contents.replace(/^Star:/, "");  
                                      annot.noteIcon = "Star";  
                                  }  
                              }  
                          }  
                      }  
                      
                      • 8. Re: Change Icon of sticky note based on Content
                        try67 MVP & Adobe Community Professional

                        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[i];   
                                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";   
                                    }           
                                }   
                            }   
                        }   
                        
                        1 person found this helpful
                        • 9. Re: Change Icon of sticky note based on Content
                          JR_Boulay Adobe Community Professional

                          made a nice presentation of Acrobat's Comment tools yesterday.

                          Everyone should see the recording: Tech Wednesday Acrobat

                          • 10. Re: Change Icon of sticky note based on Content
                            Joel_Geraci Adobe Community Professional

                            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.

                            • 11. Re: Change Icon of sticky note based on Content
                              Document Geek Adobe Community Professional

                              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.

                              • 12. Re: Change Icon of sticky note based on Content
                                Joel_Geraci Adobe Community Professional

                                Ok - If it's only Acrobat and Reader, you're good.