Copy link to clipboard
Copied
Hello,
i'm new to this forum but i use a lot of scripting for my workflow... and there is something i need to do :
i need to import all groups and layers from a local PSD file (that is "my master" with all guidelines from my client : position, spaces, size of product in the picture)
in a other open PSD file to compose the scene,
and i have 10-50 files to do each day.. and i cannot script this part, wich is a problem for me
somebody has the answer ?
Tanx a lot
Agathe
Copy link to clipboard
Copied
Is placing the file as a Smart Object is useless because you need the full Layer structure in the receiving file?
What trips you up so far?
How do you want to implement the thing – call a Script with the receiving document open, have a Script with a file or folder selection dialog to select the receiving documents, …?
I recently posted something that groups all Layers,
How do I select similar layers in Photoshop CC?
that might provide a starting pint as one can translate the group to another document.
Are unlinked (edited) Layer Masks/Vector Masks a possibility in the client file?
Copy link to clipboard
Copied
Yes i need all the layers structure of the first file, i tried smart object but doesn't match this condition
i'd better like to call a script with the second document open, but i'll take the solution that is possible to do !
i read your other post, in fact all my layers are already grouped in my first document, with all layers names and all tidy
is there a way to script something like : "open this file and " translate the group to another document" ?
in fact so far i am not able to go further than "classical" action in photoshop (registering in live the chain of action in my files) script menu ... i never found anywhere (in France) to teach me professionally the "command line" scipt that you use i guess.. i'm willing to but don't know where to start on the web (if you have an adress), and it is really limitating me for my work !
tanx for your help
Agathe
Copy link to clipboard
Copied
Supposing the receiving image is open and active and the client file really has everything in just on Group and this Group is the topmost Layer this might help:
// 2014, use it at your own risk;
#target photoshop
if (app.documents.length > 0) {
var myDocument = app.activeDocument;
var aFile = selectFile(false);
if (aFile) {
var theClientFile = app.open(aFile);
var theGroup = theClientFile.layers[0];
theGroup.duplicate(myDocument, ElementPlacement.PLACEATBEGINNING);
theClientFile.close(SaveOptions.DONOTSAVECHANGES)
}
};
////////////////////////////////////
////////////////////////////////////
////////////////////////////////////
////// select file //////
function selectFile (multi) {
if (multi == true) {var theString = "please select files"}
else {var theString = "please select one file"};
if ($.os.search(/windows/i) != -1) {var theFiles = File.openDialog (theString, '*.jpg;*.tif;*.psd;*.png', multi)}
else {var theFiles = File.openDialog (theString, getFiles, multi)};
////// filter files for mac //////
function getFiles (theFile) {
if (theFile.name.match(/\.(jpg|tif|psd|png)$/i) || theFile.constructor.name == "Folder") {
return true
};
};
return theFiles
};
To forego the file selection you could drop the lines referring to that and write the file path into (edited)
var theClientFile = app.open(new File(/*insert the proper path here*/));
Edit:
// 2014, use it at your own risk;
#target photoshop
if (app.documents.length > 0) {
var myDocument = app.activeDocument;
var theClientFile = app.open("…");// include the file’s fullName instead of the periods
var theGroup = theClientFile.layers[0];
theGroup.duplicate(myDocument, ElementPlacement.PLACEATBEGINNING);
theClientFile.close(SaveOptions.DONOTSAVECHANGES)
};
Copy link to clipboard
Copied
Just to make sure:
Paste the code from the previous into a new file in ExtendScript Toolkit and save it as a jsx-file into Photoshop’s Presets/Scripts-folder.
After restarting Photoshop the Script should be available under File > Scripts and can be assigned a Keyboard Shortcut directly, recorded into an Action, be used in a Configurator-Panel or started from ExtendScript Toolkit directly.
As for learning JavaScript for Photoshop you might want to check out »Adobe Intro To Scripting.pdf« and »Photoshop-CS6-Scripting-Guide.pdf«.
Copy link to clipboard
Copied
This post might help you get started with Photoshop Scripting.
Copy link to clipboard
Copied
the "command line" scipt
I don’t think the term is quite appropriate for automating task in Photoshop with Scripting.
As for an introduction to Photoshop Scripting this book
might be of interest, but it is not dedicated to Scripting primarily.
Copy link to clipboard
Copied
tanx a lot for all your informations,
c.pfaffenbichler i will first read all the pdf to be sure tu use correctly your code !
i'll let you know how i deal with your code ![]()
Do you know where i can find the two PSD ref you gave me ? i'll try a google search ![]()
Edit : i found the two PDF ![]()
in fact I have this book "power, speed..." but i didn't really find a solution, i'll take a better look
ojodegato tank you for your link, big help too , i need to learn to deal with all this to go further in my work !
really guys, so much help in one post... it's been months i'm looking to go further... tanx !
A
Copy link to clipboard
Copied
Adobe Photoshop Scripting | Adobe Developer Connection
»Adobe Intro To Scripting.pdf« should be part of the ESTK installation.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more