6 Replies Latest reply on Jun 6, 2012 5:32 PM by aklyman

    XMP - Add keywords with script

    alexanderklapfer Level 1

      Hallo Forum,

       

      I would create a script to have keyword standards.

       

      In EXCEL i create a controlled namespace trougth comboboxes to save the files in an controlled way. The Metadata should be a controlled way to avoid "phantasie"-names. Having this values I would insert this strings in the XMP:KEYWORD field. In this way with the bridge I can retrive the information.

       

      xmp.string = word1, word2, word3, ...

       

      I use VBA and at the moment I have this but it doesn't work.

       

      Sub meta_add ()

      dim w1 as string

      w1 = "hallo world"

      document.xmpString.add.w1

      end sub

       

      Somebody can help me with the basic? JAVA would be welcomed too !!!

      Thank you

      Form.JPG

        • 1. Re: XMP - Add keywords with script
          Muppet Mark Level 5

          For javascript you can load the external library object for use inside your Illustrator script… I would script the adding of this data in the Bridge app… Where you can find example scripts by Paul Riggot that add keywords to metadata…

          • 2. Re: XMP - Add keywords with script
            alexanderklapfer Level 1

            Hallo, thank you for the answear.

             

            I'm looking for a skript to write a sequence of keywords inside the document field.

            First I declare a variable like (vba)

             

            dim text as string

             

            text = keyword1; keyword2; keyword [n]

            //now i would like to write the content of the variable inside the XMP:keyword field

             

            keywords.JPG

            • 3. Re: XMP - Add keywords with script
              Muppet Mark Level 5

              Then Im definatly the wrong person to ask… I use AppleScript & ExtendScript ( on a mac you see ). Like I said it is possible in AI & BR to do this but I wouldn't have a clue if VB has any XMP libraries/tools to do so… BR is pretty much ExtendScript only… Carlos may well know he does VB as well…

              • 4. Re: XMP - Add keywords with script
                moluapple Level 4

                Document's XMPString property is r/w, so simply write you keywords into. JS code:

                activeDocument.XMPString = activeDocument.XMPString.replace('         </dc:title>', '''         </dc:title>
                         <dc:subject>
                            <rdf:Bag>
                               <rdf:li>some text</rdf:li>
                               <rdf:li>keywords for me</rdf:li>
                            </rdf:Bag>
                         </dc:subject>''');
                activeDocument.save();
                

                Note: VBS has DoJavaScript function, right?

                • 5. Re: XMP - Add keywords with script
                  alexanderklapfer Level 1

                  I think that I have a problem with the synthax after (' is this right ? It doesn't work

                   

                   

                  My problem is that my macro should create a stringchain like: keyword1, keyword2, keyword5, keyword9

                   

                  The aim is a controlled namespace to avoid phantasienames and clear metadata ... may you have a suggestion how I can do this ?

                   

                  Anyway thank you and many many thanks for your reply!

                  • 6. Re: XMP - Add keywords with script
                    aklyman

                    The FileInfo SDK has a lot of useful information about creating a custom FileInfo panel (from your File Menu in most Adobe products) where you can create a custom interface for creating your own XMP data. You can get pretty involved with just the sample CustomFileInfo panel that's provided.... I went further and created a Flash SWF to use as the interface (built using Flex, Actionscript, and Ant), which included checkboxes that when selected wrote to the keyword field. Might be more than you are looking for though.

                     

                    Either way, the Custom FileInfo Panel SDK would be where I'd start.