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

Script To Deselect Invert Within Color Range - Photoshop

Guest
Dec 21, 2016 Dec 21, 2016

Copy link to clipboard

Copied

The script below does a simple function.  Selects the RGB channel, loads color range (the type of selection does not matter) but most importantly, deselects Invert.  Then simply closes Color Range and deselects the selection made.  Problem is, this script works in Photoshop versions through CS6 although does not work in any version of Photoshop Creative Cloud?  Why is that and what needs to be changed?  The call to false in step2 is what deselects Invert.  If someone can help out with getting this to work on CC versions that would be immensely appreciated!  Can't seem to figure out why it doesn't?  I also tried an Action, converted the Action to XML and added the call to false then saved again as an Action.  This also doesn't work?

cTID = function(s) { return app.charIDToTypeID(s); };

sTID = function(s) { return app.stringIDToTypeID(s); };

//

//==================== Repair-Solid-Channels-Script ==============

//

function Repair_Solid_Channels_Script() {

  // Select

  function step1(enabled, withDialog) {

    if (enabled != undefined && !enabled)

      return;

    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);

    var desc1 = new ActionDescriptor();

    var ref1 = new ActionReference();

    ref1.putEnumerated(cTID('Chnl'), cTID('Chnl'), sTID("RGB"));

    desc1.putReference(cTID('null'), ref1);

    executeAction(cTID('slct'), desc1, dialogMode);

  };

  // Color Range

  function step2(enabled, withDialog) {

    if (enabled != undefined && !enabled)

      return;

    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);

    var desc1 = new ActionDescriptor();

    desc1.putEnumerated(cTID('Clrs'), cTID('Clrs'), cTID('Mdtn'));

    desc1.putInteger(sTID("midtonesFuzziness"), 40);

    desc1.putInteger(sTID("midtonesLowerLimit"), 105);

    desc1.putInteger(sTID("midtonesUpperLimit"), 150);

    desc1.putBoolean(cTID('Invr'), false);

    desc1.putInteger(sTID("colorModel"), 0);

    executeAction(sTID('colorRange'), desc1, dialogMode);

  };

  // Set

  function step3(enabled, withDialog) {

    if (enabled != undefined && !enabled)

      return;

    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);

    var desc1 = new ActionDescriptor();

    var ref1 = new ActionReference();

    ref1.putProperty(cTID('Chnl'), sTID("selection"));

    desc1.putReference(cTID('null'), ref1);

    desc1.putEnumerated(cTID('T   '), cTID('Ordn'), cTID('None'));

    executeAction(cTID('setd'), desc1, dialogMode);

  };

  step1();      // Select

  step2();      // Color Range

  step3();      // Set

};

Repair_Solid_Channels_Script.main = function () {

  Repair_Solid_Channels_Script();

};

Repair_Solid_Channels_Script.main();

TOPICS
Actions and scripting

Views

1.2K

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

correct answers 1 Correct answer

Deleted User
Dec 25, 2016 Dec 25, 2016

Thank you for your replies as I appreciate them.  I found it odd a script could not change the Invert function of Color Range as a script can make changes to most other UI variables.  Anyhow, I was able to write a simple automation plugin which can do it.

Votes

Translate

Translate
Adobe
Community Expert ,
Dec 21, 2016 Dec 21, 2016

Copy link to clipboard

Copied

It looks like you have a script that was created by using xtools  action file to javascript. Does the action work in creative cloud photoshop

JJMack

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
Guest
Dec 22, 2016 Dec 22, 2016

Copy link to clipboard

Copied

No, the action does not work.  In fact, the Without Invert function of Color Range is not actionable and can't be recorded.  The action must be written with the Invert Box checked.  Then the action is modified as an XML file to change Invert to Without Invert by simply changing True to False.  The XML is then converted back to an Action.

 

The action does work in CS6, the script does too.  Although not within any CC version.

 

The action can be downloaded here:

Reset Invert Color Range.zip

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 Expert ,
Dec 22, 2016 Dec 22, 2016

Copy link to clipboard

Copied

I downloaded the action while the expanded action steps look different in CS6 and CC2017 actions palettes. They actually work the same way in CS6 and CC 2017 to do nothing but insure the RGB Channel is targeted. In CS6 and in CC 2017 the action targets the RGB Channel in step 1.  Step 2 Select a Color Range and step 3 deselects the selection set in step 2.  I single stepped the action in CS6 and in CC 2017 captured the Photoshop screen before and after each step including the Action Palette and I also captured the color range selection made in CS6 and CC 2017 that were never used or saved.  The Action basically make the RGB channel the current target. Here is what a see.

CS6 action single step sequence

CS6.jpg

CS6 Color Range selection

cs6selection.jpg

CC2017 action single step sequence

CC2017.jpg

CC2017 Color Range selection

CC2017Selection.jpg

JJMack

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
Guest
Dec 22, 2016 Dec 22, 2016

Copy link to clipboard

Copied

This action doesn't really do anything.  The criteria of the selection it makes is of no use or consequence.  All it does is unchecks the Invert box of Color Range if the invert box happens to be checked.

For example do this....... with CS6, open an RGB image.  Now go to Select > Color Range and make any type of selection and make sure to check the invert box.  Click OK

Now if you open Color Range again, you'll see the Invert Box remained checked.

Close Color Range and with the image still open, run my action.  After that, open Color Range again.  You'll now see the Invert box is no longer checked as the action shut it off.  The script will do so as well.

Now try the same thing using any version of Photoshop Creative Cloud.  The action does not deselect the Invert check box..

That is the problem.

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 Expert ,
Dec 22, 2016 Dec 22, 2016

Copy link to clipboard

Copied

So you know the action works correctly in CS6 and in CC 2017.   However Photoshop UI behaves differently in CC versions of Photoshop then in version CS6 and prior versions of Photoshop.

In cs6  and prior version Photoshop remembers the invert setting used in an automated process or manual use of Color range. In Creative Cloud versions of Photoshop you see Photoshop only remembers the last setting the users actually set in the UI. An automated process setting is not remembered.

You consider this to be a problems others may feel Creative cloud version of Photoshop are finally remembering what users set.

The Action and Script work correctly.  However Photoshop UI behavior has changed. Automated processes are not actually using Photoshop UI unless they have steps the display Photoshop UI dialogs.  Why should what they do change  a UI setting that a user did not make themselves, when the automated process did not use Photoshop UI in its process.

A Photoshop problem has been fixed. This is a good thing....

JJMack

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
Guest
Dec 22, 2016 Dec 22, 2016

Copy link to clipboard

Copied

No, it doesn't work in CC 2017 as it does not shut Invert within Color Range is selected.

The action and or script's function is to turn off Invert within Color Range IF selected.  Simple as that.  There's no reason a JavaScript can't do this.  Possibly I'll write an automation plugin to see if that can.  Although not a difficult plugin to write, its a major ordeal to integrate that with my installers that search for PS versions back to CS2.  It's much easier to get a simple script working.

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 Expert ,
Dec 22, 2016 Dec 22, 2016

Copy link to clipboard

Copied

Why should a script that does not use a Photoshop UI be able to change a UI option.  The Action or script is not using a Photoshop feature to set a UI option or a Photoshop preference.  The script targets the RGB channel, sets  a color range  selection and deselect that selection. It dose that in all version of Photoshop Photoshop.  And the color range selection is the same in all versions of Photoshop.  The steps results are identical in all versions of Photoshop.  The steps Select RGB, Select Color Range and Deselect are performed by Photoshop like the were recorded.   The script does not display the Color Range Dialog to allow the user to change  the dialog setting. Photoshop performs the Color Range selection the way the action sep was recorded without invert.   The Action will no longer change A UI setting the user made in the Adobe Color Range UI interface on the user. The users setting will be preserved. That fixes the a bug Prior version of Photoshop had.  What Photoshop did in the past was a bug.  The script is working like the steps were recorded. The is no step set Color Range UI option without invert.  The step is Set Color Range and it is done like the step was recorded without Invert.

JJMack

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
Guest
Dec 25, 2016 Dec 25, 2016

Copy link to clipboard

Copied

Thank you for your replies as I appreciate them.  I found it odd a script could not change the Invert function of Color Range as a script can make changes to most other UI variables.  Anyhow, I was able to write a simple automation plugin which can do it.

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
LEGEND ,
Jul 08, 2021 Jul 08, 2021

Copy link to clipboard

Copied

LATEST

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