Skip to main content
Known Participant
November 10, 2021
Question

Script access to a Windows file's metadata

  • November 10, 2021
  • 4 replies
  • 1375 views

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?]

This topic has been closed for replies.

4 replies

Peter Kahrel
Community Expert
Community Expert
November 15, 2021

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

 

mydoc.metadataPreferences.createContainerItem
mydoc.metadataPreferences.setProperty

etc.

Known Participant
November 15, 2021

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.

 

Known Participant
November 23, 2021

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?

Community Expert
November 15, 2021

Hi Andover Beacon,

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

 

 

Regards,
Uwe Laubender

( ACP )

Community Expert
November 10, 2021

Hi Andover Beacon,

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

 

Regards,
Uwe Laubender

( ACP )

Known Participant
November 10, 2021

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

brian_p_dts
Community Expert
Community Expert
November 10, 2021

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. 

Known Participant
November 10, 2021

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!

brian_p_dts
Community Expert
Community Expert
November 10, 2021
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.