Skip to main content
Zesty_wanderlust15A7
Known Participant
June 8, 2022
Answered

Simplest way for a script to give me just the ISO number?

  • June 8, 2022
  • 2 replies
  • 331 views

I'd like to be able to run actions in PS based on the ISO number (I know you can do ISO-based processing in Lr — not my goal here).

I know how to run the actions from a script, but not how to get the ISO number...

Doing my homework, I found a handful of threads. Several look daunting, and the few simple ones don't work or are too old...

Who knows the simplest way to just get the ISO number, please? 🙂

Correct answer jazz-y
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
var iso = 0
try {
    var xmp = new XMPMeta(app.activeDocument.xmpMetadata.rawData);
    iso = xmp.iterator(XMPConst.ITERATOR_JUST_LEAFNODES, XMPConst.NS_EXIF, "ISOSpeedRatings").next().value
} catch (e) { }
alert(iso)

2 replies

jazz-yCorrect answer
Legend
June 8, 2022
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
var iso = 0
try {
    var xmp = new XMPMeta(app.activeDocument.xmpMetadata.rawData);
    iso = xmp.iterator(XMPConst.ITERATOR_JUST_LEAFNODES, XMPConst.NS_EXIF, "ISOSpeedRatings").next().value
} catch (e) { }
alert(iso)
Zesty_wanderlust15A7
Known Participant
June 8, 2022

Impressively excellent! Thanks so much, jazz-y 🙂

Stephen Marsh
Community Expert
Community Expert
June 8, 2022

So now you need a conditional framework to run the appropriate action, right? If ISO speed = 200 play action XYZ etc.

Zesty_wanderlust15A7
Known Participant
June 8, 2022

Example of a simple one that doesn't give me anything... (I'm running it in PS with a pic that does have all the raw settings)...
https://community.adobe.com/t5/photoshop-ecosystem-discussions/help-with-script-to-read-specific-xmp-metadata-in-an-image/m-p/9859271#M169876

Even if it would work, how do I pry out just the ISO number?

-----

Another kinda related one that complains about a missing function...
https://community.adobe.com/t5/photoshop-ecosystem-discussions/setting-xmp-isospeedratings-property/m-p/4275521#M460219