Skip to main content
Mr. Content
Known Participant
November 14, 2023
Question

looking for a way to toggle group/layer selection

  • November 14, 2023
  • 1 reply
  • 406 views

Is there a way to set up a keyboard shortcut or an existing modifier for the Group/Layer selection?

This topic has been closed for replies.

1 reply

Stephen Marsh
Community Expert
Community Expert
November 15, 2023

An Action can play the selection of a tool preset, but it may fail if the tool preset is set to "current tool only" and the move tool isn't selected. Also, the only keyboard shortcuts are Functin F-key based. So actions have limitiations.

 

Scripts offer more flexibility. There might be a way to directly script this with arcane AM code, however, I don't know about that.

 

What I do know is that you can create two named presets for the move tool,  such as "Move Tool - Group" and 

"Move Tool - Layer" for example, then indirectly reference these presets in a script and then set a custom keyboard shortcut against each installed script.
 
 
// Select 'Move Tool - Group' Preset

#target photoshop

(r = new ActionReference()).putClass(stringIDToTypeID('moveTool'));
(d = new ActionDescriptor()).putReference(stringIDToTypeID('target'), r);
executeAction(stringIDToTypeID('select'), d, DialogModes.NO);

selectMoveToolPreset("Move Tool - Group");

function selectMoveToolPreset(thePresetName) {
	function s2t(s) {
		return app.stringIDToTypeID(s);
	}
	var descriptor = new ActionDescriptor();
	var reference = new ActionReference();
	reference.putName( s2t( "toolPreset" ), thePresetName );
	descriptor.putReference( s2t( "null" ), reference );
	executeAction( s2t( "select" ), descriptor, DialogModes.NO );
}

 

And:

 

// Select 'Move Tool - Layer' Preset

#target photoshop

(r = new ActionReference()).putClass(stringIDToTypeID('moveTool'));
(d = new ActionDescriptor()).putReference(stringIDToTypeID('target'), r);
executeAction(stringIDToTypeID('select'), d, DialogModes.NO);

selectMoveToolPreset("Move Tool - Layer");

function selectMoveToolPreset(thePresetName) {
	function s2t(s) {
		return app.stringIDToTypeID(s);
	}
	var descriptor = new ActionDescriptor();
	var reference = new ActionReference();
	reference.putName( s2t( "toolPreset" ), thePresetName );
	descriptor.putReference( s2t( "null" ), reference );
	executeAction( s2t( "select" ), descriptor, DialogModes.NO );
}

 

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

 

Mr. Content
Known Participant
December 8, 2023

Thanks a lot. That is heavy code knowledge but I will try it. 

Stephen Marsh
Community Expert
Community Expert
December 8, 2023

@Mr. Content 

 

Let me know how you go. After almost a month, I thought that this was a hit-and-run topic and that you wouldn't be back!