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

[SCRIPT] Get multiple authors from linkXmp

Enthusiast ,
Jun 21, 2022 Jun 21, 2022

Copy link to clipboard

Copied

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

Views

671

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

Guru , 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

Votes

Translate

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

Copy link to clipboard

Copied

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)

 

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

Copy link to clipboard

Copied

Thanks for answering.

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

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

Copy link to clipboard

Copied

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

- Mark

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

Copy link to clipboard

Copied

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.

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

Copy link to clipboard

Copied

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).

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
Guide ,
Jun 22, 2022 Jun 22, 2022

Copy link to clipboard

Copied

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)

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
Guru ,
Jun 22, 2022 Jun 22, 2022

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

LATEST

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

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