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

Combine all your open documents in a single document

Contributor ,
Jul 26, 2016 Jul 26, 2016

Copy link to clipboard

Copied

Many times I find myself with many documents open and I have to select one by one to paste the original document

there is a method to do this automatically?

I would do this

open documents

1.png

port of the original document

2.png

I've been to and I have found nothing about this problem.

TOPICS
Actions and scripting

Views

842

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
Engaged ,
Jul 26, 2016 Jul 26, 2016

Copy link to clipboard

Copied

Hi Tssee,

Try this Code in batch processing.

PS: Record as action before run the batch process.

Screen Shot 2016-07-26 at 6.44.41 pm.png

#target photoshop

var activeDoc = app.activeDocument; //This stores the currently active document to the variable activeDoc

var DocName=activeDoc.name;

var originalDoc = app.documents.getByName("Untitled-1.psd");

main();

function main(){   

    if(app.activeDocument.name!=originalDoc.name){

        activeDoc.flatten;

        var layerRef = activeDoc.artLayers[0].duplicate(originalDoc, ElementPlacement.PLACEATBEGINNING);

        activeDoc.close( SaveOptions.DONOTSAVECHANGES );

        var layRef=originalDoc.artLayers.getByName("Background copy");

        layRef.name=DocName;

    }

}

- yajiv

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 ,
Jul 26, 2016 Jul 26, 2016

Copy link to clipboard

Copied

Someone on asked how to get all the pages in a PDF into a layer document for when opened by Photoshop each page was opened in its own document.

So I wrote the a little script for them to the put all the open documents into a new document then close all the document that were open.

The Close All but the new document is a prompted for option you can leave the documents open.  If they are layered document the new document will only have single composite layer for each document.

StackOpenDoc.jsx

/* ==========================================================

// 2016  John J. McAssey (JJMack)

// Stack the open Document Visible layer composite into a new 300 DPI document

// This script is supplied as is. It is provided as freeware.

// The author accepts no liability for any problems arising from its use.

// ======================================================= */

// enable double-clicking from Mac Finder or Windows Explorer

#target photoshop // this command only works in Photoshop CS2 and higher

// bring application forward for double-click events

app.bringToFront();

if (documents.length >= 2) { main(); }

else alert("multiple Document are not open in Photoshop");

///////////////////////////////////////////////////////////////////////////////

//                            main function                                  //

///////////////////////////////////////////////////////////////////////////////

function main() {

  var orig_ruler_units = app.preferences.rulerUnits;

  var orig_display_dialogs = app.displayDialogs;

  app.preferences.rulerUnits = Units.PIXELS; // set the ruler units to PIXELS

  app.displayDialogs = DialogModes.NO; // Set Dialogs off

  var closeDocs  = prompt("Should documents be Close without saving?", "Yes");

  var canvasSize = new Array(); // what size canvas is needed

  canvasSize=getDocDementions(); // get max width and height of open documents

  app.togglePalettes(); // toggle off palette so Photoshop will not need to update them

  var doc = app.documents.add( canvasSize[0], canvasSize[1], 300, "Stacked Opened Documents", NewDocumentMode.RGB, DocumentFill.TRANSPARENT ); // create a new document

  //for (var i=0;i<documents.length-1;i++) { // stack a layer for the open document into the new document

  for (var i=documents.length-2;i>-1;i--) { // stack a layer for the open document into the new document

  app.activeDocument = documents; // switch active document

  var layerName = app.activeDocument.name; // get document name

  app.activeDocument.selection.selectAll();           // select all

  try {app.activeDocument.selection.copy(true);} // copy composite of visible layers to clipboard

  catch (e) {try {app.activeDocument.selection.copy();} // copy composite of visible layers to clipboard

    catch (e) { } // empty

  }

  app.activeDocument.selection.deselect(); // deselect

  app.activeDocument = documents[documents.length-1]; // switch to newly created document

  try { app.activeDocument.paste(); } // paste on composite of visible layers

  catch (e) { app.activeDocument.artLayers.add(); } // add an empty layer

  app.activeDocument.activeLayer.name=layerName; // label layer with Document name

  }

  if ( closeDocs == "Yes" ) closeAllButOne(); // close all opened document except the newly created document

  app.togglePalettes(); // toggle user's palettes back on

  app.runMenuItem(charIDToTypeID(("FtOn"))); // fit the document to the screen

  app.displayDialogs = orig_display_dialogs; // Reset display dialogs

  app.preferences.rulerUnits = orig_ruler_units; // reset units to original settings

  }

///////////////////////////////////////////////////////////////////////////////

//                           main function end                               //

///////////////////////////////////////////////////////////////////////////////

function getDocDementions(){

    width=0;

  height=0;

  for (var i=0;i<documents.length;i++) { // look at open document sizes

     if (documents.width > width) width=documents.width;

  if (documents.height > height) height=documents.height;

  }

  return new Array(width, height); // return width and height

  }

function closeAllButOne(){ // close all opened document except the newly created document

  while  (documents.length>1) {

  app.activeDocument = documents[0];

  activeDocument.close(SaveOptions.DONOTSAVECHANGES);

  }

  }

JJMack

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 ,
Jul 26, 2016 Jul 26, 2016

Copy link to clipboard

Copied

Hi tssee@imgof.com​,

If I understand you right – try the out-of-box-script (in German Datei --> Skripten --> Dateien in Stapel laden …) in english File --> Scripts --> ??? Load Files into stack ???

Does this works for you?

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 ,
Jul 26, 2016 Jul 26, 2016

Copy link to clipboard

Copied

I found that load files into stack has a problems with the new documents canvas size. When files and or Open documents have vastly different size canvas. It seems to use the size of one of the document or files canvas size to size new document canvas ..  Many of the stack layers may be larger than canvas size.  You may need to add canvas so the canvas size will not clip layers in the stack.

JJMack

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
Contributor ,
Jul 27, 2016 Jul 27, 2016

Copy link to clipboard

Copied

I tried with File -> Scripts -> ??? Load Files into Stack ???

the problem that I must first save documents

my work process and the following

Load the room and I open raw files in photoshop

then I would unite in a single document as shown in the picture above

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 ,
Jul 27, 2016 Jul 27, 2016

Copy link to clipboard

Copied

The script I posted only works on open documents and they do NOT have to be saved. The can be new  unsaved documents.

JJMack

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
Contributor ,
Jul 27, 2016 Jul 27, 2016

Copy link to clipboard

Copied

LATEST

Thanks jjMack

and just what I needed

I do not mean saving open documents.

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