• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Mojave breaks Photoshop resize script

Community Beginner ,
Nov 21, 2018 Nov 21, 2018

Copy link to clipboard

Copied

A resize script of mine seized to work in photoshop after upgrading to Mac os x Mojave. A simple line like this no longer works for me:

tell application "Adobe Photoshop CC 2018"

  resize image current document width 20 as percent height 20 as percent resolution 300

end tell

The script complains that it cannot change 20 to type/class percent (roughly translated from swedish).

I'm running mojave with Swedish as default language. Can someone check if the problem arises in english setups as well? And if so: Does anyone have a workaround?

Kindly

Tomas Backelin, Stockholm Sweden

TOPICS
Actions and scripting

Views

1.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Advocate ,
Nov 21, 2018 Nov 21, 2018

Copy link to clipboard

Copied

You can post the script so let's see what's wrong.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 21, 2018 Nov 21, 2018

Copy link to clipboard

Copied

You'll need to post the script, but I have a hunch you may have been using default rulers. So you can reset them like this:

var strtRulerUnits = app.preferences.rulerUnits;

var strtTypeUnits = app.preferences.typeUnits;

app.preferences.rulerUnits = Units.PIXELS;

app.preferences.typeUnits = TypeUnits.PIXELS;

The set arguments are:

Screen Shot 2018-11-21 at 10.56.23.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 21, 2018 Nov 21, 2018

Copy link to clipboard

Copied

Thanks, varDale. I'll try your suggestion on the mojave machine as soon as possible (work machine, I'm home today). I hesitate to post the entire script since it's a complete spaghetti mess. The three applescript lines included in the question fail as well. So no need for entire script, right?

/T

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 21, 2018 Nov 21, 2018

Copy link to clipboard

Copied

VarDale, a colleague of mine tried your suggestion with the original script as well as the short version included in my original post. Problem persists in both scripts.

Both scripts works in High Sierra (with swedish as default language). Neither in Mojave. Does the code below work in an english Mojave environment?

tell application "Adobe Photoshop CC 2018"

  resize image current document width 20 as percent height 20 as percent resolution 300

end tell

/T

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Nov 22, 2018 Nov 22, 2018

Copy link to clipboard

Copied

From where do you call the script?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 22, 2018 Nov 22, 2018

Copy link to clipboard

Copied

The short one from script editor, just to try it out. The original script is launched through keyboard maestro. It scans an indesign document, opening the images in photshop, resizing/scaling them to 100 percent (the actual size in indesign) in 300 dpi, saves to a new file and replaces the old images in indesign  Saves lots of hours every week.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Nov 22, 2018 Nov 22, 2018

Copy link to clipboard

Copied

I do not know if I understand correctly

you would like to reduce the document by 20%

dpi resolutions at 300

if so, try this

if(documents.length) activeDocument.resizeImage

(new UnitValue(80,'%'),

new UnitValue(80,'%'),

activeDocument.resizeImage(undefined, undefined, 300 *1, ResampleMethod.NONE));

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 22, 2018 Nov 22, 2018

Copy link to clipboard

Copied

Sorry Geppeto, I've been somewhat unclear. I hardcoded a size (20) in the short script so someone could try if the script works in an english environment (the original script gets the size from indesign). The script seized to work after upgrading to Mojave, although the script calls the same application/dictionary (adobe photoshop cc 2018) and therefor – to my knowledge – should use/understand the same terminology.

My first question is: does the code provided work as expected outside of sweden? (no answer to that question yet).

If so the problem lies at my end. However if it fails for you as well, my second question is: can someone explain why and maybe supply a solution?

Thank you for your patience

Tomas

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 10, 2019 Jan 10, 2019

Copy link to clipboard

Copied

Hi Tomas, I do have the same problem with an Applescript and the resize command (French setup).

In my Applescript :

resize image width thePercent as percent

gives this error :

error "Impossible de convertir 212 en type percent." number -1700 from 212 to «class ÅPNå»

The problem seems to come with the "percent", so maybe the solution is to use javascript for this command.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 10, 2019 Jan 10, 2019

Copy link to clipboard

Copied

LATEST

Ok, if you change the ruler to percent, then resize your image without specifying the unit, it works :

tell application id "com.adobe.Photoshop"

  set OldRuler to ruler units of settings

  set ruler units of settings to percent units

  tell document 1

  resize image width thePercent

  end tell

  set ruler units of settings to OldRuler

end tell

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines