Reading XMPMeta errors with Value...

Contributor ,
Jun 06, 2022 Jun 06, 2022

Copy link to clipboard

Copied

Hey

A bit lost here :- ) Trying to load xmp data from layer object, the layer may NOT be selected at the time... I don't want to select it... Maybe I need to select it... ?

 

 

        var xmp = new XMPMeta(workingLayer.xmpMetadata.rawData);

 

Returns with 

 

Error: 'value' property is missing.

 

I had it working 1 time, then after that always breaks, no matter what. Feels like something does not load in time or something?

How can I bite it?

Thanks

 

TOPICS
Actions and scripting

Views

52

Likes

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 ,
Jun 08, 2022 Jun 08, 2022

Copy link to clipboard

Copied

You are getting this error because the xmpMetadata of the layer you are referencing does not contain any data.

 

How do you define workingLayer? If no layer is selected in the palette, then activeLayer returns the topmost layer object. If you use the access to the layer through the layers or artLayers collection (that is, specify the index of a particular layer), then this problem does not arise.

 

for example:

 

try{var a = activeDocument.artLayers[0], d = a.xmpMetadata.rawData} catch (e) {}
alert (a + '\n' +( d ? d : 'No data'))

 

Likes

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
Contributor ,
Jun 08, 2022 Jun 08, 2022

Copy link to clipboard

Copied

LATEST

Hey

 

This is how I made that object

 

for(int x=0;x<activeDocument.layers.length;++x){

var workingDocument = activeDocument.layers[x]

}

The layer is not active during the action.

In either case since the xml data is just string... I ended up doing string loop/split/filter manually.

Its odd that xmp was not able to read the data by itself. Weird stuff.

Likes

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