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

[SCRIPT] Get multiple authors from linkXmp

Enthusiast ,
Jun 21, 2022 Jun 21, 2022

I'm trying to get the property Author from linkXmp.

This is how it shows in Links panel.

lfcorullon_0-1655849677136.png

The result is only "tanleimages".
But the expected result is "tanleimages, Elenamiv/Shutterstock" as it is showing in Links panel (or Bridge, or Photoshop). Why I can't get the correct information using "linkXmp.author"? Any idea? Thanks in advance.

TOPICS
Scripting
1.2K
Translate
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

Valorous Hero , Jun 22, 2022 Jun 22, 2022

How about this workaround?

var doc = app.activeDocument;

main();

function main() {
	var link = doc.links[0],
	linkXmp = link.linkXmp,
	arr = [],
	count = 1,
	result;
	
	while (result != "") {
		result = linkXmp.getProperty("http://purl.org/dc/elements/1.1/", "creator/*[" + count + "]");
		if (result != "") arr.push(result);
		count++;
	}
}

2022-06-22_11-23-57.png

Translate
Community Expert ,
Jun 21, 2022 Jun 21, 2022

Looks like a bug—same thing happens with the ID documnent info when there is either a comma or semicolon delimiter

 

$.writeln(app.activeDocument.metadataPreferences.author)

 

Translate
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
Enthusiast ,
Jun 21, 2022 Jun 21, 2022

Thanks for answering.

Uhmm. So this is a known issue and no solution is provided yet?

Translate
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
Community Expert ,
Jun 21, 2022 Jun 21, 2022

I couldn't find a bug documented for this so I made one. Please go here and vote for it.

- Mark

Translate
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
Mentor ,
Jun 21, 2022 Jun 21, 2022

Have a look at Links panel flyout >> Utilities >> XMP File Info ... >> Raw Data

Is there anything unusual, especially in the photoshop:Credit field? Language attribute, multiple elements?

You could also try the ExtendScript ExternalObject('lib:AdobeXMPScript') instead of the InDesign object. 

Haven't looked at it in years since I'm using an own plug-in to access metadata, but that lib should still be around in the default installation.

Translate
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
Enthusiast ,
Jun 21, 2022 Jun 21, 2022

Everything is as usual in File Info window.

lfcorullon_1-1655874192230.png

 

In Raw Data, the semicolon separated text are shown as list elements.

lfcorullon_2-1655874233944.png

 

I tried some examples I found using ExternalObject library, but no sucess.

Only a weird one, that doesn't fill my gap using something like:

xm.getProperty(XMPConst.NS_DC , "creator/*[1]") and xm.getProperty(XMPConst.NS_DC , "creator/*[2]")
But, since I don't know the number of elements, I can't get the correct result.

It's weird, because the Caption feature in InDesign, returns the full text (as shown in links panel).

Translate
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
Mentor ,
Jun 22, 2022 Jun 22, 2022
I found some old snippet, see below, if it works you could turn the result into XML() and continue from there.
xmp.serialize( XMPConst.SERIALIZE_OMIT_PACKET_WRAPPER | XMPConst.SERIALIZE_USE_COMPACT_FORMAT)
Translate
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
Valorous Hero ,
Jun 22, 2022 Jun 22, 2022

How about this workaround?

var doc = app.activeDocument;

main();

function main() {
	var link = doc.links[0],
	linkXmp = link.linkXmp,
	arr = [],
	count = 1,
	result;
	
	while (result != "") {
		result = linkXmp.getProperty("http://purl.org/dc/elements/1.1/", "creator/*[" + count + "]");
		if (result != "") arr.push(result);
		count++;
	}
}

2022-06-22_11-23-57.png

Translate
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
Enthusiast ,
Jun 22, 2022 Jun 22, 2022
LATEST

Awesome!!! Thank you so much, @Kasyan Servetsky!

Translate
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