Skip to main content
Bando
Known Participant
June 30, 2021
Question

Need a proper shortcut for "Add a layer mask"

  • June 30, 2021
  • 5 replies
  • 4759 views

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

This topic has been closed for replies.

5 replies

Stephen Marsh
Community Expert
Community Expert
July 5, 2021

@Bando 

 

Did you get the correct answer that you required?

Bando
BandoAuthor
Known Participant
July 7, 2021

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.

JJMack
Community Expert
Community Expert
July 7, 2021

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
Jeff Arola
Community Expert
Community Expert
July 1, 2021

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

 

 

 

 

conditional action played on image with selection

 

 

 

conditional action played on image with no selection

 

 

 

Bojan Živković11378569
Community Expert
Community Expert
July 1, 2021

Excellent solution.

Stephen Marsh
Community Expert
Community Expert
June 30, 2021

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

 

 

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.

 

Stephen Marsh
Community Expert
Community Expert
July 1, 2021

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

 

Marianne-Deiters
Participating Frequently
June 30, 2021

Sorry, I misunderstood the question…

 

JJMack
Community Expert
Community Expert
June 30, 2021

JJMack