Copy link to clipboard
Copied
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?
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.putIdentifie
Copy link to clipboard
Copied
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);
Copy link to clipboard
Copied
we're getting there, how do I know what is my frameID and my imgID?
usually the layer is 1 layer before the bottom:
Copy link to clipboard
Copied
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){}
};
Copy link to clipboard
Copied
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){}
};
Copy link to clipboard
Copied
Perfect, I tried the first and it worked very good, thank you!!!