• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Cannot read "rawData" of an XMP object

New Here ,
Mar 29, 2017 Mar 29, 2017

Copy link to clipboard

Copied

I have the following (supposedly simple) JSX code that I run after creating a new blank Photoshop document:

var meta = app.activeDocument.activeLayer.xmpMetadata

$.writeln(meta.rawData)

However, for some reason, the only thing I can get out of this is an error on the second line saying "'value' property is missing". Even trying to view the object contents with the ESTK Data Browser makes it break (it cannot display more than the "parent" field, after that it shows the same error in the Data Browser itself).

However, if I try to set the `meta.rawData` field to some random string before trying to read it in any way, it works (well, I get back my own string). Obviously, this is not a valid solution, as I want to read the field before setting it to anything else.

Does anyone know if this is a bug (it certainly looks like it!) and how to workaround it?

Thanks in advance

TOPICS
Actions and scripting

Views

1.4K

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

correct answers 1 Correct answer

Contributor , Mar 29, 2017 Mar 29, 2017

Put the read into try-catch. If it throws an error the key isn't exists yet. If you set it, then write, close, reopen the .psd, the value will be there.

Votes

Translate

Translate
Adobe
Contributor ,
Mar 29, 2017 Mar 29, 2017

Copy link to clipboard

Copied

Put the read into try-catch. If it throws an error the key isn't exists yet. If you set it, then write, close, reopen the .psd, the value will be there.

Votes

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 29, 2017 Mar 29, 2017

Copy link to clipboard

Copied

Yeah, I forgot to say that this is exactly what I'm doing right now, but it still feels like a bug?

Votes

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 ,
Mar 29, 2017 Mar 29, 2017

Copy link to clipboard

Copied

Hehe, not just this seems like a bug in ToolVM DOM We have to hack our way through. I often feel myself in an abandoned sanitarium.

By the way: the generator's backdoor/brain surgery approach is seems like much more useable in many cases than pure .jsx.

Votes

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 29, 2017 Mar 29, 2017

Copy link to clipboard

Copied

Well, not sure about what Tool DOM is, but if you mean this only happens in ELTK, I get the same error (well, I assume as I only get "ExtendScript error") inside my HTML panel.

What is that generator/backdoor you mention?

Votes

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 ,
Mar 29, 2017 Mar 29, 2017

Copy link to clipboard

Copied

I call the PS Extendscript interpreter "ToolVM" and the HTML panels's v8 javascript engine "PanelVM". As I remember I saw this naming somewhere.

The backdoor is generator-core which can run from standalone nodejs or from node enabled panel. It can send .jsx snipplets via socket to PS and get back values from it with the help of Kevlar interface. It can retrieve the full document structure around 150 ms and has methods to store/retrieve custom, json data in the .psd.

Check out the

Generator.prototype.getLayerSettingsForPlugin = function (documentId, layerId, pluginId)
Generator.prototype.setLayerSettingsForPlugin = function (settings, layerId, pluginId)

methods.

Votes

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 29, 2017 Mar 29, 2017

Copy link to clipboard

Copied

LATEST

Ah, that's very interesting, thank you! And that's what I'm actually doing, storing some custom JSON on the xmpMetadata object (I know it's supposed to be XML, but Photoshop doesn't seem to care, and it's easier for me to create, plus only my external tools are going to interpret this data from the PSD itself)

I'll take a look, thanks again!

P.D. This whole ecosystem seems in a broken/undocumented/abandoned state, I really concur with your sanitarium statement of before...

Votes

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