HI, please help me with a small script to add my artboard name and width to xmp metadata?

New Here ,
Mar 30, 2021 Mar 30, 2021

Copy link to clipboard

Copied

please help me to add my artboard name and artboard width in custome names space metadata.

i have a sample format 

<Sigma:Artwork>
                     <rdf:Seq>
                        <rdf:li rdf:parseType="Resource">
                           <Artboard:Name>001</Artboard:Name>
                           <Artboard:Width>90 MM</Artboard:Width>
                        </rdf:li>
                       <rdf:li rdf:parseType="Resource">
                           <Artboard:Name>002</Artboard:Name>
                           <Artboard:Width>100 MM</Artboard:Width>
                        </rdf:li>
                     </rdf:Seq>
                  </Sigma:Artwork>
TOPICS
How to, Scripting

Views

89

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 30, 2021 Mar 30, 2021

Copy link to clipboard

Copied

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 30, 2021 Mar 30, 2021

Copy link to clipboard

Copied

Hi, thank you very much for your quick response,

I tried as per the link which you shared, it's working, but it's creating a simple property, i would like to have like a container data

I am new to scripting, I tried the below code :

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function loadXMPLibrary(){
    if ( !ExternalObject.AdobeXMPScript ){
        try{ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');}
        catch (e){alert('Unable to load the AdobeXMPScript library!'); return false;}
    }
    return true;
}
var myFile =app.activeDocument.fullName
if(loadXMPLibrary() && myFile != null){
    xmpFile = new XMPFile(myFile.fsNameXMPConst.FILE_INDESIGNXMPConst.OPEN_FOR_UPDATE);
    var myXmp = xmpFile.getXMP();
}
if(myXmp){
    var SGNS = "///sigmaArtworks"
    XMPMeta.registerNamespace(SGNS,"Sigma");
myXmp.setProperty("///sigmaArtworks""Artwork",""XMPConst.PROP_IS_STRUCT);
myXmp.setStructField("///sigmaArtworks""Artwork"XMPConst.TYPE_DIMENSIONS"ArtBoardID"1);
myXmp.setStructField("///sigmaArtworks""Artwork"XMPConst.TYPE_DIMENSIONS"ArtBoardName""Front Label");
 (xmpFile.canPutXMP(myXmp)){xmpFile.putXMP(myXmp);}else{alert("Error storing XMP");}
    xmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
and i am getting the below
 
         <Sigma:Artwork rdf:parseType="Resource">
            <stDim:ArtBoardID>1</stDim:ArtBoardID>
            <stDim:ArtBoardName>Front Label</stDim:ArtBoardName>
         </Sigma:Artwork>
 
please help me to structure it like
 
<Sigma:Artwork>
       <rdf:Seq>
                        <rdf:li rdf:parseType="Resource">
                           <Artboard:Name>001</Artboard:Name>
                           <Artboard:Width>90 MM</Artboard:Width>
                        </rdf:li>
                        <rdf:li rdf:parseType="Resource">
                           <Artboard:Name>002</Artboard:Name>
                           <Artboard:Width>100 MM</Artboard:Width>
                        </rdf:li>
       </rdf:Seq>
 </Sigma:Artwork>

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines