Skip to main content
Participant
November 28, 2017
Question

Please Help "Copy to Clipboard" not recorded in Actions

  • November 28, 2017
  • 1 reply
  • 390 views

Hi There

When I try to Copy values on Canvas Size (e.g. value on Height Copied to Width or reverso so as Height = Width) then I want to repeat this "Copy" task to all remaining Opened Files using Actions, these "Copy" task is not recorded but it just Copies The first Value I Copied in the first action

Example:

Picture 1 has the Canvas Size
Height : 27 Inches
Width : 18 Inches

Picture 2 has the Canvas Size
Height : 24 Inches
Width : 10 Inches

First, I use Actions and start to record
Then, I Copy value on Height and paste it to Width on Picture 1
Then, I click Stop

The problem arise when I repeat this "Copy" task on Picture 2, the Height won't be the same as Width and the Width is the value I Copy for the first time i.e. 27 Inches

So the result is

Picture 2 has the Canvas Size
Height : 24 Inches
Width : 27 inches  (not 24 Inches)

Hope you can help me with this

Thanks before

This topic has been closed for replies.

1 reply

Stephen Marsh
Community Expert
Community Expert
November 28, 2017

This task is beyond actions or conditional actions (as you have found, actions record absolute values, there are no variables based on relative values such as canvas height, although there should be!).

I believe that this script is what you are looking for (amazing what a quick Google search can do):

// http://www.doiteasyguide.com/2014/04/photoshop-scrip-for-re-size-odd-dimention-to-square-canvas.html

var savedRuler= app.preferences.rulerUnits;

app.preferences.rulerUnits = Units.PIXELS;

var w = app.activeDocument.width;

var h = app.activeDocument.height;

if(w>h) app.activeDocument.resizeCanvas (w, w, AnchorPosition.MIDDLECENTER);

if(w<h) app.activeDocument.resizeCanvas (h, h, AnchorPosition.MIDDLECENTER);

//if w==h already square

app.preferences.rulerUnits = savedRuler;

Copy and paste these 9 lines of code into a plain text file, save with a name such as “Square Canvas Size from Longest Edge.jsx” – ensuring that the filename ends in .js or .jsx (not .txt). The script can be installed into your Presets/Scripts directory or run on an ad-hoc basis through the File > Scripts > Browse… menu option.

Prepression: Downloading and Installing Adobe Scripts