Skip to main content
AG_Ps_100
Inspiring
June 26, 2019
Answered

Select Frame Layer + its contents

  • June 26, 2019
  • 1 reply
  • 2152 views

Hello everyone,

Photoshop CC 2019 introduced the new frame tool. which is quite useful.

As I was trying to automate my work today, I wanted to Free Transform the Frame + Contents so in order to do this i need to select both.

I couldn't find a solution using actions because it just selects the Frame layer, like this:

But I need both, like this:

I have tried the Alt+[ ] that I would normally use in actions, but it doesn't choose the contents.

Maybe via script it might work, any ideas?

This topic has been closed for replies.
Correct answer SuperMerlin

They are based on a layerset.

You could select both by...

#target photoshop;

if(activeDocument.activeLayer.name.match(/Frame$/)){

var Frame1 = activeDocument.activeLayer.id;

var Frame2 = activeDocument.activeLayer.layers[0].id;

selectLayerById(Frame1);

selectLayerById(Frame2,true);

}

function selectLayerById(id,add){

var ref = new ActionReference();

ref.putIdentifier(charIDToTypeID('Lyr '), id);

var desc = new ActionDescriptor();

desc.putReference(charIDToTypeID("null"), ref );

if(add) desc.putEnumerated( stringIDToTypeID( "selectionModifier" ), stringIDToTypeID( "selectionModifierType" ), stringIDToTypeID( "addToSelection" ) );

desc.putBoolean( charIDToTypeID( "MkVs" ), false );

try{

executeAction(charIDToTypeID("slct"), desc, DialogModes.NO );

}catch(e){}

};


Another version, that checks which is selected (must have a frame layer selected)

#target photoshop;

if(app.activeDocument.activeLayer.blendMode == BlendMode.PASSTHROUGH){

var Frame1 = activeDocument.activeLayer.id;

var Frame2 = activeDocument.activeLayer.layers[0].id;

}else{

var Frame1 = activeDocument.activeLayer.parent.id;

var Frame2 = activeDocument.activeLayer.id;

}

selectLayerById(Frame1);

selectLayerById(Frame2,true);

function selectLayerById(id,add){

var ref = new ActionReference();

ref.putIdentifier(charIDToTypeID('Lyr '), id);

var desc = new ActionDescriptor();

desc.putReference(charIDToTypeID("null"), ref );

if(add) desc.putEnumerated( stringIDToTypeID( "selectionModifier" ), stringIDToTypeID( "selectionModifierType" ), stringIDToTypeID( "addToSelection" ) );

desc.putBoolean( charIDToTypeID( "MkVs" ), false );

try{

executeAction(charIDToTypeID("slct"), desc, DialogModes.NO );

}catch(e){}

};

1 reply

Joachim Hiller
Known Participant
June 26, 2019

The frame and the picture each have their own Layer ID.

You can select them via the ID's.

function selectLayerById(id, add) {

    var ref = new ActionReference();

    ref.putIdentifier(charIDToTypeID('Lyr '), id);

    var desc = new ActionDescriptor();

    desc.putReference(charIDToTypeID("null"), ref);

    if (add) desc.putEnumerated(stringIDToTypeID("selectionModifier"), stringIDToTypeID("selectionModifierType"), stringIDToTypeID("addToSelection"));

    //Sichtbarkeit der Ebene

    desc.putBoolean(charIDToTypeID("MkVs"), false);

    executeAction(charIDToTypeID("slct"), desc, DialogModes.NO);

};

selectLayerById(frameID);

selectLayerById(imgID, true);

AG_Ps_100
AG_Ps_100Author
Inspiring
June 26, 2019

we're getting there, how do I know what is my frameID and my imgID?

usually the layer is 1 layer before the bottom:

SuperMerlin
Inspiring
June 26, 2019

They are based on a layerset.

You could select both by...

#target photoshop;

if(activeDocument.activeLayer.name.match(/Frame$/)){

var Frame1 = activeDocument.activeLayer.id;

var Frame2 = activeDocument.activeLayer.layers[0].id;

selectLayerById(Frame1);

selectLayerById(Frame2,true);

}

function selectLayerById(id,add){

var ref = new ActionReference();

ref.putIdentifier(charIDToTypeID('Lyr '), id);

var desc = new ActionDescriptor();

desc.putReference(charIDToTypeID("null"), ref );

if(add) desc.putEnumerated( stringIDToTypeID( "selectionModifier" ), stringIDToTypeID( "selectionModifierType" ), stringIDToTypeID( "addToSelection" ) );

desc.putBoolean( charIDToTypeID( "MkVs" ), false );

try{

executeAction(charIDToTypeID("slct"), desc, DialogModes.NO );

}catch(e){}

};