• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

open image paste single click ?

Explorer ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

Screenshot 2023-01-08 113026.jpg

TOPICS
Actions and scripting , Windows

Views

4.2K

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
Explorer ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

Select layer & Run Script 

back open image paste selceted layers one by one ?

 

 

Votes

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
Community Expert ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

Copy/pasting seems like a waste of resources (provided the placed images are flat, at least), but please describe the EXACT and COMPLETE scenario. 

 

Is the active image is the receiving one, should all other open images be inserted in that, do the imagesthat are to be placed flat, …? 

Votes

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
Community Expert ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

If the goal is to set up four rectangles as placeholders, draw them using the Frame tool. When they are frames, they are placeholders for future graphics, so all you have to do is select a frame and paste an image you copied from another document. It pastes inside the frame.

Votes

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
Explorer ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

Votes

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
Guide ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

You can do it with frame tool, actions and my script from How to change the order of open documents for an action?  

a slightly different approach you can see in this thread - repeats the layer , Sort Layer and Auto Arrange by position 

Votes

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
Explorer ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

thanks ,

Votes

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
Explorer ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

single click than aur open Jpeg image fill in selected layers ...

 

Votes

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
Community Expert ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

Please use complete and meaningful sentences to describe your intentions. 

 

Copy/pasting and even dragging/dropping Layers seem unnecessary if the images are existing jpgs – simply placing them as Smart Objects would seem more efficient in this case. 

Screenshot 2023-01-27 at 11.55.57.png

Screenshot 2023-01-27 at 11.56.04.png

 

code edited 

 

// placeOpenImagesOnShapeLayers;
// 2023, use it at your own risk;
//#target photoshop
if (app.documents.length > 0) {
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.POINTS;
var myDocument = app.activeDocument;
var theShapes = collectShapeLayersBounds();
var theDocuments = new Array;
if (theShapes.length > 0) {
// the other documents;
for (var m = 0; m < app.documents.length; m++) {
if (app.documents[m] != myDocument) {theDocuments.push(app.documents[m])}
};
// place images;
var theId = 0;
for (var n = 0; n < theDocuments.length; n++) {
    selectLayerByID(theShapes[theId][1], false);
    placeScaleRotateFile (theDocuments[n].fullName, 0, 0, 100, 100, 0);
    scaleToBounds (theShapes[theId][2]);
    myDocument.activeLayer.grouped = true;
    if (theId == theShapes.length-1) {theId = 0} else {theId++};
    };
} else {alert ("no shape layers")};
app.preferences.rulerUnits = originalRulerUnits;
};
////////////////////////////////////
////// place //////
function placeScaleRotateFile (file, xOffset, yOffset, theXScale, theYScale, theAngle) {
    // =======================================================
        var desc5 = new ActionDescriptor();
        desc5.putPath( charIDToTypeID( "null" ), new File( file ) );
        desc5.putEnumerated( charIDToTypeID( "FTcs" ), idQCSt = charIDToTypeID( "QCSt" ), charIDToTypeID( "Qcsa" ) );
        var idOfst = charIDToTypeID( "Ofst" );
            var desc6 = new ActionDescriptor();
            var idPxl = charIDToTypeID( "#Pxl" );
            desc6.putUnitDouble( charIDToTypeID( "Hrzn" ), idPxl, xOffset );
            desc6.putUnitDouble( charIDToTypeID( "Vrtc" ), idPxl, yOffset );
        var idOfst = charIDToTypeID( "Ofst" );
        desc5.putObject( idOfst, idOfst, desc6 );
        var idPrc = charIDToTypeID( "#Prc" );
        desc5.putUnitDouble( charIDToTypeID( "Wdth" ), idPrc, theYScale );
        desc5.putUnitDouble( charIDToTypeID( "Hght" ), idPrc, theXScale );
        desc5.putUnitDouble( charIDToTypeID( "Angl" ), charIDToTypeID( "#Ang" ),theAngle );	
        desc5.putBoolean( charIDToTypeID( "Lnkd" ), false );
    executeAction( charIDToTypeID( "Plc " ), desc5, DialogModes.NO );
    return app.activeDocument.activeLayer;
    };
////// scale active layer to bounds //////
function scaleToBounds (targetBounds) {
// scale smart object:
    var originalRulerUnits = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.POINTS;
    var ref = new ActionReference();
    ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
    var layerDesc = executeActionGet(ref);
    var theBounds = layerDesc.getObjectValue(stringIDToTypeID('bounds'));
    var theX = theBounds.getInteger(stringIDToTypeID('left'));
    var theY = theBounds.getInteger(stringIDToTypeID('top'));
    var theX2 = theBounds.getInteger(stringIDToTypeID('right'));
    var theY2 = theBounds.getInteger(stringIDToTypeID('bottom'));
// determine the scale;
    var boundsWidth = targetBounds[2]-targetBounds[0];
    var boundsHeight = targetBounds[3]-targetBounds[1];
    var theSOProp = boundsWidth/boundsHeight;
    var theNewProp = (theX2 - theX)/(theY2 - theY);
    if (theNewProp <= theSOProp) {var theScale = boundsWidth / (theX2 - theX) * 100}
    else {var theScale = boundsHeight / (theY2 - theY) * 100};
// transform;
    var desc23 = new ActionDescriptor();
    var ref2 = new ActionReference();
    ref2.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
    desc23.putReference( charIDToTypeID( "null" ), ref2 );
    var idOfst = charIDToTypeID( "Ofst" );
      var desc24 = new ActionDescriptor();
      var idPxl = charIDToTypeID( "#Pxl" );
      desc24.putUnitDouble( charIDToTypeID( "Hrzn" ), idPxl, targetBounds[0]+boundsWidth/2 - (theX+(theX2-theX)/2) );
      desc24.putUnitDouble( charIDToTypeID( "Vrtc" ), idPxl, targetBounds[1]+boundsHeight/2 - (theY+(theY2-theY)/2) );
    desc23.putObject( idOfst, idOfst, desc24 );
    var idPrc = charIDToTypeID( "#Prc" );
    desc23.putUnitDouble( charIDToTypeID( "Wdth" ), idPrc, theScale );
    desc23.putUnitDouble( charIDToTypeID( "Hght" ), idPrc, theScale );
    desc23.putEnumerated( charIDToTypeID( "Intr" ), charIDToTypeID( "Intp" ), stringIDToTypeID( "bicubicAutomatic" ) );
    desc23.putEnumerated( stringIDToTypeID( "freeTransformCenterState" ), stringIDToTypeID( "quadCenterState" ), stringIDToTypeID( "QCSAverage" ) );
    executeAction( charIDToTypeID( "Trnf" ), desc23, DialogModes.NO );
    app.preferences.rulerUnits = originalRulerUnits;
    };
////// collect shape layer bounds //////
function collectShapeLayersBounds () {
    // get number of layers;
    var ref = new ActionReference();
    ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
    var applicationDesc = executeActionGet(ref);
    var theNumber = applicationDesc.getInteger(stringIDToTypeID("numberOfLayers"));
    // process the layers;
    var theLayers = new Array;
    for (var m = 0; m <= theNumber; m++) {
    try {
    var ref = new ActionReference();
    ref.putIndex( charIDToTypeID( "Lyr " ), m);
    var layerDesc = executeActionGet(ref);
    var layerSet = typeIDToStringID(layerDesc.getEnumerationValue(stringIDToTypeID("layerSection")));
    var isBackground = layerDesc.getBoolean(stringIDToTypeID("background"));
    // if not layer group collect values;
    if (layerSet != "layerSectionEnd" && layerSet != "layerSectionStart" && isBackground != true) {
    var theName = layerDesc.getString(stringIDToTypeID('name'));
    var theID = layerDesc.getInteger(stringIDToTypeID('layerID'));
    var theKind = layerDesc.getInteger(stringIDToTypeID('layerKind'));
    if (theKind == 4) {
        var theBounds = layerDesc.getObjectValue(stringIDToTypeID("bounds"));
        var theseBounds = [theBounds.getUnitDoubleValue(stringIDToTypeID("left")), theBounds.getUnitDoubleValue(stringIDToTypeID("top")), theBounds.getUnitDoubleValue(stringIDToTypeID("right")), theBounds.getUnitDoubleValue(stringIDToTypeID("bottom"))];    
        theLayers.push([theName, theID, theseBounds])
    }
    };
    }
    catch (e) {};
    };
    return theLayers;
    };
////////////////////////////////////
// based on code by mike hale, via paul riggott;
function selectLayerByID(id,add){ 
add = undefined ? add = false: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){
alert(e.message); 
}
};

 

 

Votes

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
Explorer ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

thanks 

 

Votes

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
Explorer ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

All type layers works not to only Shapes layers worksScreenshot 2023-01-27 164959.jpg

Votes

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
Explorer ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

I Was this Script..... All Open jpeg image fill & Close

Votes

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
Community Expert ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

The Script I posted places the other open files as Smart Objects and scales them according to the existing Shape Layers, adapting the template file should not be difficult and, if the task is a frequent one, worth the trouble. 

 

What are you going to do with the file subsequently? 

As the Script simply places the original files they might prove problematic if they are jpgs and you need to edit them further. 

placeOpenImagesOnShapeLayersScr.gif

Votes

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
Community Expert ,
Feb 13, 2023 Feb 13, 2023

Copy link to clipboard

Copied

What is the problem with the script thay you use for the video? 

It still looks something a printing shop needs.

Votes

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
Community Expert ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

I had mistaken the four Layers for Shape Layers. 

I recommend you create four Shape Layers to replace the current Pixel Layers. 

Votes

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
Explorer ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

selected layer are Renames

previous document cut copy close

paste & fit to layers

Votes

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
Community Expert ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

• Please speak in complete sentences. 

You can type in your preferred or native tongue and we’ll see if Auto Translate can provide a good translation. 

 

• Please change the four rectangular Layers to Shape Layers (Solid Color Layers with Vector Masks) and try the Script again. 

Screenshot 2023-01-27 at 15.36.09.png

Votes

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
Community Expert ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

 

// placeAndScaleOpenImagesOnLayers;
// 2023, use it at your own risk;
if (app.documents.length > 0) {
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.POINTS;
var myDocument = app.activeDocument;
var myDocId = getDocumentId();
var theShapes = collectLayersBounds();
var theDocuments = new Array;
if (theShapes.length > 0) {
// the other documents;
for (var m = 0; m < app.documents.length; m++) {
if (app.documents[m] != myDocument) {theDocuments.push(app.documents[m])}
};
// place images;
var theId = 0;
for (var n = 0; n < theDocuments.length; n++) {
    selectLayerByID(theShapes[theId][1], false);
    app.activeDocument = theDocuments[n];
// duplicate and flatten image to make sure the original is unchanged;
    var theDup = theDocuments[n].duplicate("theDup", true);
    theDup.layers[0].name = theDocuments[n].name;
    convertToSmartObject();
// duplicate layer;
    duplicateLayers (myDocId);
    theDup.close(SaveOptions.DONOTSAVECHANGES);
    app.activeDocument = myDocument;
    scaleToBounds (theShapes[theId][2]);
    myDocument.activeLayer.grouped = true;
    if (theId == theShapes.length-1) {theId = 0} else {theId++};
    };
} else {alert ("no shape layers")};
app.preferences.rulerUnits = originalRulerUnits;
};
////////////////////////////////////
////// duplicate layers //////
function duplicateLayers (theDocID) {
        var desc8 = new ActionDescriptor();
            var ref5 = new ActionReference();
            ref5.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
        desc8.putReference( charIDToTypeID( "null" ), ref5 );
            var ref6 = new ActionReference();
            ref6.putIdentifier( charIDToTypeID( "Dcmn" ), theDocID );
        desc8.putReference( charIDToTypeID( "T   " ), ref6 );
        desc8.putInteger( charIDToTypeID( "Vrsn" ), 5 );
    executeAction( charIDToTypeID( "Dplc" ), desc8, DialogModes.NO );
    };
////// document id //////
function getDocumentId () {
    var ref = new ActionReference();
    ref.putProperty(stringIDToTypeID('property'), stringIDToTypeID('documentID'));
    ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
    var docDesc = executeActionGet(ref);
    return docDesc.getInteger(stringIDToTypeID("documentID"))
};
////// convert to smart object //////
function convertToSmartObject () {
    var desc108 = new ActionDescriptor();
    var ref77 = new ActionReference();
    ref77.putEnumerated( charIDToTypeID( "Mn  " ), charIDToTypeID( "MnIt" ), stringIDToTypeID( "newPlacedLayer" ) );
    desc108.putReference( charIDToTypeID( "null" ), ref77 );
    executeAction( charIDToTypeID( "slct" ), desc108, DialogModes.NO );
    };
////// scale active layer to bounds //////
function scaleToBounds (targetBounds) {
// scale smart object:
    var originalRulerUnits = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.POINTS;
    var ref = new ActionReference();
    ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
    var layerDesc = executeActionGet(ref);
    var theBounds = layerDesc.getObjectValue(stringIDToTypeID('bounds'));
    var theX = theBounds.getInteger(stringIDToTypeID('left'));
    var theY = theBounds.getInteger(stringIDToTypeID('top'));
    var theX2 = theBounds.getInteger(stringIDToTypeID('right'));
    var theY2 = theBounds.getInteger(stringIDToTypeID('bottom'));
// determine the scale;
    var boundsWidth = targetBounds[2]-targetBounds[0];
    var boundsHeight = targetBounds[3]-targetBounds[1];
    var theSOProp = boundsWidth/boundsHeight;
    var theNewProp = (theX2 - theX)/(theY2 - theY);
    if (theNewProp <= theSOProp) {var theScale = boundsWidth / (theX2 - theX) * 100}
    else {var theScale = boundsHeight / (theY2 - theY) * 100};
// transform;
    var desc23 = new ActionDescriptor();
    var ref2 = new ActionReference();
    ref2.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
    desc23.putReference( charIDToTypeID( "null" ), ref2 );
    var idOfst = charIDToTypeID( "Ofst" );
      var desc24 = new ActionDescriptor();
      var idPxl = charIDToTypeID( "#Pxl" );
      desc24.putUnitDouble( charIDToTypeID( "Hrzn" ), idPxl, targetBounds[0]+boundsWidth/2 - (theX+(theX2-theX)/2) );
      desc24.putUnitDouble( charIDToTypeID( "Vrtc" ), idPxl, targetBounds[1]+boundsHeight/2 - (theY+(theY2-theY)/2) );
    desc23.putObject( idOfst, idOfst, desc24 );
    var idPrc = charIDToTypeID( "#Prc" );
    desc23.putUnitDouble( charIDToTypeID( "Wdth" ), idPrc, theScale );
    desc23.putUnitDouble( charIDToTypeID( "Hght" ), idPrc, theScale );
    desc23.putEnumerated( charIDToTypeID( "Intr" ), charIDToTypeID( "Intp" ), stringIDToTypeID( "bicubicAutomatic" ) );
    desc23.putEnumerated( stringIDToTypeID( "freeTransformCenterState" ), stringIDToTypeID( "quadCenterState" ), stringIDToTypeID( "QCSAverage" ) );
    executeAction( charIDToTypeID( "Trnf" ), desc23, DialogModes.NO );
    app.preferences.rulerUnits = originalRulerUnits;
    };
////// collect shape layer bounds //////
function collectLayersBounds () {
    // get number of layers;
    var ref = new ActionReference();
    ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
    var applicationDesc = executeActionGet(ref);
    var theNumber = applicationDesc.getInteger(stringIDToTypeID("numberOfLayers"));
    // process the layers;
    var theLayers = new Array;
    for (var m = 0; m <= theNumber; m++) {
    try {
    var ref = new ActionReference();
    ref.putIndex( charIDToTypeID( "Lyr " ), m);
    var layerDesc = executeActionGet(ref);
    var layerSet = typeIDToStringID(layerDesc.getEnumerationValue(stringIDToTypeID("layerSection")));
    var isBackground = layerDesc.getBoolean(stringIDToTypeID("background"));
    // if not layer group collect values;
    if (layerSet != "layerSectionEnd" && layerSet != "layerSectionStart" && isBackground != true) {
    var theName = layerDesc.getString(stringIDToTypeID('name'));
    var theID = layerDesc.getInteger(stringIDToTypeID('layerID'));
    var theKind = layerDesc.getInteger(stringIDToTypeID('layerKind'));
//    if (theKind == 4) {
        var theBounds = layerDesc.getObjectValue(stringIDToTypeID("bounds"));
        var theseBounds = [theBounds.getUnitDoubleValue(stringIDToTypeID("left")), theBounds.getUnitDoubleValue(stringIDToTypeID("top")), theBounds.getUnitDoubleValue(stringIDToTypeID("right")), theBounds.getUnitDoubleValue(stringIDToTypeID("bottom"))];    
        theLayers.push([theName, theID, theseBounds])
//    }
    };
    }
    catch (e) {};
    };
    return theLayers;
    };
// based on code by mike hale, via paul riggott;
function selectLayerByID(id,add){ 
add = undefined ? add = false: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){
alert(e.message); 
}
};

Screenshot 2023-01-27 at 15.54.12.pngScreenshot 2023-01-27 at 15.54.21.png

 

Votes

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
Explorer ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

thank you very much for your reply..

Votes

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
Explorer ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

May this script  selected layers with open many jpg file  may be used in single click..as much layer selected as it is image fill....

 

var newName =("layer name", "frame");

var layers = getSelectedLayers();
for (var i = 0; i < layers.length; i ++){
layers[i].name = newName;
}

function getSelectedLayers(){
var idGrp = stringIDToTypeID( "groupLayersEvent" );
var descGrp = new ActionDescriptor();
var refGrp = new ActionReference();
refGrp.putEnumerated(charIDToTypeID( "Lyr " ),charIDToTypeID( "Ordn" ),charIDToTypeID( "Trgt" ));
descGrp.putReference(charIDToTypeID( "null" ), refGrp );
executeAction( idGrp, descGrp, DialogModes.ALL );
var resultLayers=new Array();
for (var ix=0;ix<app.activeDocument.activeLayer.layers.length;ix++){resultLayers.push(app.activeDocument.activeLayer.layers[ix])}
var id8 = charIDToTypeID( "slct" );
var desc5 = new ActionDescriptor();
var id9 = charIDToTypeID( "null" );
var ref2 = new ActionReference();
var id10 = charIDToTypeID( "HstS" );
var id11 = charIDToTypeID( "Ordn" );
var id12 = charIDToTypeID( "Prvs" );
ref2.putEnumerated( id10, id11, id12 );
desc5.putReference( id9, ref2 );
executeAction( id8, desc5, DialogModes.NO );
return resultLayers;
}
// Cycle forwards through open doc windows
var idselect = stringIDToTypeID("select");
var desc410 = new ActionDescriptor();
var idnull = stringIDToTypeID( "null" );
var ref119 = new ActionReference();
var iddocument = stringIDToTypeID( "document" );
ref119.putOffset( iddocument, 1 ); // -1 to cycle backwards through open doc windows
desc410.putReference( idnull, ref119 );
var iddocumentID = stringIDToTypeID( "documentID" );
executeAction( idselect, desc410, DialogModes.NO );
// =======================================================
var id33 = charIDToTypeID( "setd" );
var desc13 = new ActionDescriptor();
var id34 = charIDToTypeID( "null" );
var ref5 = new ActionReference();
var id35 = charIDToTypeID( "Chnl" );
var id36 = charIDToTypeID( "fsel" );
ref5.putProperty( id35, id36 );
desc13.putReference( id34, ref5 );
var id37 = charIDToTypeID( "T " );
var id38 = charIDToTypeID( "Ordn" );
var id39 = charIDToTypeID( "Al " );
desc13.putEnumerated( id37, id38, id39 );
executeAction( id33, desc13, DialogModes.NO );

// =======================================================
var id40 = charIDToTypeID( "copy" );
executeAction( id40, undefined, DialogModes.NO );

// =======================================================
var id41 = charIDToTypeID( "setd" );
var desc14 = new ActionDescriptor();
var id42 = charIDToTypeID( "null" );
var ref6 = new ActionReference();
var id43 = charIDToTypeID( "Chnl" );
var id44 = charIDToTypeID( "fsel" );
ref6.putProperty( id43, id44 );
desc14.putReference( id42, ref6 );
var id45 = charIDToTypeID( "T " );
var id46 = charIDToTypeID( "Ordn" );
var id47 = charIDToTypeID( "None" );
desc14.putEnumerated( id45, id46, id47 );
executeAction( id41, desc14, DialogModes.NO );

// =======================================================
var id48 = charIDToTypeID( "Cls " );
executeAction( id48, undefined, DialogModes.NO );

// =======================================================
var id49 = charIDToTypeID( "slct" );
var desc15 = new ActionDescriptor();
var id50 = charIDToTypeID( "null" );
var ref7 = new ActionReference();
var id51 = charIDToTypeID( "Lyr " );
ref7.putName( id51, "frame" );
desc15.putReference( id50, ref7 );
var id52 = charIDToTypeID( "MkVs" );
desc15.putBoolean( id52, false );
executeAction( id49, desc15, DialogModes.NO );

// =======================================================
var id53 = charIDToTypeID( "past" );
var desc16 = new ActionDescriptor();
var id54 = charIDToTypeID( "AntA" );
var id55 = charIDToTypeID( "Annt" );
var id56 = charIDToTypeID( "Anno" );
desc16.putEnumerated( id54, id55, id56 );
executeAction( id53, desc16, DialogModes.NO );

// =======================================================
var id57 = stringIDToTypeID( "newPlacedLayer" );
executeAction( id57, undefined, DialogModes.NO );

var oldPref = app.preferences.rulerUnits
app.preferences.rulerUnits = Units.PIXELS;
var doc = activeDocument;
var iLayer = doc.activeLayer;

layerDown ();

var mLayerB = doc.activeLayer.bounds;
doc.activeLayer = iLayer;
var scale = Math.max((mLayerB[2]-mLayerB[0])/(iLayer.bounds[2]-iLayer.bounds[0]),(mLayerB[3]-mLayerB[1])/(iLayer.bounds[3]-iLayer.bounds[1]));
iLayer.resize (scale*100,scale*100);
iLayer.translate((mLayerB[0]+mLayerB[2])/2-(iLayer.bounds[0]+iLayer.bounds[2])/2,(mLayerB[1]+mLayerB[3])/2-(iLayer.bounds[1]+iLayer.bounds[3])/2);

function layerDown(){
var idslct = charIDToTypeID( "slct" );
var desc2 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idBckw = charIDToTypeID( "Bckw" );
ref1.putEnumerated( idLyr, idOrdn, idBckw );
desc2.putReference( idnull, ref1 );
var idMkVs = charIDToTypeID( "MkVs" );
desc2.putBoolean( idMkVs, false );
var idLyrI = charIDToTypeID( "LyrI" );
var list1 = new ActionList();
list1.putInteger( 3 );
desc2.putList( idLyrI, list1 );
executeAction( idslct, desc2, DialogModes.NO );
};
function (layer)
{
var idnewPlacedLayer = stringIDToTypeID( 'newPlacedLayer' );
executeAction(idnewPlacedLayer, undefined, DialogModes.NO);
}
var oldPref = app.preferences.rulerUnits
app.preferences.rulerUnits = Units.PIXELS;
var doc = activeDocument;
var iLayer = doc.activeLayer;

layerDown ();

var mLayerB = doc.activeLayer.bounds;
doc.activeLayer = iLayer;
var scale = Math.max((mLayerB[2]-mLayerB[0])/(iLayer.bounds[2]-iLayer.bounds[0]),(mLayerB[3]-mLayerB[1])/(iLayer.bounds[3]-iLayer.bounds[1]));
iLayer.resize (scale*100,scale*100);
iLayer.translate((mLayerB[0]+mLayerB[2])/2-(iLayer.bounds[0]+iLayer.bounds[2])/2,(mLayerB[1]+mLayerB[3])/2-(iLayer.bounds[1]+iLayer.bounds[3])/2);

clip ();

function clip(){
var idGrpL = charIDToTypeID( "GrpL" );
var desc7 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref6 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref6.putEnumerated( idLyr, idOrdn, idTrgt );
desc7.putReference( idnull, ref6 );
executeAction( idGrpL, desc7, DialogModes.NO );
};

function layerDown(){
var idslct = charIDToTypeID( "slct" );
var desc2 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idBckw = charIDToTypeID( "Bckw" );
ref1.putEnumerated( idLyr, idOrdn, idBckw );
desc2.putReference( idnull, ref1 );
var idMkVs = charIDToTypeID( "MkVs" );
desc2.putBoolean( idMkVs, false );
var idLyrI = charIDToTypeID( "LyrI" );
var list1 = new ActionList();
list1.putInteger( 3 );
desc2.putList( idLyrI, list1 );
executeAction( idslct, desc2, DialogModes.NO );
};
var id3 = charIDToTypeID( "slct" );
var desc2 = new ActionDescriptor();
var id4 = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var id5 = charIDToTypeID( "Lyr " );
var id6 = charIDToTypeID( "Ordn" );
var id7 = charIDToTypeID( "Bckw" );
ref1.putEnumerated( id5, id6, id7 );
desc2.putReference( id4, ref1 );
var id8 = charIDToTypeID( "MkVs" );
desc2.putBoolean( id8, false );
executeAction( id3, desc2, DialogModes.NO );

// =======================================================
var id9 = charIDToTypeID( "setd" );
var desc3 = new ActionDescriptor();
var id10 = charIDToTypeID( "null" );
var ref2 = new ActionReference();
var id11 = charIDToTypeID( "Lyr " );
var id12 = charIDToTypeID( "Ordn" );
var id13 = charIDToTypeID( "Trgt" );
ref2.putEnumerated( id11, id12, id13 );
desc3.putReference( id10, ref2 );
var id14 = charIDToTypeID( "T " );
var desc4 = new ActionDescriptor();
var id15 = charIDToTypeID( "Nm " );
desc4.putString( id15, "photoframe" );
var id16 = charIDToTypeID( "Lyr " );
desc3.putObject( id14, id16, desc4 );
executeAction( id9, desc3, DialogModes.NO );
// =======================================================
var id3 = charIDToTypeID( "slct" );
var desc2 = new ActionDescriptor();
var id4 = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var id5 = charIDToTypeID( "Lyr " );
var id6 = charIDToTypeID( "Ordn" );
var id7 = charIDToTypeID( "Frwr" );
ref1.putEnumerated( id5, id6, id7 );
desc2.putReference( id4, ref1 );
var id8 = charIDToTypeID( "MkVs" );
desc2.putBoolean( id8, false );
executeAction( id3, desc2, DialogModes.NO );

var id331 = charIDToTypeID( "setd" );
var desc68 = new ActionDescriptor();
var id332 = charIDToTypeID( "null" );
var ref40 = new ActionReference();
var id333 = charIDToTypeID( "Lyr " );
var id334 = charIDToTypeID( "Ordn" );
var id335 = charIDToTypeID( "Trgt" );
ref40.putEnumerated( id333, id334, id335 );
desc68.putReference( id332, ref40 );
var id336 = charIDToTypeID( "T " );
var desc69 = new ActionDescriptor();
var id337 = charIDToTypeID( "Nm " );
desc69.putString( id337, "IMAGE LAYER" );
var id338 = charIDToTypeID( "Lyr " );
desc68.putObject( id336, id338, desc69 );
executeAction( id331, desc68, DialogModes.NO );

// need to skip files Photoshop can't open
// could also be done via a file filter

Votes

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
Explorer ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

how to this script used in single click  and many open only jpeg file fill in selected layers

 

var newName =("layer name", "frame");

var layers = getSelectedLayers();
for (var i = 0; i < layers.length; i ++){
layers[i].name = newName;
}

function getSelectedLayers(){
var idGrp = stringIDToTypeID( "groupLayersEvent" );
var descGrp = new ActionDescriptor();
var refGrp = new ActionReference();
refGrp.putEnumerated(charIDToTypeID( "Lyr " ),charIDToTypeID( "Ordn" ),charIDToTypeID( "Trgt" ));
descGrp.putReference(charIDToTypeID( "null" ), refGrp );
executeAction( idGrp, descGrp, DialogModes.ALL );
var resultLayers=new Array();
for (var ix=0;ix<app.activeDocument.activeLayer.layers.length;ix++){resultLayers.push(app.activeDocument.activeLayer.layers[ix])}
var id8 = charIDToTypeID( "slct" );
var desc5 = new ActionDescriptor();
var id9 = charIDToTypeID( "null" );
var ref2 = new ActionReference();
var id10 = charIDToTypeID( "HstS" );
var id11 = charIDToTypeID( "Ordn" );
var id12 = charIDToTypeID( "Prvs" );
ref2.putEnumerated( id10, id11, id12 );
desc5.putReference( id9, ref2 );
executeAction( id8, desc5, DialogModes.NO );
return resultLayers;
}
// Cycle forwards through open doc windows
var idselect = stringIDToTypeID("select");
var desc410 = new ActionDescriptor();
var idnull = stringIDToTypeID( "null" );
var ref119 = new ActionReference();
var iddocument = stringIDToTypeID( "document" );
ref119.putOffset( iddocument, 1 ); // -1 to cycle backwards through open doc windows
desc410.putReference( idnull, ref119 );
var iddocumentID = stringIDToTypeID( "documentID" );
executeAction( idselect, desc410, DialogModes.NO );
// =======================================================
var id33 = charIDToTypeID( "setd" );
var desc13 = new ActionDescriptor();
var id34 = charIDToTypeID( "null" );
var ref5 = new ActionReference();
var id35 = charIDToTypeID( "Chnl" );
var id36 = charIDToTypeID( "fsel" );
ref5.putProperty( id35, id36 );
desc13.putReference( id34, ref5 );
var id37 = charIDToTypeID( "T " );
var id38 = charIDToTypeID( "Ordn" );
var id39 = charIDToTypeID( "Al " );
desc13.putEnumerated( id37, id38, id39 );
executeAction( id33, desc13, DialogModes.NO );

// =======================================================
var id40 = charIDToTypeID( "copy" );
executeAction( id40, undefined, DialogModes.NO );

// =======================================================
var id41 = charIDToTypeID( "setd" );
var desc14 = new ActionDescriptor();
var id42 = charIDToTypeID( "null" );
var ref6 = new ActionReference();
var id43 = charIDToTypeID( "Chnl" );
var id44 = charIDToTypeID( "fsel" );
ref6.putProperty( id43, id44 );
desc14.putReference( id42, ref6 );
var id45 = charIDToTypeID( "T " );
var id46 = charIDToTypeID( "Ordn" );
var id47 = charIDToTypeID( "None" );
desc14.putEnumerated( id45, id46, id47 );
executeAction( id41, desc14, DialogModes.NO );

// =======================================================
var id48 = charIDToTypeID( "Cls " );
executeAction( id48, undefined, DialogModes.NO );

// =======================================================
var id49 = charIDToTypeID( "slct" );
var desc15 = new ActionDescriptor();
var id50 = charIDToTypeID( "null" );
var ref7 = new ActionReference();
var id51 = charIDToTypeID( "Lyr " );
ref7.putName( id51, "frame" );
desc15.putReference( id50, ref7 );
var id52 = charIDToTypeID( "MkVs" );
desc15.putBoolean( id52, false );
executeAction( id49, desc15, DialogModes.NO );

// =======================================================
var id53 = charIDToTypeID( "past" );
var desc16 = new ActionDescriptor();
var id54 = charIDToTypeID( "AntA" );
var id55 = charIDToTypeID( "Annt" );
var id56 = charIDToTypeID( "Anno" );
desc16.putEnumerated( id54, id55, id56 );
executeAction( id53, desc16, DialogModes.NO );

// =======================================================
var id57 = stringIDToTypeID( "newPlacedLayer" );
executeAction( id57, undefined, DialogModes.NO );

var oldPref = app.preferences.rulerUnits
app.preferences.rulerUnits = Units.PIXELS;
var doc = activeDocument;
var iLayer = doc.activeLayer;

layerDown ();

var mLayerB = doc.activeLayer.bounds;
doc.activeLayer = iLayer;
var scale = Math.max((mLayerB[2]-mLayerB[0])/(iLayer.bounds[2]-iLayer.bounds[0]),(mLayerB[3]-mLayerB[1])/(iLayer.bounds[3]-iLayer.bounds[1]));
iLayer.resize (scale*100,scale*100);
iLayer.translate((mLayerB[0]+mLayerB[2])/2-(iLayer.bounds[0]+iLayer.bounds[2])/2,(mLayerB[1]+mLayerB[3])/2-(iLayer.bounds[1]+iLayer.bounds[3])/2);

function layerDown(){
var idslct = charIDToTypeID( "slct" );
var desc2 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idBckw = charIDToTypeID( "Bckw" );
ref1.putEnumerated( idLyr, idOrdn, idBckw );
desc2.putReference( idnull, ref1 );
var idMkVs = charIDToTypeID( "MkVs" );
desc2.putBoolean( idMkVs, false );
var idLyrI = charIDToTypeID( "LyrI" );
var list1 = new ActionList();
list1.putInteger( 3 );
desc2.putList( idLyrI, list1 );
executeAction( idslct, desc2, DialogModes.NO );
};
function (layer)
{
var idnewPlacedLayer = stringIDToTypeID( 'newPlacedLayer' );
executeAction(idnewPlacedLayer, undefined, DialogModes.NO);
}
var oldPref = app.preferences.rulerUnits
app.preferences.rulerUnits = Units.PIXELS;
var doc = activeDocument;
var iLayer = doc.activeLayer;

layerDown ();

var mLayerB = doc.activeLayer.bounds;
doc.activeLayer = iLayer;
var scale = Math.max((mLayerB[2]-mLayerB[0])/(iLayer.bounds[2]-iLayer.bounds[0]),(mLayerB[3]-mLayerB[1])/(iLayer.bounds[3]-iLayer.bounds[1]));
iLayer.resize (scale*100,scale*100);
iLayer.translate((mLayerB[0]+mLayerB[2])/2-(iLayer.bounds[0]+iLayer.bounds[2])/2,(mLayerB[1]+mLayerB[3])/2-(iLayer.bounds[1]+iLayer.bounds[3])/2);

clip ();

function clip(){
var idGrpL = charIDToTypeID( "GrpL" );
var desc7 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref6 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref6.putEnumerated( idLyr, idOrdn, idTrgt );
desc7.putReference( idnull, ref6 );
executeAction( idGrpL, desc7, DialogModes.NO );
};

function layerDown(){
var idslct = charIDToTypeID( "slct" );
var desc2 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idBckw = charIDToTypeID( "Bckw" );
ref1.putEnumerated( idLyr, idOrdn, idBckw );
desc2.putReference( idnull, ref1 );
var idMkVs = charIDToTypeID( "MkVs" );
desc2.putBoolean( idMkVs, false );
var idLyrI = charIDToTypeID( "LyrI" );
var list1 = new ActionList();
list1.putInteger( 3 );
desc2.putList( idLyrI, list1 );
executeAction( idslct, desc2, DialogModes.NO );
};
var id3 = charIDToTypeID( "slct" );
var desc2 = new ActionDescriptor();
var id4 = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var id5 = charIDToTypeID( "Lyr " );
var id6 = charIDToTypeID( "Ordn" );
var id7 = charIDToTypeID( "Bckw" );
ref1.putEnumerated( id5, id6, id7 );
desc2.putReference( id4, ref1 );
var id8 = charIDToTypeID( "MkVs" );
desc2.putBoolean( id8, false );
executeAction( id3, desc2, DialogModes.NO );

// =======================================================
var id9 = charIDToTypeID( "setd" );
var desc3 = new ActionDescriptor();
var id10 = charIDToTypeID( "null" );
var ref2 = new ActionReference();
var id11 = charIDToTypeID( "Lyr " );
var id12 = charIDToTypeID( "Ordn" );
var id13 = charIDToTypeID( "Trgt" );
ref2.putEnumerated( id11, id12, id13 );
desc3.putReference( id10, ref2 );
var id14 = charIDToTypeID( "T " );
var desc4 = new ActionDescriptor();
var id15 = charIDToTypeID( "Nm " );
desc4.putString( id15, "photoframe" );
var id16 = charIDToTypeID( "Lyr " );
desc3.putObject( id14, id16, desc4 );
executeAction( id9, desc3, DialogModes.NO );
// =======================================================
var id3 = charIDToTypeID( "slct" );
var desc2 = new ActionDescriptor();
var id4 = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var id5 = charIDToTypeID( "Lyr " );
var id6 = charIDToTypeID( "Ordn" );
var id7 = charIDToTypeID( "Frwr" );
ref1.putEnumerated( id5, id6, id7 );
desc2.putReference( id4, ref1 );
var id8 = charIDToTypeID( "MkVs" );
desc2.putBoolean( id8, false );
executeAction( id3, desc2, DialogModes.NO );

var id331 = charIDToTypeID( "setd" );
var desc68 = new ActionDescriptor();
var id332 = charIDToTypeID( "null" );
var ref40 = new ActionReference();
var id333 = charIDToTypeID( "Lyr " );
var id334 = charIDToTypeID( "Ordn" );
var id335 = charIDToTypeID( "Trgt" );
ref40.putEnumerated( id333, id334, id335 );
desc68.putReference( id332, ref40 );
var id336 = charIDToTypeID( "T " );
var desc69 = new ActionDescriptor();
var id337 = charIDToTypeID( "Nm " );
desc69.putString( id337, "IMAGE LAYER" );
var id338 = charIDToTypeID( "Lyr " );
desc68.putObject( id336, id338, desc69 );
executeAction( id331, desc68, DialogModes.NO );

 

Votes

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
Community Expert ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

Having the template and all of the separate images open at the same time will eat into available RAM.

 

Better to only have the template file open, then script the process by selecting a folder or files from the script.

Votes

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
Explorer ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

sorry to..how to this scripts single click to multi images used

quote

var newName =("layer name", "frame");

var layers = getSelectedLayers();
for (var i = 0; i < layers.length; i ++){
layers[i].name = newName;
}

function getSelectedLayers(){
var idGrp = stringIDToTypeID( "groupLayersEvent" );
var descGrp = new ActionDescriptor();
var refGrp = new ActionReference();
refGrp.putEnumerated(charIDToTypeID( "Lyr " ),charIDToTypeID( "Ordn" ),charIDToTypeID( "Trgt" ));
descGrp.putReference(charIDToTypeID( "null" ), refGrp );
executeAction( idGrp, descGrp, DialogModes.ALL );
var resultLayers=new Array();
for (var ix=0;ix<app.activeDocument.activeLayer.layers.length;ix++){resultLayers.push(app.activeDocument.activeLayer.layers[ix])}
var id8 = charIDToTypeID( "slct" );
var desc5 = new ActionDescriptor();
var id9 = charIDToTypeID( "null" );
var ref2 = new ActionReference();
var id10 = charIDToTypeID( "HstS" );
var id11 = charIDToTypeID( "Ordn" );
var id12 = charIDToTypeID( "Prvs" );
ref2.putEnumerated( id10, id11, id12 );
desc5.putReference( id9, ref2 );
executeAction( id8, desc5, DialogModes.NO );
return resultLayers;
}
// Cycle forwards through open doc windows
var idselect = stringIDToTypeID("select");
var desc410 = new ActionDescriptor();
var idnull = stringIDToTypeID( "null" );
var ref119 = new ActionReference();
var iddocument = stringIDToTypeID( "document" );
ref119.putOffset( iddocument, 1 ); // -1 to cycle backwards through open doc windows
desc410.putReference( idnull, ref119 );
var iddocumentID = stringIDToTypeID( "documentID" );
executeAction( idselect, desc410, DialogModes.NO );
// =======================================================
var id33 = charIDToTypeID( "setd" );
var desc13 = new ActionDescriptor();
var id34 = charIDToTypeID( "null" );
var ref5 = new ActionReference();
var id35 = charIDToTypeID( "Chnl" );
var id36 = charIDToTypeID( "fsel" );
ref5.putProperty( id35, id36 );
desc13.putReference( id34, ref5 );
var id37 = charIDToTypeID( "T " );
var id38 = charIDToTypeID( "Ordn" );
var id39 = charIDToTypeID( "Al " );
desc13.putEnumerated( id37, id38, id39 );
executeAction( id33, desc13, DialogModes.NO );

// =======================================================
var id40 = charIDToTypeID( "copy" );
executeAction( id40, undefined, DialogModes.NO );

// =======================================================
var id41 = charIDToTypeID( "setd" );
var desc14 = new ActionDescriptor();
var id42 = charIDToTypeID( "null" );
var ref6 = new ActionReference();
var id43 = charIDToTypeID( "Chnl" );
var id44 = charIDToTypeID( "fsel" );
ref6.putProperty( id43, id44 );
desc14.putReference( id42, ref6 );
var id45 = charIDToTypeID( "T " );
var id46 = charIDToTypeID( "Ordn" );
var id47 = charIDToTypeID( "None" );
desc14.putEnumerated( id45, id46, id47 );
executeAction( id41, desc14, DialogModes.NO );

// =======================================================
var id48 = charIDToTypeID( "Cls " );
executeAction( id48, undefined, DialogModes.NO );

// =======================================================
var id49 = charIDToTypeID( "slct" );
var desc15 = new ActionDescriptor();
var id50 = charIDToTypeID( "null" );
var ref7 = new ActionReference();
var id51 = charIDToTypeID( "Lyr " );
ref7.putName( id51, "frame" );
desc15.putReference( id50, ref7 );
var id52 = charIDToTypeID( "MkVs" );
desc15.putBoolean( id52, false );
executeAction( id49, desc15, DialogModes.NO );

// =======================================================
var id53 = charIDToTypeID( "past" );
var desc16 = new ActionDescriptor();
var id54 = charIDToTypeID( "AntA" );
var id55 = charIDToTypeID( "Annt" );
var id56 = charIDToTypeID( "Anno" );
desc16.putEnumerated( id54, id55, id56 );
executeAction( id53, desc16, DialogModes.NO );

// =======================================================
var id57 = stringIDToTypeID( "newPlacedLayer" );
executeAction( id57, undefined, DialogModes.NO );

var oldPref = app.preferences.rulerUnits
app.preferences.rulerUnits = Units.PIXELS;
var doc = activeDocument;
var iLayer = doc.activeLayer;

layerDown ();

var mLayerB = doc.activeLayer.bounds;
doc.activeLayer = iLayer;
var scale = Math.max((mLayerB[2]-mLayerB[0])/(iLayer.bounds[2]-iLayer.bounds[0]),(mLayerB[3]-mLayerB[1])/(iLayer.bounds[3]-iLayer.bounds[1]));
iLayer.resize (scale*100,scale*100);
iLayer.translate((mLayerB[0]+mLayerB[2])/2-(iLayer.bounds[0]+iLayer.bounds[2])/2,(mLayerB[1]+mLayerB[3])/2-(iLayer.bounds[1]+iLayer.bounds[3])/2);

function layerDown(){
var idslct = charIDToTypeID( "slct" );
var desc2 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idBckw = charIDToTypeID( "Bckw" );
ref1.putEnumerated( idLyr, idOrdn, idBckw );
desc2.putReference( idnull, ref1 );
var idMkVs = charIDToTypeID( "MkVs" );
desc2.putBoolean( idMkVs, false );
var idLyrI = charIDToTypeID( "LyrI" );
var list1 = new ActionList();
list1.putInteger( 3 );
desc2.putList( idLyrI, list1 );
executeAction( idslct, desc2, DialogModes.NO );
};
function (layer)
{
var idnewPlacedLayer = stringIDToTypeID( 'newPlacedLayer' );
executeAction(idnewPlacedLayer, undefined, DialogModes.NO);
}
var oldPref = app.preferences.rulerUnits
app.preferences.rulerUnits = Units.PIXELS;
var doc = activeDocument;
var iLayer = doc.activeLayer;

layerDown ();

var mLayerB = doc.activeLayer.bounds;
doc.activeLayer = iLayer;
var scale = Math.max((mLayerB[2]-mLayerB[0])/(iLayer.bounds[2]-iLayer.bounds[0]),(mLayerB[3]-mLayerB[1])/(iLayer.bounds[3]-iLayer.bounds[1]));
iLayer.resize (scale*100,scale*100);
iLayer.translate((mLayerB[0]+mLayerB[2])/2-(iLayer.bounds[0]+iLayer.bounds[2])/2,(mLayerB[1]+mLayerB[3])/2-(iLayer.bounds[1]+iLayer.bounds[3])/2);

clip ();

function clip(){
var idGrpL = charIDToTypeID( "GrpL" );
var desc7 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref6 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref6.putEnumerated( idLyr, idOrdn, idTrgt );
desc7.putReference( idnull, ref6 );
executeAction( idGrpL, desc7, DialogModes.NO );
};

function layerDown(){
var idslct = charIDToTypeID( "slct" );
var desc2 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idBckw = charIDToTypeID( "Bckw" );
ref1.putEnumerated( idLyr, idOrdn, idBckw );
desc2.putReference( idnull, ref1 );
var idMkVs = charIDToTypeID( "MkVs" );
desc2.putBoolean( idMkVs, false );
var idLyrI = charIDToTypeID( "LyrI" );
var list1 = new ActionList();
list1.putInteger( 3 );
desc2.putList( idLyrI, list1 );
executeAction( idslct, desc2, DialogModes.NO );
};
var id3 = charIDToTypeID( "slct" );
var desc2 = new ActionDescriptor();
var id4 = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var id5 = charIDToTypeID( "Lyr " );
var id6 = charIDToTypeID( "Ordn" );
var id7 = charIDToTypeID( "Bckw" );
ref1.putEnumerated( id5, id6, id7 );
desc2.putReference( id4, ref1 );
var id8 = charIDToTypeID( "MkVs" );
desc2.putBoolean( id8, false );
executeAction( id3, desc2, DialogModes.NO );

// =======================================================
var id9 = charIDToTypeID( "setd" );
var desc3 = new ActionDescriptor();
var id10 = charIDToTypeID( "null" );
var ref2 = new ActionReference();
var id11 = charIDToTypeID( "Lyr " );
var id12 = charIDToTypeID( "Ordn" );
var id13 = charIDToTypeID( "Trgt" );
ref2.putEnumerated( id11, id12, id13 );
desc3.putReference( id10, ref2 );
var id14 = charIDToTypeID( "T " );
var desc4 = new ActionDescriptor();
var id15 = charIDToTypeID( "Nm " );
desc4.putString( id15, "photoframe" );
var id16 = charIDToTypeID( "Lyr " );
desc3.putObject( id14, id16, desc4 );
executeAction( id9, desc3, DialogModes.NO );
// =======================================================
var id3 = charIDToTypeID( "slct" );
var desc2 = new ActionDescriptor();
var id4 = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var id5 = charIDToTypeID( "Lyr " );
var id6 = charIDToTypeID( "Ordn" );
var id7 = charIDToTypeID( "Frwr" );
ref1.putEnumerated( id5, id6, id7 );
desc2.putReference( id4, ref1 );
var id8 = charIDToTypeID( "MkVs" );
desc2.putBoolean( id8, false );
executeAction( id3, desc2, DialogModes.NO );

var id331 = charIDToTypeID( "setd" );
var desc68 = new ActionDescriptor();
var id332 = charIDToTypeID( "null" );
var ref40 = new ActionReference();
var id333 = charIDToTypeID( "Lyr " );
var id334 = charIDToTypeID( "Ordn" );
var id335 = charIDToTypeID( "Trgt" );
ref40.putEnumerated( id333, id334, id335 );
desc68.putReference( id332, ref40 );
var id336 = charIDToTypeID( "T " );
var desc69 = new ActionDescriptor();
var id337 = charIDToTypeID( "Nm " );
desc69.putString( id337, "IMAGE LAYER" );
var id338 = charIDToTypeID( "Lyr " );
desc68.putObject( id336, id338, desc69 );
executeAction( id331, desc68, DialogModes.NO );

Having the template and all of the separate images open at the same time will eat into available RAM.

 

Better to only have the template file open, then script the process by selecting a folder or files from the script.


By @Stephen_A_Marsh

 

Votes

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
Explorer ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

Single click than selected layer rename and open image fill in selected layers)

Votes

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
Explorer ,
Jan 28, 2023 Jan 28, 2023

Copy link to clipboard

Copied

how to open jpeg image fill in only selected  layer ...?FNCXB7GrPi.png

Votes

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