Skip to main content
TaraRebeka
Known Participant
September 30, 2024
Question

Modifying a script from PS to work in PSE

  • September 30, 2024
  • 1 reply
  • 197 views

A user wrote me a Photoshop script that adds the dimensions of a photo at 300ppi to the bottom of a printout. I haven't been able to get that script to work in Elements.

 

Here's the original Photoshop script:

/*
Add Document Dimensions & Resolution to Description Metadata of Open Document.jsx
4th May 2024, Stephen Marsh
https://community.adobe.com/t5/photoshop-ecosystem-discussions/script-to-add-image-size-to-description-field-to-include-in-printing-marks/td-p/14597499
*/

#target photoshop

// Rounded to 1 decimal place
var theDims = Math.round(activeDocument.width.as('in') * 10) / 10 + "in x " + activeDocument.height.as('in').toFixed(1) + "in @" + activeDocument.resolution + "ppi";

if (ExternalObject.AdobeXMPScript === undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var xmp = new XMPMeta(activeDocument.xmpMetadata.rawData);
xmp.deleteProperty(XMPConst.NS_DC, 'description');
xmp.setProperty(XMPConst.NS_DC, 'description', theDims);
app.activeDocument.xmpMetadata.rawData = xmp.serialize();

 

Which kicks back this error in Elements:

 

The original author recommended this modification:

// Rounded to 1 decimal place
var theDims = activeDocument.resolution + "ppi";

if (ExternalObject.AdobeXMPScript === undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
var xmp = new XMPMeta(activeDocument.xmpMetadata.rawData);
xmp.deleteProperty(XMPConst.NS_DC, 'description');
xmp.setProperty(XMPConst.NS_DC, 'description', theDims);
app.activeDocument.xmpMetadata.rawData = xmp.serialize();

 

But that hasn't worked either. 

 

I was hoping that someone more familiar with Elements might be able to point me in the right direction.

 

Thanks!

This topic has been closed for replies.

1 reply

Glenn 8675309
Legend
October 1, 2024

You may find elements plus helpful in this case:
If you purchase elements plus make sure you purchasee the correct version.

https://elementsplus.net/help/en/macros.htm


This may be of help as well:

https://photoshopelementsandmore.com/thread/5831/running-scripts-pse-needing-add