Choose a layer and make it a selection

New Here ,
Mar 06, 2022 Mar 06, 2022

Copy link to clipboard

Copied

Mac os 10.14.6; Photoshop CC 2018 (release 19.1.3)

 

Right-clicking on an image opens a context menu from which I can choose the layer. If I then want to make that layer a selection, I need to navigate to the layer palette and left click on that layer. Not a big deal, except I have to stop another action, do these two steps manually, then continues the action --- and do it many, many times.

 

Is there any way to combine the right-click step (choose the layer) then make it a selection steps into an action? 

TOPICS
Actions and scripting , macOS

Views

164

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 ,
Mar 06, 2022 Mar 06, 2022

Copy link to clipboard

Copied

Just to confirm, do you have the move tool active to bring up the contextual layer selection menu?

 

Do you mean left CMD/CTRL click on the layer to load the layer transparency as a selection?

 

Unless the action has a stop step or modal active, the action is designed to play from beginning to end. If I am understanding you correctly, you would like a step in the action to dynamically allow the loading of a selection from a target layer without interrupting the flow of the action. Is that correct?

 

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
New Here ,
Mar 07, 2022 Mar 07, 2022

Copy link to clipboard

Copied

Thank you so much for responding.

Holding down the Apple command key activates the move tool momentarily. Then right-clicking on the image opens the drop down menu, and I can choose the layer I want in the Layers Palette from the menu.

The another hold (to continue holding) on the Apple command key enables me to click on the chosen layer in the Layers palette, and load it as a selection (marching ants).

And “yes” to your description of what I am hoping to do.
Michael Sohns
Digital Artist
262-443-0513 (tel:262-443-0513)
PO Box 532 - Oconomowoc, WI 53066 (https://maps.google.com/?q=PO%20Box%20532%20-%20Oconomowoc%2C%20WI%2053066)
https://michaelsohns.com

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 ,
Mar 07, 2022 Mar 07, 2022

Copy link to clipboard

Copied

As this is more about a smooth workflow, I can't think of anything built-in that would not be more pain than it was worth...

 

So it is probably best to just record a single step action with a F-Key shortcut to load the active layer's transparency as a selection. That way you can just press the shortcut key after selecting the layer.

 

If the F-Key combo is a little painful, this could be scripted and scripts can have "normal" keyboard shortcuts applied (not F-key based):

 

 

// Load selection from active layer transparency
#target photoshop
loadLayerTrans();
function loadLayerTrans() {
	var s2t = function (s) {
		return app.stringIDToTypeID(s);
	};
	var descriptor = new ActionDescriptor();
	var reference = new ActionReference();
	var reference2 = new ActionReference();
	reference.putProperty(s2t("channel"), s2t("selection"));
	descriptor.putReference(s2t("null"), reference);
	reference2.putEnumerated(s2t("channel"), s2t("channel"), s2t("transparencyEnum"));
	descriptor.putReference(s2t("to"), reference2);
	executeAction(s2t("set"), descriptor, 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
New Here ,
Mar 08, 2022 Mar 08, 2022

Copy link to clipboard

Copied

Smooth workflow, yes. I did find a keyboard shortcut (select and mask), but that doesn't do what I want. I'm unable to make an action of the two steps, let alone assigning it to a function key. I'll work on figuring out a script, but in the mean time, I've put the two steps before executing the action, which is at least serving to let it flow without interruption.

Thanks much!
Michael Sohns
Digital Artist
262-443-0513 (tel:262-443-0513)
PO Box 532 - Oconomowoc, WI 53066 (https://maps.google.com/?q=PO%20Box%20532%20-%20Oconomowoc%2C%20WI%2053066)
https://michaelsohns.com

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 ,
Mar 08, 2022 Mar 08, 2022

Copy link to clipboard

Copied

@MrWobbles – Just follow the instructions in my previous post to copy and save the script code, then install it in Photoshop as per the instructions on the same blogpost. After restarting Photoshop, use Edit > Keyboard Shortcuts to assign to the 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 ,
Mar 08, 2022 Mar 08, 2022

Copy link to clipboard

Copied

We can improve this scenario a bit by listening to the layer select event. To make the logic of selecting the transparency of a layer from the menu look like a selection on the palette, you also need to hold down cmd (or ctrl) when the menu item is activated:

 

#target photoshop
var s2t = stringIDToTypeID,
    t2s = typeIDToStringID;
try {
    var target = t2s(arguments[0].getReference(s2t('null')).getDesiredClass());
    if (target == 'layer' && (ScriptUI.environment.keyboardState.ctrlKey || ScriptUI.environment.keyboardState.metaKey)) {
        (r = new ActionReference()).putProperty(s2t('channel'), s2t('selection'));
        (d = new ActionDescriptor()).putReference(s2t('null'), r);
        (r1 = new ActionReference()).putEnumerated(s2t('channel'), s2t('channel'), s2t('transparencyEnum'));
        d.putReference(s2t('to'), r1);
        executeAction(s2t('set'), d, DialogModes.NO);
    }
} catch (e) { }
if (!target) {
    app.notifiersEnabled = true
    var f = File($.fileName),
        deleted;
    for (var i = 0; i < app.notifiers.length; i++) {
        var ntf = app.notifiers[i]
        if (ntf.eventFile.name == f.name) { ntf.remove(); i--; deleted = true }
    }
    if (deleted) {
        alert('event listening disabled!')
    } else {
        app.notifiers.add('slct', f, 'Lyr ')
        alert('event listening enabled!')
    }
}

 

* I can't test it on macOS at the moment, but it should work.
** tested on Big Sur 11.6.4 - it works.

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
LEGEND ,
Mar 08, 2022 Mar 08, 2022

Copy link to clipboard

Copied

What's for the meta key instead of Control in this circumstances. Probably for macOS, why?

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 ,
Mar 08, 2022 Mar 08, 2022

Copy link to clipboard

Copied

LATEST

On macOS all shortcuts use command key instead of ctrl by default. I think that to create a selection, the user will be more accustomed to pressing it, and not ctrl 🤷

2022-03-09_10-29-16.png

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