* Save As under the new name
* Delete all but these two layers
This might be the best way, because otherwise:
1. You'd have to create a new document, with all properties of the other one (size, orientation, styles, ...)
2. You'd have to loop over these two layers and duplicate all items one by one -- 'duplicate' for a layer cannot be used cross-document.
Thanks you so much for your swift response would it be at all possible to show some syntax for the first option otherwise i have been able to copy one layer successfully over although i lose focus of the "activeDocument" and i can nolonger return to it even if i have a variable to it and i cannot find anywhere in any documentation something that will allow me to return focus to a specific window ! any help once again is greatly appreciated i thank all for their time !
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 !
Instead of activeDocument try app.documents(0) which should be the active document. The one you are adding would be app.documents(1)