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

Switching Sample Layers with shortcut key for Clone and Heal tool?

Explorer ,
Mar 10, 2020 Mar 10, 2020

Copy link to clipboard

Copied

Hello,

 

I'm looking to apply a short cut key that would toggle brush options to sample between the "Current Layer, Current & Below and All Layers" options when using clone stamp or heal stamps tools.

 

Is this optional?

 

Thanks in advance.

Views

1.5K

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 2 Correct answers

People's Champ , Mar 10, 2020 Mar 10, 2020
Here is the script. Assign a hotkey to it (to them).

Remove the first lines of code to force selecting the healing brush.

 

Votes

Translate

Translate
People's Champ , Mar 13, 2020 Mar 13, 2020

OK ))

try
    {
    var r = new ActionReference();
    r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));
    r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));

    var ret = executeActionGet(r);

    var options = ret.getObjectValue(stringIDToTypeID("currentToolOptions"));           
    var tool = ret.getEnumerationType(stringIDToTypeID("tool"));

    var s = options.getBoolean(charIDToTypeID("StmS"));
    var b =
...

Votes

Translate

Translate
Adobe
People's Champ ,
Mar 10, 2020 Mar 10, 2020

Copy link to clipboard

Copied

Here is the script. Assign a hotkey to it (to them).

Remove the first lines of code to force selecting the healing brush.

 

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
Explorer ,
Mar 13, 2020 Mar 13, 2020

Copy link to clipboard

Copied

Thank you, r-bin!

 

How may I correctly write an "if" statement in the script to toggle between these 2 actions using the same hotkey?

 

// Current layer

options.putBoolean(charIDToTypeID("StmS"), false);

options.putBoolean(charIDToTypeID("StmB"), false);

 

// Current & below

options.putBoolean(charIDToTypeID("StmS"), true);

options.putBoolean(charIDToTypeID("StmB"), true);

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
People's Champ ,
Mar 13, 2020 Mar 13, 2020

Copy link to clipboard

Copied

OK ))

try
    {
    var r = new ActionReference();
    r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));
    r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));

    var ret = executeActionGet(r);

    var options = ret.getObjectValue(stringIDToTypeID("currentToolOptions"));           
    var tool = ret.getEnumerationType(stringIDToTypeID("tool"));

    var s = options.getBoolean(charIDToTypeID("StmS"));
    var b = options.getBoolean(charIDToTypeID("StmB"));

    if (s && b)
        {
        options.putBoolean(charIDToTypeID("StmS"), false);
        options.putBoolean(charIDToTypeID("StmB"), false);
        }
    else
        {
        options.putBoolean(charIDToTypeID("StmS"), true);
        options.putBoolean(charIDToTypeID("StmB"), true);
        }

    var r = new ActionReference();
    r.putClass(tool);

    var d = new ActionDescriptor();
    d.putReference(stringIDToTypeID("null"), r);
    d.putObject(stringIDToTypeID("to"), stringIDToTypeID("null"), options);

    executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
    }
catch (e) { /*alert(e)*/  }

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
Explorer ,
Mar 13, 2020 Mar 13, 2020

Copy link to clipboard

Copied

Very helpful, much appreciated!

 

Thanks again r-bin.

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
New Here ,
Jan 30, 2021 Jan 30, 2021

Copy link to clipboard

Copied

hi all, may i know how to apply this script to get this short cut? i really need this to speed up my editing. thanks you very much for the efford!

 

Mango

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 ,
Jan 28, 2022 Jan 28, 2022

Copy link to clipboard

Copied

LATEST

After you added the script it appears in the keyboard shortcuts option under 'Scripts'. Here you can assign the shortcut

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