Skip to main content
Stephen Marsh
Community Expert
Community Expert
October 14, 2025
Question

Re: Adobe Photoshop. ESTK. Copy text to system clipboard.

  • October 14, 2025
  • 0 replies
  • 38 views

Here's an example using the active document name without extension:

 

var docName = app.activeDocument.name.replace(/\.[^\.]+$/, "");
var d = new ActionDescriptor();  
d.putString(stringIDToTypeID("textData"), docName);  
executeAction(stringIDToTypeID("textToClipboard"), d, DialogModes.NO);

  

P.S.: Rather than assuming the ruler units, it's often safer to explicitly set them:

 

var w = app.activeDocument.width.as('px');
var h = app.activeDocument.height.as('px');

 

var origRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.INCHES; // Units.PIXELS etc

var w = app.activeDocument.width.value;
var h = app.activeDocument.height.value;

app.preferences.rulerUnits = origRulerUnits;