Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Script access to a Windows file's metadata

Explorer ,
Nov 10, 2021 Nov 10, 2021

Copy link to clipboard

Copied

Background: If you right-click on any Windows file and then click "Properties," you can see a variety of metadata about the file ... basic stuff like Created, Modified, and Accessed dates, as well as file-type-specific stuff like XMP data for images.

 

Ignoring the XMP stuff for the moment, because that's well covered elsewhere and I'm not working with images, my question is this:

 

Is there any way in InDesign ExtendScript to read all the (non-XMP) metadata or "Properties" for a Windows file? 

 

@Marc Autret: Is this something IdExtenso can do? Would something like this help?

 

[If you're curious as to why this is important: Google Drive For Desktop, which replaces Google Backup and Sync, no longer stores the URL of the cloud resource in the readable file content of the "synced" local file. So my InDesign script that harvests content from hundreds of synced Google Docs files every month is suddenly useless! I figure the URL has to be in that local file somewhere ... if it's not in the easily readable file content, it must be in the file metadata, right?]

TOPICS
How to, Scripting

Views

232

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 ,
Nov 10, 2021 Nov 10, 2021

Copy link to clipboard

Copied

PC or Mac? You could probably pass the file path to a VB (PC) or Applescript (Mac) function/script that attempts to figure that out. Something like this in VB: https://www.vbsedit.com/scripts/storage/files/scr_1551.asp

 

No idea if the URL would be made available though. 

 

The File object within Extendscript is quite limited. 

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
Explorer ,
Nov 10, 2021 Nov 10, 2021

Copy link to clipboard

Copied

Great, thanks! I've done some research, and I think I know how to move forward in the direction you suggest: my JS script uses DoScript to call a VB script that examines a file object in a way that JS can't. Right?

 

The only thing I haven't been able to find is a clear example of how, in VB, to discover all the properties of a file object (because I'm hoping that there are actually more properties than what's listed here). Can you point me to a good example of iterating through the properties of a file object (or similar) without knowing in advance what those properties are?

 

Thanks!

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 ,
Nov 10, 2021 Nov 10, 2021

Copy link to clipboard

Copied

quote

Great, thanks! I've done some research, and I think I know how to move forward in the direction you suggest: my JS script uses DoScript to call a VB script that examines a file object in a way that JS can't. Right?

 

That's right.

quote

The only thing I haven't been able to find is a clear example of how, in VB, to discover all the properties of a file object (because I'm hoping that there are actually more properties than what's listed here). Can you point me to a good example of iterating through the properties of a file object (or similar) without knowing in advance what those properties are?

 

I don't step out of Extendscript often enough to be able to tell you. Your instinct to look there was right. It's very possible that what you want to know is not knowable, or that you would need to do some kind of Google Apps scripting to impart that data into a readable fashion into the exported file (or look into Google with the filename to try to find what you're looking for). Good luck. 

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 ,
Nov 10, 2021 Nov 10, 2021

Copy link to clipboard

Copied

Hi Andover Beacon,

just out of curiosity:
Are you able to read out the metadata with Adobe Bridge?

 

Regards,
Uwe Laubender

( ACP )

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
Explorer ,
Nov 10, 2021 Nov 10, 2021

Copy link to clipboard

Copied

Thanks for the suggestion, Uwe. We don't use Bridge, but now it appears I've got a reason to check it out. I'll report back ...

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
Explorer ,
Nov 12, 2021 Nov 12, 2021

Copy link to clipboard

Copied

I've checked out Bridge, and it appears to only expose the metadata that Windows exposes in its Properties pop-up.

 

Based on the evidence from Windows File Explorer, from Bridge, and from FileAlyzer (the most advanced file analysis tool I've found), I'm starting to think that one of two things is true:

 

1) There are "secret" types of metadata that I haven't been able to reveal yet, but that Google uses to conceal the URL to the synced file on Google Drive, or

 

2) There's some other way ... not "data," not "metadata" ... of storing information in a file. Something exotic involving C++, direct hard drive reads, or such weirdness.

 

I'm open to any further suggestions, as at this point I'm stumped, and Google has taken a big bite out of the benefits I've enjoyed from my huge InDesign script!

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 ,
Nov 14, 2021 Nov 14, 2021

Copy link to clipboard

Copied

Hi Andover Beacon,

maybe it's something like the "invisible" .dropbox.cache directory?

 

Dropboc-Cache-Invisible.PNG

 

Regards,
Uwe Laubender

( ACP )

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 ,
Nov 15, 2021 Nov 15, 2021

Copy link to clipboard

Copied

You can look into the metadataPreferences property, e.g.

 

mydoc.metadataPreferences.createContainerItem
mydoc.metadataPreferences.setProperty

etc.

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
Explorer ,
Nov 15, 2021 Nov 15, 2021

Copy link to clipboard

Copied

Excellent suggestion, Peter ... thank you! I'll look into it.

 

Investigation led me to this interesting thread which opened my eyes to a possibility I hadn't considered: the URL I seek could be in the XMP data, just not in the standard XMP data ... it could be in a custom XMP field. Occam's Razor suggests that that's a much stronger possibility than something new, esoteric, and unique to Google.

 

I share the original poster's frustration that custom XMP fields are not easily discoverable, but @_xbytor_ mentions this:

 

XMPIterator object: Created by a call to XMPMeta.iterator(). Walks recursively through the properties and qualifiers of an XMPMeta object, and returns them as XMPProperty objects.

 

Subsequent posts don't follow up on that thought, but as I'm in "no stone unturned" mode, I have to look into it. I'll report back.

 

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
Explorer ,
Nov 22, 2021 Nov 22, 2021

Copy link to clipboard

Copied

I'm trying to pursue the XMP possibilities mentioned above, but I'm thwarted by a simple(?) coding problem:

new ExternalObject("lib:C:/\Users/\Beacon/\Desktop/\AdobeXMPScript.dll");

That line always returns "I/O Error" no matter which of the several copies of AdobeXMPScript.dll (one in InDesign 2022, one in Photoshop, etc) I try to open. 

 

I've pursued the leads offered here, but with no success, and there appears to be little else anywhere on the web that might explain the problem.

 

Can anyone help me load that 64-bit library so I can start digging into the XMP structures?

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 ,
Nov 22, 2021 Nov 22, 2021

Copy link to clipboard

Copied

Hi @Andover Beacon,

The path looks odd to me. \ is used for escaping and you have \before the path characters and not the path seperator. So try the following

new ExternalObject("lib:C:\\Users\\Beacon\\Desktop\\AdobeXMPScript.dll");

Or better don't use escaping at all, and use the forward slash

new ExternalObject("lib:C:/Users/Beacon/Desktop/AdobeXMPScript.dll");

-Manan

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
Explorer ,
Nov 23, 2021 Nov 23, 2021

Copy link to clipboard

Copied

I agree that it looks very odd. I've tried both alternatives that you suggest, and neither one changes the symptom. Everything leads to I/O Error. Very puzzling!

 

Here's a new test that I think proves that the problem lies in ExtendScript, not in anything fundamental about the file itself:

var myFile = File("C:/Users/Beacon/Desktop/AdobeXMPScript.dll"); 
myFile.open("r") ;
var x = myFile.read();
myFile.close();
$.writeln(x.length);

 

This test works just as you'd expect, displaying the length in bytes of the file, with no error messages. So what's up with ExtendScript throwing an I/O error on a file that's perfectly readable? My guess is that ES doesn't really see an I/O error ... but what does it see? And why?

 

Charlie

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
Guide ,
Nov 23, 2021 Nov 23, 2021

Copy link to clipboard

Copied

LATEST

Could be the typical security circus. Have a look at system log, virus scanner log etc.

 

Also try to load that dll from a location where it was originally installed – especially XMPScript should do without a path - when you Google for it, you'll usually get

new ExternalObject('lib:AdobeXMPScript')

 

Some more options mentioned here:

https://extendscript.docsforadobe.dev/integrating-external-libraries/externalobject-object.html

 

ExternalObject.search("lib:AdobeXMPScript")
Result: /c/Program%20Files/Adobe/Adobe%20InDesign%202020/AdobeXMPScript.dll

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