Move/Copy multiple Layers to other document  with Script

Hello, I have one question to how move or copy multiple layers to other document?.
With this script i can move one by one:
var docRef = app.activeDocument;
var moveLayer1 = docRef.artLayers.getByName('Title');
var moveLayer2 = docRef.artLayers.getByName('Background');
var moveTo = app.documents.getByName('Untitled-1');
var layerRef = moveLayer1.duplicate( moveTo, ElementPlacement.PLACEATBEGINNING);
var layerRef2 = moveLayer2.duplicate( moveTo, ElementPlacement.PLACEATBEGINNING);
but i need move two layer in one step....

var docRef = app.activeDocument;
select_layer("Title");
select_layer("Background", true);
var moveTo = app.documents.getByName('Untitled-1');
duplicate_active_layer(docRef, moveTo);
function select_layer(name, add_to_sel)
    try {
        var desc = new ActionDescriptor();
        var ref  = new ActionReference();
        ref.putName( charIDToTypeID( "Lyr " ), name);
        desc.putReference( charIDToTypeID( "null" ), ref );
        desc.putBoolean( charIDToTypeID( "MkVs" ), false );
        if (add_to_sel) desc.putEnumerated( stringIDToTypeID( "selectionModifier" ), stringIDToTypeID( "selectionModifierType" ), stringIDToTypeID( "addToSelection" ) );
        var ok = true;
        try { executeAction( charIDToTypeID( "slct" ), desc, DialogModes.NO ); } catch(e) { ok = false; }
        ref  = null;
        desc = null;
        return ok;
    catch (e) { alert(e); throw(e); }
function duplicate_active_layer(src_doc, dst_doc)
    try {
        app.activeDocument = src_doc;
        var d = new ActionDescriptor();
        var r1 = new ActionReference();
        r1.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
        d.putReference( charIDToTypeID( "null" ), r1 );
        var r2 = new ActionReference();
        r2.putName( charIDToTypeID( "Dcmn" ), dst_doc.name);
        d.putReference( charIDToTypeID( "T   " ), r2 );
        d.putInteger( charIDToTypeID( "Vrsn" ), 2 );
        executeAction( charIDToTypeID( "Dplc" ), d, DialogModes.NO );
        d = null;
        r1 = null;
        r2 = null;
    catch (e) { alert(e); throw (e); }

Similar Messages

  • Copying multiple layers

    Hi,
    I'm a newbie using Illustrator CS4.  I have an artboard that is full of graphics on multiple layers.  All I want to do is make a copy of this artboard but maintain all of the layers.  However, when I copy and paste all of the layers onto a blank artboard, then all of the graphics are pasted into a single layer.  Help, please?
    Thanks!

    In the Layer panel flyout (upper right) of the new document, make sure Paste Remembers Layers is checked.

  • Cannot copy a 2 column pages document with section breaks

    I have created a 5 page document with 2 columns on each page, section breaks dividing 3 sections so that I have a different header on each section. When I go to the edit menu, I cannot select "select all" and consequently, cannot copy and paste that whole document.
    Where did I go wrong?

    This should be asked in the iWebs forum.
    iWeb has set layouts. Choose the one you want say with 2 columns and then add your text/images to it.
    There are also iWeb video tutorials under the iWeb Help menu.
    Unfortunately Apple has chosen not to supply User Guides for iWeb, because it is "so obvious".
    Peter

  • Copy contents of 2 layers to new document with javascript

    Hi guys !
    Basically i have created a new cutfile generator for a Zund cutting machine we have here at work i have got it to the point where i can create a Registration mark layer and Cut layer now i would like to save this as a layered PDF as this is how the cutter software prefers it. What i would like to know is how with Javascript can I copy the contents of "Regmark" layer and "Cut" layer to a dynamically created new document ? Any thoughts on this will be greatly appreciated thanks so much !
    Regards,
    Bass

    Hi guys,
    Just something i forgot to add, the follow piece of code copies content of "Regmark" layer to new document but its going back and selecting contents of "Cut" layer i am unable to do thanks once again !
    var sourceDoc = app.activeDocument;
    sourceDoc.select(sourceDoc.layers.item("Regmark").pageItems)
    app.copy();
    var destinationDoc = app.documents.add();
    app.pasteInPlace();
    /* NEED SOMETHING HERE TO TAKE ME BACK TO sourceDoc */
    sourceDoc.select(sourceDoc.layers.item("Cut").pageItems)
    app.copy();
    /* ONCE AGAIN SOMETHING TO TAKE ME TO destinationDoc */
    app.pasteInPlace();
    I know im probably going about this all wrong but it's the only thing i can figure out from looking on forum and JS help thanks so much !
    Regards,
    Bass

  • Images in multiple projects or other workflow with a similar result?

    Maybe I'm doing this the wrong way, I'm new to Aperture and open to suggestions. What I have is a number of projects each of which contain some images I'd like to submit to a stock site. I thought that the best process would be to create a "Stock photo submissions" project, and copy the images into that. From there I can edit and annotate the photos, for example, noting where they are submitted.
    However, when I drag a photo to the project I get a stern-sounding warning about moving the photo. It does seem to still be linked in the previous project. However one day I might clean up the stock project, and it appears that this would delete them altogether?
    Suggestions?

    Images reside in 1 (and only 1) project.
    You can have multiple albums, and albums can hold images from many projects.
    However, if I were you, I'd use smart albums to do this instead. What I do is to create a keyword (I use _ISC for "iStock Candidate") for each picture I want to consider submitting to stock. Then I create a smart album for all images with that keyword. Voila, it's easy. No needing to worry about where they are. Any time you want to consider the image for stock, just add the keyword (you can use the keywords bar to simplify this).
    I further expand this as such
    _ISC - iStock Candidates (reconsider if I want to submit, then adjust and keyword)
    _ISS - iStock Submitted (photos I've submitted and am awaiting approval)
    _ISR - Photos iStock has rejected (they have a litany of reasons, some frustrating )
    _ISA - iStock Accepted -- on iStock and available for sale
    To "move" an image from a smart album to another, I click on the new keyword in my keywords panel, and then shift-click the old keyword which removes it from the image. Takes about a second.
    I also have codes like this for other stock services -- to ensure I don't submit the same image to multiple services and violate any exclusivity agreements I may have for specific images.
    There may be better ways, but using smart albums is very flexible and an easy way to not have to manually do anything other than click a button.

  • Scanning multiple pages into one document with an automatic document feeder

    when using automatic document feeder to scan in multiple pages - using the Image Capture app, this process does not work for more than 2 pages. However works perfectly in PC environment.
    Using a MacBook Pro with 10.8.4 and a Lexmark Interpret 405S All In One Scanner.
    Is there any other all in one device that can perform this function in a Mac environment?
    Please advise.

    Hi @FentyFly ,
    I see by your post that you would like to know how to scan multiple pages into one file. I would like to help you out today.
    From the HP Scan Software, click on the link for Advanced Settings, then uncheck Create a separate file for each scanned page.
    Here is a URL for how to scan and change the settings. Just select your operating system.
    Scan.
    What operating system are you using? How to Find the Windows Edition and Version on Your Computer.
    If you need further assistance, just let me know.
    Have a great day!
    Thank You.
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!
    Gemini02
    I work on behalf of HP

  • Copying multiple layers at once

    I have a multi-page document. On page 1 I have a rectangle on one layer, a text frame on a second layer, and a polygon on a third layer. I want to copy these three objects to each of the other pages in the document. I want each object to be in exactly the same position as it is on page 1 and on the same layer as on page 1. If I select the three objects and copy and paste, it puts them all on the same layer. Is there a way to keep them on their original layers when pasting?

    There's an option in the layers pallet : paste remembers layers. That will do what you want.

  • Move/copy a pict, in another folder with history

    Hello All,
    i did found a way to do this so it can be seen as a wish list item,
    i would like to be able to move a pic from a folder to another with history on it, let me explain.
    suppose i work on a shoot serie of car into nature, and find a delicious natural spot, castle, forest, even portrait, whatever.
    i import my car serie with all the images into ligthroom. in "mysupercarfolder" and see a pic who doesnt fit here, but i start tweak it, make it fun and pretty
    i want to be able to move it into "mysupernaturalimagesfolder" with all the history of my modifications.
    i'm missing something, or is that impossible ?

    That should do it, though !
    Are your files Read Only?

  • Scan and collate multiple pages to one document with hp8630

    How do I scan, collate and save a multiple page document into one pdf document utilizing an HP8630? Thank you.

    Hi , I understand that you would like to know how to scan and collate multiple documents into one file. I would be happy to help you.
    If you are using Windows, please try the following steps: From the HP Scan software, select Advanced Settings, click on the File tab and uncheck Create a separate file for each scanned image, this will allow multiple page scans to save to one file.    If you are using a Mac, try the following: From the Preview Software, once you have the scanned image, select PDF and check combine into single document below. From the Print and Scan window, select PDF and check combine into single document below. What operating system are you using?How to Find the Windows Edition and Version on Your Computer.Mac OS X: How Do I Find Which Mac OS X Version Is on My Computer? If you appreciate my efforts, please click the 'Thumbs up' button below. Thank You.

  • Move layers from one document to another

    I have two catalouges of about 200 pages in two different languages. Each language is at a seperate layer. I want to move one layer to the other document. I can do that without problems for one page (with copy/paste in place). But is it possible to do easily with so many pages? As far as Im aware it cant be done in InDesign CS4, but maybe there is a plug in that can do the work?
    Gert

    I have a script that may do the job... I try to send it, I have some problems with this forum software...
    Copy script to your indesigns script folder
    Open your source and target documents
    Backup them, results with scripts may sometimes be suprising, specially if script operates inside multiple documents
    Hide all the other layers, keep the one you want to copy visible
    Run the script
    Keep Visible layers only checked
    Hope it works
    Script is originally made in german by Martin Fischer.
    Direct link to script if attachment doesn´t work
    http://files.getdropbox.com/u/133381/copyLayers.jsxbin

  • How do you copy a selected area of multiple layers?

    I'm trying to create an animated gif using PS and I can't find out how to copy multiple layers. Right now I have 110 different layers and I want to select the same portion of every layer and copy it into a new file without flattening the image. So I want to be able to start, and end with, 110 layers. The 110 different layers are all separate pictures of my desktop and I want to crop out most of the desktop to focus on one area in particular. Is there anyway to do this?

    One could delete, select next layer, delete, select next layer … which should be Action-able.
    Or duplicate the image and crop it to the intended size.
    Or why not simply put the Layers into a Group and add a Layer Mask to that?

  • Convert multiple layers into separate smart objects

    I have multiple layers in a document that I want to make into separate smart objects.
    If I select them and choose "convert to smart object" in the Layers Panel fly out, it flattens the layers into 1 smart object.
    Can it be done, or do I need to make each layer a smart object one at a time.
    OR... let me back up
    I have several files in Bridge, I want to "load into Photoshop layers" using the TOOLS > Batch Command BUT have each file load as a smart object.
    Either way would be great!

    While these don't use the batch command, take a look at
    from within photoshop, File>Scripts>Load Files into Stack.
    For bridge try Dr. Browns Services:
    http://www.russellbrown.com/scripts.html
    If you have cs5, you can drag files from mini bridge into an existing
    photoshop document, for smart object layers, provided you have
    your preferences under general to place or drag raster images as smart objects.
    MTSTUNER

  • How to copy-paste frames from one document to other with there respective layers intact?

    Hi All,
         I am facing an issue while copy paste frames from one document to other. I have a 3 frames in first documents each one on different layer. First document has 3 layers. The second document too have 3 layers , I am copying frames from first document to scrapdata using 'ICopyCmdData ' and 'kCopyCmdBoss'. I have 'Paste Remembers Layers' menu 'Checked' on Layer panel. I am using following function to copy frames to scrapdata.
    bool16 copyStencilsFromTheTemplateDocumentIntoScrapData(PMString & templateFilePath)
         bool16 result = kFalse;
        do
            SDKLayoutHelper sdklhelp;
            PMString filePathItemsToBeCopiedFrom(templateFilePath);  //("c:\\test\\aa.indt");
            IDFile templateIDFile(filePathItemsToBeCopiedFrom);
            UIDRef templateDocUIDRef = sdklhelp.OpenDocument(templateIDFile);
            if(templateDocUIDRef == UIDRef ::gNull)                 
                break;
            ErrorCode err = sdklhelp.OpenLayoutWindow(templateDocUIDRef);
            if(err == kFailure)                 
                break;
            InterfacePtr<IDocument> templatedoc(templateDocUIDRef,UseDefaultIID());
            if(templatedoc == nil)               
                break;
            InterfacePtr<ISpreadList>templateSpreadUIDList(templatedoc,UseDefaultIID());
            if(templateSpreadUIDList == nil)                  
                break;
            IDataBase * templateDocDatabase = templateDocUIDRef.GetDataBase();
            if(templateDocDatabase == nil)                  
                break;
            UIDRef templateDocFirstSpreadUIDRef(templateDocDatabase, templateSpreadUIDList->GetNthSpreadUID(0));
            InterfacePtr<ISpread> templateSpread(templateDocFirstSpreadUIDRef, IID_ISPREAD);
            if(templateSpread == nil)                 
                break;
            UIDList templateFrameUIDList(templateDocDatabase);
            if(templateSpread->GetNthPageUID(0)== kInvalidUID)                  
                break;      
            templateSpread->GetItemsOnPage(0,&templateFrameUIDList,kFalse,kTrue);  
            InterfacePtr<ICommand> copyStencilsCMD(CmdUtils::CreateCommand(kCopyCmdBoss));
            if(copyStencilsCMD == nil)                
                break;
            InterfacePtr<ICopyCmdData> cmdData(copyStencilsCMD, IID_ICOPYCMDDATA);
            if(cmdData == nil)                 
                break;
            // Copy cmd will own this list
            UIDList* listCopy = new UIDList(templateFrameUIDList);
            InterfacePtr<IClipboardController> clipboardController(gSession,UseDefaultIID());
            if(clipboardController == nil)              
                break;
            ErrorCode status = clipboardController->PrepareForCopy();
            if(status == kFailure)                  
                break;
            InterfacePtr<IDataExchangeHandler> scrapHandler(clipboardController->QueryHandler(kPageItemFlavor));
            if(scrapHandler == nil)                 
                break;
            clipboardController->SetActiveScrapHandler(scrapHandler);
            InterfacePtr<IPageItemScrapData> scrapData(scrapHandler, UseDefaultIID());
            if(scrapData== nil)                
                break;
            UIDRef parent = scrapData->GetRootNode();
            cmdData->Set(copyStencilsCMD, listCopy, parent, scrapHandler);
            if(templateFrameUIDList.Length() == 0)       
                return kFalse;      
            else      
                status = CmdUtils::ProcessCommand(copyStencilsCMD);    
            if(status != kFailure)
              result = kTrue;
            sdklhelp.CloseDocument(templateDocUIDRef,kFalse,K2::kSuppressUI, kFalse);
        }while(kFalse);
        return result;
    After this I need to close first document. Now I am opening the second document from indt file which has same number of layers as first document. I am trying to paste frames from scrap data to second document using '' 'ICopyCmdData ' and 'kPasteCmdBoss' as shown in follwoing function
    bool16 pasteTheItemsFromScrapDataOntoOpenDocument(UIDRef &documentDocUIDRef )
        bool16 result = kFalse;
        do
               InterfacePtr<IClipboardController> clipboardController(gSession,UseDefaultIID());
                if(clipboardController == nil)
                    break;
               InterfacePtr<IDataExchangeHandler> scrapHandler(clipboardController->QueryHandler(kPageItemFlavor));
               if(scrapHandler == nil)               
                    break;
               InterfacePtr<IPageItemScrapData> scrapData(scrapHandler, UseDefaultIID());
                if(scrapData == nil)
                   break;
                     //This will give the list of items present on the scrap
                UIDList* scrapContents = scrapData->CreateUIDList();
                if (scrapContents->Length() >= 1)
                    InterfacePtr<IDocument> dataToBeSprayedDocument(documentDocUIDRef,UseDefaultIID());
                    if(dataToBeSprayedDocument == nil)
                       break;
                    InterfacePtr<ISpreadList>dataToBeSprayedDocumentSpreadList(dataToBeSprayedDocument,UseDef aultIID());
                    if(dataToBeSprayedDocumentSpreadList == nil)
                         break;
                    IDataBase * dataToBeSprayedDocDatabase = documentDocUIDRef.GetDataBase();
                    if(dataToBeSprayedDocDatabase == nil)
                         break;    
                    UIDRef spreadUIDRef(dataToBeSprayedDocDatabase, dataToBeSprayedDocumentSpreadList->GetNthSpreadUID(0));               
                    SDKLayoutHelper sdklhelp;
                    UIDRef parentLayerUIDRef = sdklhelp.GetSpreadLayerRef(spreadUIDRef);
                    InterfacePtr<IPageItemScrapData> localScrapData(scrapHandler, UseDefaultIID());
                    if(localScrapData == nil)
                        break;
                    if(parentLayerUIDRef.GetUID() == kInvalidUID)
                        break;
                    InterfacePtr<ICommand> pasteToClipBoardCMD (CmdUtils::CreateCommand(kPasteCmdBoss));
                    if(pasteToClipBoardCMD == nil)
                        break;
                    InterfacePtr<ICopyCmdData> cmdData(pasteToClipBoardCMD, UseDefaultIID());
                    if(cmdData == nil)
                        break;
                    if(scrapContents == nil)
                        break;               
                    PMPoint offset(0.0, 0.0);
                    cmdData->SetOffset(offset);
                    cmdData->Set(pasteToClipBoardCMD, scrapContents, parentLayerUIDRef );
                    ErrorCode status = CmdUtils::ProcessCommand(pasteToClipBoardCMD);
                    if(status == kSuccess)
                        CA("result = kTrue");
                        result = kTrue;
                }//end if (scrapContents->Length() >= 1)       
        }while(kFalse);
        return result;
         Here in above function its required to set Parent Layer UIDRef and because of this all frames are getting paste in one layer.
    Is there any way we can paste frame in there respective layers?
         Also I need to work this code with CS4 server and desktop indesign.
    Thanks in advance,
    Rahul Dalvi

    Try,
    // dstDoc must be FrontDocument
    InterfacePtr<ILayoutControlData> layoutData(Utils<ILayoutUIUtils>()->QueryFrontLayoutData());
    InterfacePtr<ICommand> createMasterFromMasterCmd(CmdUtils::CreateCommand(kCreateMasterFromMasterCmdBoss));
    createMasterFromMasterCmd->SetItemList(UIDList(srcMasterSpreadUIDRef));
    InterfacePtr<ILayoutCmdData> layoutCmdData(createMasterFromMasterCmd, UseDefaultIID());
    layoutCmdData->Set(::GetUIDRef(layoutData->GetDocument()), layoutData);
    CmdUtils::ProcessCommand(createMasterFromMasterCmd);

  • How to make a one-color fill images with masks in documents from our multiple layers ?

    Hello everyone!
    I`m to open PSD document with same layers. I need to:
    1. Save the jpg file (preview) in a certain place
    2. All layers with masks to make one-color fill instead of images with masks.
    Thanks
    This is way ?
    var theLayers = collectLayers(app.activeDocument, []);
    alert (theLayers.join("\n"));
    function collectLayers (theParent, allLayers) {//---------------------------------------------------
    if (!allLayers) {var allLayers = new Array}
       else {};
       for (var m = theParent.layers.length - 1; m >= 0;m--) {
          var theLayer = theParent.layers[m];
          if (theLayer.typename == "ArtLayer") {
               var bar = new Array;
               bar = theLayer.bounds
               l0= Math.abs(this.app.activeDocument.width - theLayer.bounds[2] - theLayer.bounds[0]);
               l1= Math.abs(this.app.activeDocument.height -theLayer.bounds[3] - theLayer.bounds[1]);
                if((l0+l1)>0) { // layer mask is set
                    // delete this layer
                    //create new layer
                    //create new mask from array bar
                    //fill selection
                allLayers.push(theLayer);
       return allLayers

    I may not quite follow.
    Would you mind posting an example (a screenshot with the Layers Panel visible for example) and an overview of the resulting images you want to produce?

  • Copying layers from one document to another problem?

    Hey there, so I have two documents of the same size (11 inches x 8.5 inches) and I am trying to copy some layers from an original document and move it to the second one. I'm doing this by just dragging the layers from the original to the new document. The problem is, the text or images are extremely smaller on the new document and if I blow them up, look really pixelated. What am I doing wrong? The original document is saved as a Photoshop PDF and I believe was made on CS4. I am currently using Photoshop CC 2014.

    Make sure the DPI/Resolution is the same for the new document as it is for the original.  Files created with 11x8.5 at 72 dpi will show up smaller on 11x8.5 at 300 dpi documents for example.  You can also right click on the layer and choose 'duplicate layer', then when the dialog open, select the name of the new document in the dropdown as the place to put the duplicate layer.  Either way, the dpi of both files should match.  Viewing the image size on the image menu can tell you the current DPI/Resolution.  Hope that helps with your problem some.  I'm not sure if the fact that the original is a PDF is causing an issue.

Maybe you are looking for