Skip to main content
Participating Frequently
March 8, 2019
Question

CS6 to CC2019, Javascripts no longer work

  • March 8, 2019
  • 2 replies
  • 491 views

Greetings,

Just upgraded from CS6 Photoshop to CC2019. Javascripts that worked in CS6 PhotoShop does not work in CC2019 Photoshop. What changed in CC2019? Any suggestions how to fix this script?

Thx

Duane

JavaScript code:

/* A Script to Resize the width of an image to a fixed size while proportionately changing the height holding a specified image dpi.*/

// Revised 01/25/2010

// This script is supplied as is. It is provided as freeware.
// The author accepts no liability for any problems arising from their use.
// Report any problems or other comments to the email address given above.

// Set the ruler units to PIXELS
var orig_ruler_units = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;

// Initialize the user defined variables
// The user can enter their own values in the next two variables.
// Both new_height and new_width is set the same so the longest side (height or width) never exceeds the highest number (7.00). For example, a 5.00 inch x <= 7.00 image size will never have its longest side exceed 7.00 inches.
var new_height  = 2100;
var dpi   = 300;

// Initialise the fixed variables
var doc = app.activeDocument;
var width = doc.width.value;
var height = doc.height.value;
var new_width

new_width = (width*new_height) / height;

/* Resize the image. You can experiment with different sharpening algorithms by adding SMOOTHER or SHARPER
to the ResampleMethod.BICUBIC statement. This is for resizing smaller or larger where the different
sharpening types may have better results with one or the other setting.*/

   if (new_height > height) {
      doc.resizeImage(new_width, new_height, dpi,
          ResampleMethod.BICUBICSMOOTHER);
   } else {
      doc.resizeImage(new_width, new_height, dpi,
          ResampleMethod.BICUBICSHARPER);
   }
  
// Variable reset
var width = null
var height = null

// Initialise the fixed variables
var width = doc.width.value;
var height = doc.height.value;
var new_width = 2100;
var new_height

new_height = (height*new_width) / width;

if (width > new_width) {
  doc.resizeImage(new_width, new_height, dpi, ResampleMethod.BICUBICSHARPER);
  }

// Remove all paths.
doc.pathItems.removeAll()

// Final clean-up - set units back to original photo units.
app.preferences.rulerUnits = orig_ruler_units;
var doc = null

This topic has been closed for replies.

2 replies

Chuck Uebele
Braniac
March 8, 2019

There was a change to a new framework, and some features don't work, as Flash was dropped, but for the most part most old scripts work fine with 2019 PS.

DewScriptAuthor
Participating Frequently
March 11, 2019

Thank you… I will do some more testing.

Duane Huberty

Confidentiality Note: This e-mail contains privileged and confidential information intended for the use of the addressees named above. If you are not the intended recipient of this e-mail, you are hereby notified that you must not disseminate, copy or take any action in respect of any information contained in it. If you have received this e-mail in error, please notify the sender immediately by e-mail and immediately destroy this email and its attachments.

JJMack
Braniac
March 11, 2019

You were asked "How did you determine that "does not work in CC2019"?

Can you please answer that question?  It works without issue on Windows 10 machine using CC 2019 on a 8"x10" 600DPI document I tested it on.

JJMack
Braniac
March 8, 2019

How did you determine that "does not work in CC2019"?

How is it shown?

JJMack
Braniac
March 8, 2019

Seem to work on my Windows 10 CC 2019

JJMack