CS6 to CC2019, Javascripts no longer work
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
