Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Need a proper shortcut for "Add a layer mask"

Community Beginner ,
Jun 30, 2021 Jun 30, 2021

Copy link to clipboard

Copied

I would like to add a keyboard shorcut that does exactly what the button at the bottom of the layer panel does. That is to Reveal All or Reveal Selected depending if something is selected.

I know I can set a shortcut for "reveal all" and then have to create another for "reveal selected" but a single shortcut to do what the button in the panel does would help keep the flow.

 

Thank you

TOPICS
Feature request, How to, Windows

Views

192

Likes

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 Community Professional ,
Jun 30, 2021 Jun 30, 2021

Copy link to clipboard

Copied

image.png

JJMack

Likes

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 Community Professional ,
Jun 30, 2021 Jun 30, 2021

Copy link to clipboard

Copied

Sorry, I misunderstood the question…

 

Likes

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 Community Professional ,
Jun 30, 2021 Jun 30, 2021

Copy link to clipboard

Copied

I agree with JJMack, simply create an action set and add a separate action for each...

 

reveal-hide-selection-mask.png

 

Hold down option/alt key when recording the hide step. Or simply use the insert menu command to insert each menu item rather than recording.

 

You can then assign a keyboard F-key shortcut to each action by double-clicking each action and assigning the function key and or keyboard modifier. EDIT: See the new post below for a visual.

 

All that being said, function key shortcuts are not that great.

 

With a bit more work, it is possible to use "regular" custom keyboard shortcuts for loaded actions that are not installed, an indirect method is by running an action from a script from a custom keyboard shortcut assigned to the script: https://prepression.blogspot.com/2016/11/photoshop-scripting-actions.html

 

This could also be scripted which would allow direct access to custom keyboard shortcuts without calling an action.

 

Likes

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 Community Professional ,
Jul 01, 2021 Jul 01, 2021

Copy link to clipboard

Copied

Hide:

 

layerMaskFromSelection("hideSelection");

function layerMaskFromSelection(hideORreveal) {
        var idmake = stringIDToTypeID("make");
        var desc1091 = new ActionDescriptor();
        var idnew = stringIDToTypeID("new");
        var idchannel = stringIDToTypeID("channel");
        desc1091.putClass(idnew, idchannel);
        var idat = stringIDToTypeID("at");
        var ref59 = new ActionReference();
        var idchannel = stringIDToTypeID("channel");
        var idchannel = stringIDToTypeID("channel");
        var idmask = stringIDToTypeID("mask");
        ref59.putEnumerated(idchannel, idchannel, idmask);
        desc1091.putReference(idat, ref59);
        var idusing = stringIDToTypeID("using");
        var iduserMaskEnabled = stringIDToTypeID("userMaskEnabled");
        // "hideSelection" or "revealSelection"
        var idrevealSelection = stringIDToTypeID(hideORreveal);
        desc1091.putEnumerated(idusing, iduserMaskEnabled, idrevealSelection);
        executeAction(idmake, desc1091, DialogModes.NO);
}

 

 

Reveal:

 

layerMaskFromSelection("revealSelection");

function layerMaskFromSelection(hideORreveal) {
        var idmake = stringIDToTypeID("make");
        var desc1091 = new ActionDescriptor();
        var idnew = stringIDToTypeID("new");
        var idchannel = stringIDToTypeID("channel");
        desc1091.putClass(idnew, idchannel);
        var idat = stringIDToTypeID("at");
        var ref59 = new ActionReference();
        var idchannel = stringIDToTypeID("channel");
        var idchannel = stringIDToTypeID("channel");
        var idmask = stringIDToTypeID("mask");
        ref59.putEnumerated(idchannel, idchannel, idmask);
        desc1091.putReference(idat, ref59);
        var idusing = stringIDToTypeID("using");
        var iduserMaskEnabled = stringIDToTypeID("userMaskEnabled");
        // "hideSelection" or "revealSelection"
        var idrevealSelection = stringIDToTypeID(hideORreveal);
        desc1091.putEnumerated(idusing, iduserMaskEnabled, idrevealSelection);
        executeAction(idmake, desc1091, DialogModes.NO);
}

 

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

Likes

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 Community Professional ,
Jun 30, 2021 Jun 30, 2021

Copy link to clipboard

Copied

A Conditional added to an action set that has both the Reveal All and Reveal Selection actions may work.

https://helpx.adobe.com/photoshop/using/conditional-actions-creative-cloud.html

 

After you record, name and put the two layer mask actions into a set, use Insert Conditional put the

Conditional action as the first action in the set.

 

Then in the Conditional dialog set If Current to Document Has a Selection, set Then Play Action to

Reveal Selection and set Else Play Action to Reveal All

 

You can then assign a Function Key to the Conditional Action step

 

 

Screenshot-(168).png

 

 

conditional action played on image with selection

 

Screenshot-(174).jpg

 

 

conditional action played on image with no selection

 

Screenshot-(173).jpg

 

 

Likes

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 Community Professional ,
Jul 01, 2021 Jul 01, 2021

Copy link to clipboard

Copied

Excellent solution.

Likes

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 Community Professional ,
Jul 01, 2021 Jul 01, 2021

Copy link to clipboard

Copied

Yes you can do that with three actions in an action set or a single Photoshop script. or just use Photoshop Layers palette add Layer Mask button which has both capabilities plus it can add the inverse Layer Masks the Hide All or Hide selection the Button with a modifier key.   I use the Layers Palette button.

JJMack

Likes

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 Community Professional ,
Jul 05, 2021 Jul 05, 2021

Copy link to clipboard

Copied

Are @Stephen_A_Marsh and @Jeff Arola  the same person using different user names? 😉

They have both been putting up a lot of excellent answers since I started posting again.

Likes

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 Community Professional ,
Jul 05, 2021 Jul 05, 2021

Copy link to clipboard

Copied

Haha!

 

depositphotos_32936479-stock-photo-cute-sock-puppet-isolated-on.jpg

 

 

 

Likes

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 Community Professional ,
Jul 05, 2021 Jul 05, 2021

Copy link to clipboard

Copied

@Bando 

 

Did you get the correct answer that you required?

Likes

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 ,
Jul 07, 2021 Jul 07, 2021

Copy link to clipboard

Copied

Thank you and NO.

I was hoping I had missed something in the "Keyboard Shortcuts and Menu" Dialog that would allow me to easily add this. It seemed to be a simple request since the action already exists on the interface.

Likes

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 Community Professional ,
Jul 07, 2021 Jul 07, 2021

Copy link to clipboard

Copied

Is not adding a shortcut F key to an action that perform the function you want not adding a shortcut to the function you want to use.

 

The UI interface button is more functional  for the  button has four functions when you add in selections and modifier keys.

JJMack

Likes

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 Community Professional ,
Jul 07, 2021 Jul 07, 2021

Copy link to clipboard

Copied

 


@Bando wrote:

Thank you and NO.

I was hoping I had missed something in the "Keyboard Shortcuts and Menu" Dialog that would allow me to easily add this. It seemed to be a simple request since the action already exists on the interface.


 

Sometimes in Photoshop, things are not as simple or initially obvious as one may wish or hope for them to be. You were provided multiple options that will give you the ability to set the shortcuts that you are looking for. All you need to do is just pick at least one of the options provided and set it up.

 

I provided screenshots of a couple of actions, with instructions on how to record the actions. You can then set a F key shortcut directly on each action. EDIT: See below for visual instructions.

 

I also provided two JavaScripts and a link explaining how to save them and install them so that you can also assign a custom keyboard shortcut to the scripts to add the functionality from the GUI in a keyboard shortcut. 

 

Step by step instructions can be provided if the general information previously provided needs further explanation.

 

Likes

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 Community Professional ,
Jul 07, 2021 Jul 07, 2021

Copy link to clipboard

Copied

 

Option 1: Function Key with modifier

 

fkey.png

 

 

Option 2: Assign keyboard shortcut to script

 

  1. Copy the JavaScript code text to the clipboard
  2. Open a new blank file in a plain-text editor (not word-processor)
  3. Paste the code in
  4. Save the text file as .txt
  5. Rename the text .txt to .jsx
  6. Install the script, then restart Photoshop:
    /Applications/Adobe Photoshop 2021/Presets/Scripts (Mac OS)
    C:\Program Files\Adobe\Adobe Photoshop 2021\Presets\Scripts (Win OS)

    installed-jsx.png

    More info here: https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

  7. Edit menu > Keyboard Shortcuts > Application menus > Scripts

    kbs-scripts.png

    Repeat for the hide script.

Likes

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 Community Professional ,
Jul 09, 2021 Jul 09, 2021

Copy link to clipboard

Copied

LATEST

@Bando 

 

Where are we at now?

 

I believe that there have been multiple correct answers which will allow you to set a keyboard shortcut to apply a hide or reveal layer mask (whether based on selection or not).

 

Please add likes and or correct answers to the various posts so that when others are searching for a resolution to their issue it will be obvious that a solution was found.

Likes

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