Script to copy layer in another open Document/group?

Hi, I know that this topic has been covered several times before. But to clarify, here's what I asked:

Copy the active layer/group into another document opened in Photoshop. The easiest way is to go to the «layer/double layer...» ». But it is very tedious. To begin with, when you choose this method and then select the document you want to copy in the menu drop-down, successfully, copy the layer/group for this document, but it is not auto-switch (unlock) in the document, he just copied in. You have to hit 'Ok', and then manually search through the open documents list via (window / * choose your document *) to get there. It is a nightmare when you try to do several times.

Here's what I asked:

It is possible to:

(a) copy the active layer/group in the Clipboard/memory

(b) switch to another document in Photoshop * via a personalized menu * which shows all existing documents

(c) one time positioned on the new document, paste this layer/group from the Clipboard into this document

.. is this possible?

At the very least, is there scripts that anyone knows of that allows the user to switch between existing documents via a custom instead of going to the window menu / * choose your document *?

Hi @boo radley 2013.

do you mean something like this?

// LayerPaste2anotherDoc.jsx
// https://forums.adobe.com/thread/1496531

// regards pixxxelschubser

var aDoc = app.activeDocument;
var AllDocs = app.documents;
var actLay = aDoc.activeLayer;

if (AllDocs.length > 1) {
var itemDoc = null;
actLay.copy ();

var win = new Window("dialog","Copy the active layer");
this.windowRef = win;
win.Txt1 = win.add ("statictext", undefined, "Paste in which open document?");
win.NewList=win.add ("dropdownlist", undefined, AllDocs);

win.NewList.selection = 0;
itemDoc = win.NewList.selection.index;

win.cancelBtn = win.add("button", undefined, "Abbruch");
win.quitBtn = win.add("button", undefined, "Ok");
win.defaultElement = win.quitBtn;
win.cancelElement = win.cancelBtn;
win.quitBtn.onClick = function() {
win.close();
}

win.NewList.onChange= function () {
    itemDoc = win.NewList.selection.index;
    return itemDoc;
    }

win.show();

app.activeDocument = app.documents[itemDoc];
app.activeDocument.paste();
app.refresh();
} else {
    alert ("No other documents open")
    }

Have fun

Tags: Photoshop

Similar Questions

  • Copy of 5 layers (or a set of layer) to another open document

    Hello

    I have 2 open documents. The former has 5 layers. I need these 5 layers to the second open document. And that's my problem. The 5 layers creates a composition. So if I copy one by one, the position related to other layers will change.

    In my script tried linking layers before copying. Without success. Tried to create a layerSet, but did not find any method to copy this layer defined in the second document :/

    No idea how to copy the 5 layers of another document?

    Thank you very much

    Gustavo.

    Using copy and paste or layer.duplicate? Duplicate will retain all the data layer including position. If the documents are of the same size and the res, dupped layer will be in the same place, they were in the original document.

    If you copy and paste you need to get the layer boundaries in the original Victorinox then use layer.translate to move them into the correct position after the paste.

  • Set the zoom level for all open documents

    I work with 2,3,4,5 and 6 open documents in Photoshop CC 2015.1.1 at a time.

    What is the easiest way to create a script that gets the number of open documents and defines a specific zoom on all open documents level?

    Basic workflow

    1. select images in Bridge

    Images of BR 2 - open in Photoshop

    3 - Photoshop > > window > > mosaic all vertically

    4 - run script defined zoom level

    The script must treat all documents open that not only active in operating the scipt.

    If (! documents.length) alert (' there is no open documents.) ', ' No. 'Document');

    else {}

    var saveActiveDoc = app.activeDocument;

    for (var i = 0; i)

    app.activeDocument = documents [i];

    runMenuItem (app.charIDToTypeID ("ActP"));

    runMenuItem (app.charIDToTypeID ("ZmOt"));

    runMenuItem (app.charIDToTypeID ("ZmOt"));

    }

    app.activeDocument = saveActiveDoc;

    }

  • Copy layer contained more docs open - crash inDesign

    Hello world

    As part of my workflow, I wrote a script which meant to copy the contents of a particular layer (in this case "the palette") of any document that you currently have active during any open document that start with the same name (IE. "order 2341 - big" would copy and replace the contents of the Layer palette in "order 2341 - small, but the script ignores all documents that do not begin with 'order 2341')."

    The problem is that the pasteInPlace(); component of my script crashes inDesign (I'm under CS 5.5). Curiously, if I stop the script before this point and paste the content manually it works fine, so it seems that it is only the script component that has the problem. Anyone would be able to take a look and see if there is something I am doing wrong, or if it's just a strange bug IDS?

    //script to copy contents of a specific layer over to all other opened documents that begin with the same name
    //written by Steve Eberhardt
    var myDocument = app.activeDocument;
    var docName = myDocument.name.match(/[^-]+/);
    var paletteLayer = null;
    var count = 0;
    
    
    paletteLayer = app.activeDocument.layers.itemByName("palette");
    var paletteObjects = app.activeDocument.layers.itemByName("palette").allPageItems;
    app.select(paletteObjects);
    app.copy();
    
    
    var docs = new Array();
    for (var i = app.documents.length - 1; i >= 0; i--) {
        docs.push(app.documents[i].name);
    }
    
    
    for (var i = 0; i < docs.length; i++) {
        app.activeDocument = app.documents.itemByName(docs[i]);
        var otherDoc = app.activeDocument.name.match(/[^-]+/);
        if (docName.toSource() == otherDoc.toSource() && app.activeDocument != myDocument) {
            paletteLayer = app.activeDocument.layers.itemByName("palette");
            app.select(paletteLayer.allPageItems);
            try {
                var paletteGroup = new Array;
                paletteGroup = app.selection;
                app.activeDocument.groups.add(paletteGroup);
            } catch (_) {}
            paletteLayer.groups[0].remove();
            app.pasteInPlace();//this action crashes indesign
        }
    }
    
    
    app.activeDocument = myDocument;
    alert("Copied " + myDocument.name.replace(/.indd$/, '') + " palette to " + count + " documents");
    

    Thank you!

    Hello

    I suggest using the method duplicate() instead of the user interface select - copy - paste

    Something like:

    var
      myDocument = app.activeDocument,
      docName = myDocument.name.match(/[^-]+/),
      paletteLayer = app.activeDocument.layers.itemByName("palette"),
      paletteObjects = paletteLayer.pageItems.everyItem(),
      docs = app.documents.everyItem().getElements(),
      i, otherDoc;
    for ( i = docs.length - 1; i >= 0; i-- ) {
        app.activeDocument = docs[i];
        otherDoc = docs[i].name.match(/[^-]+/);
        if (docName.toSource() == otherDoc.toSource() && app.activeDocument != myDocument) {
           paletteLayer = app.activeDocument.layers.itemByName("palette");
           paletteLayer.pageItems.everyItem().remove();
           paletteObjects.duplicate(paletteLayer);
           }
      }
    app.activeDocument = myDocument;
    

    Jarek

  • Copy a shape layer in another image?

    The only way I found to copy a shape from one image to the other layer is to have two footage in the editing pane and drag and drop the shape layer in the layers Panel on the other image.

    It is a rather painful process.  Is there another way to do it, I hope a keyboard combo?

    Ken

    One way is to use to duplicate the layer and in the destination menu choose the other open document.

    If your use of tab you should be able to drag the shape of the area of document using the tool go to the other tab and drop in the document.

  • Move or copy smartobject in another document

    I have a layer of smartobject with a layer mask that I want to move to another document using a script.

    Is this possible? If so, how? Otherwise, what is the best solution?

    In the following search http://forums.adobe.com/thread/873935?tstart=0 wire Michael L Hale attached function dupeActiveLayerToDocument()

    Note the dependence of the order of the document in the round of open documents in Photoshop...

  • Use Applescript to copy layer objects between documents

    I'm currently following script with AppleScript:

    1. the user selects the files of reference and target

    2. open reference file

    3. Select and copy objects on a specific layer to the Clipboard

    4. Paste the contents of the Clipboard in a specific layer in the target file

    The dictionary of InDesign CS3 has a copy command, but I encounter an error all sense, I try to use it

    copy v : copy the selection in the document window active the Clipboard.

    My script up to now:

    - prompt the user for the reference and the target files

    the value the reference_file to Choose file with guest ' select the InDesign of the reference file: " without invisible

    -the target_file choose file with guest the value "select the target file:

    say application «Adobe InDesign CS3»

    activate

    set myLayer to "Layer 1"

    Open reference_file

    say active document

    set reference_layer to reference object of ()layer myLayer( )

    choose all point page of reference_layer

    copy selection

    -narrow reference_file save no.

    end tell

    end tell

    ERROR MESSAGE:

    "Adobe InDesign CS3 was a mistake: selection in the active document does not include the message copy."

    Anyone know how to use the verb correctly copy?

    Hello:

    Try to use

    copy

    in itself, without following parameter. In my scripts, I tell the App to do, not the document or page.

    HTH,

    EGR

  • How to copy a layer Style to one layer to another PSE9

    I'm copying 'fx' of an image to another, but when I try to drag to the next picture, it doesn't seem to work someone could help

    I held the ALT key and dragging but no luck...

    Title of the message was edited by: Brett N

    One way is to copy and paste the layer styles:

    1. right click on the layer with the layer style, and then choose the copy layer Style

    2. choose another layer and right-click and choose Paste layer Style

    (or select all of the layers that you want to copy the layer style to choose the paste layer Style)

    The above work equally between different documents.

    (click on the screenshots below for more great views)

    Also available in the menu layer:

    copy layer style

    Paste the layer style

  • Copy a layer to another file...

    Is it possible to copy a layer in one single file to another?  I designed a model of Web site I want to understand the context in which I want to build the background mosaic in a separate file.  I like the results of the background in the original file, but don't want to start trying to figure out what I did.  The file was created a long time ago.  I just got the approval of the customer for him.  I tried to drag the layer I want in a new file, but it does not work.

    Thanks for the tips!

    Jules

    You could try layer > duplicate layer, then choose another open or new file as the destination.

    Also, you should be able to make a right click on the layer thumbnail and see in double layer listed.

    MTSTUNER

    Post edited by: MTSTUNER

  • How to "go to a page in another document" without close the currently open document?

    I created a form that uses a button to switch to another pdf document. This second document is included in the first document as an attachment so that the whole package can be sent to people in a single document.

    It works well but the problem is that when the button is selected the document that is already open is closed (albeit with a backup invites document).

    There seems to be no way to keep the existing document open, while the second document (the linked document) is open.

    Is there a solution to this?

    Go to the properties of the button and change the action "go to a page view".

    you have created. The option "open in" Edit and put to 'new window '.

  • Stretching / translating a layer into another document

    I have probably just my math, but given a limit of area of selection (or limits), I'm trying to resize it so that it is the size of a paper target, and then translate it so it is in the upper left corner, taking up the entire screen (so what is in the square selection occupies the entire screen.  Now if I duplicate the layer in the same document and resize it using the dimensions of the document and translate, it fills the entire screen.  However, if double layers in a target, document and scale and translate according to its dimensions, the layer is the right size, but madly out of position (most of the time off the page).  I think that the translation would be independent of the destination doc and based only on the magnitude and (minX, minY) from the selection box.

    Is my math off or y at - it something funny on duplicate a layer in another document?  I guess this is the first, but I continue to do it in my head and the math seems reasonable.

    var layer = app.activeDocument.activeLayer;
    layer.isBackgroundLayer = false;
    var layers = new Array (thumbnails.length);
    layers [0] = layer;
    for (var i = 0; i < layers.length; i ++) {}
    layers [i] = layer.duplicate (documentTarget);
    }

    var srcDocument = app.activeDocument;
    app.activeDocument = documentTarget;

    for each layer, through translation and resizing based on the size of the box
    for (var i = 0; i < layers.length; i ++) {}
    var selectionBox miniature = [i];


    var scaleX = documentTarget.width.as ("px") / (selectionBox ['maxX'] - selectionBox ["minX"]);
    var scaleY = documentTarget.height.as ("px") / (selectionBox ['Christmas'] - selectionBox ["minY"]);




    layers [i] .resize (scaleX * 100, scaleY * 100, AnchorPosition.TOPLEFT);
    layers [i] .translate (new UnitValue (-selectionBox ["minX"] * scaleX, 'px'),)
    new UnitValue (-selectionBox ["minY"] * scaleY, "px"));
    }





    }

    }

    .. Why would it be different if the layer is duplicated at the topleft of the paper target to 0,0 minX, minY?

    This is the point I was trying to do. This assumption is inaccurate. The duplicated layer is not 0,0 unless the two documents are the same size and resolution. To chip away at layer is centered in the new RFSO. Only when the sizes correspond to the positions will match. Otherwise the new top-left position could be anywhere including canvas (negative values).

    If you do not want to change the minX, minY, for some reason, you could add code to align the layer to the top left before the line translate.

    function align(type){
       var desc = new ActionDescriptor();
         var ref = new ActionReference();
           ref.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Lnkd" ));
       desc.putReference( charIDToTypeID( "null" ), ref);
       desc.putEnumerated( charIDToTypeID( "Usng" ),charIDToTypeID( "ADSt" ), charIDToTypeID( type ) );
       executeAction( charIDToTypeID( "Algn" ), desc, DialogModes.NO );;
    };
    function alignTopLeft(){
      align("AdTp");
      align("AdLf");
    };
    app.activeDocument.selection.selectAll();
    alignTopLeft();
    app.activeDocument.selection.deselect();
    
  • Preference script "Check links before opening Document."

    I'll try to find the VB script to change the "Check links before opening Document" box on the Panel in the Preferences dialog box file management? I have not found all documents referring to the articles links on this Panel.

    Bob

    Hello

    JavaScript:

    {with (App.linkingPreferences)}

    checkLinksAtOpen = true;

    findMissingLinksAtOpen = true;

    }

    Guess you'll find now

  • Run the Script on the Open Document event

    OK so I know about the spectacle of afterOpen and I think I understand how to use it, however, I do not understand how to open to a specific document.

    I don't want this script runs on all the documents that I opened, I would like to incorporate into a document and then run it whenever I open this document. Is this possible?

    Maybe run the script in the script label?

    Or I just put a script in the start Panel, and then create a session script that checks the name of each document open and then runs the script, if I have a match?

    Thank you

    As you chart put it in the startup scripts folder

    //startup script
    #targetengine "session"
    main();
    function main(){
        var myEventListener = app.eventListeners.add("afterOpen", excuteScriptLabel);
    }
    
    function excuteScriptLabel(myEvent){
              //The parent of the event is the document.
              var myDocument = myEvent.parent;
        if (myDocument.constructor.name == "Document") {
            if (myDocument.label != "")
                app.doScript(myDocument.label, ScriptLanguage.javascript);
        }
    }
    

    Then try this line on a document and save it, and then open the same file and a few others, you will notice that this code only run on this document:

    app.activeDocument.label = "alert (\"Yes\");";
    
  • I place a psd file with transparent background on another layer in my InDesign document. The b layer

    I placed a psd file with a transparent background on another layer in my InDesign document. The layer below has a color (RGB). When the psd file is placed, it changes the color on the layer below. I tried other psd files thinking that something is wrong with my file, but get the same result. I tried for days to figure this. Can someone help me?

    Edition > space of merger of transparency... and the changes to the Document RGB

  • How to copy a layer and its mask layer to another image?

    With the help of PSE9, how a copy a layer and its mask layer to another image?

    Online Help includes a topic on how to copy a layer but try the different methods in the help topic results in either nothing copied or just the layer without his mask layer is copied.  Thank you.

    How did you get a copy?  If you float your images so that they are both partially visible in the work area, make one with the being copied the active layer.  Then, drag the layer in the layers palette on the other image.  Now you should have both the layer mask on the second image.

    Jürgen

Maybe you are looking for

  • My UN-jailbroken iPhone 6 has been hacked

    Yes, Yes, I know what you mean... "there is no such thing as a malware on an UN-jailbroken device. Well well, my iPhone 6 has NEVER been jailbroken! I woke up the other night to the sound of a click on my phone. I was at the hotel and on their wifi (

  • Cannot change the brightness on Toshiba Tecra S11 with Win7 using the FN keys

    I can't change the brightness on Toshiba Tecra S11 with Win7 using the FN keys (disable audio and other work fine) when logged in as a normal user.Shortcuts keyboard console appears and pressing F6 or F7, the brightness is always set to level 1 (no m

  • Equium A110-252 gel in win 7

    Hi I have a big big problem with my laptop which is Equium A110-252. I installed win7 and I tried to install all compatible drivers, only those who say win 7 x 32, however my laptop keeps freezing at random times and I don't know why. I didn't have t

  • Reinstall the HP ENVY laptop operating system

    I picked up a nasty virus (WebSteroids) - spent three days with 3 different professionals and we were unable to clean on the browsers.  Came to the conclusion that the only way to recover is to re - install the operating system and software. Unfortna

  • Generation of QR code in offline mode

    Hello everyone. I want to help to generate a QR code in offline mode. Yes, I did try to generate a QR code using labview but when am online. I'm able to generate the qr code. I will attach my VI below for the online. Some1 can help me please.