Copy link to clipboard
Copied
Hello,
I am working on automating a production pipeline process that should not require any man power for this part in the chain.
I need to be able to output a lot of files via the data set process and i would like to be able to do so without the need for the artist to open up Photoshop manually.
I figure it would be a javascript tool, but I havent touched photoshop API and would like a bit of guidance where to start.
I assume javascript would, trigger an instance of photoshop to load, apply the needed data set values, then save the files where i need them to go. then close photoshop.
Is this an easy process to script and do?
Thanks for any feedback
Have a look at this thread...
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Could you please provide more information?
I have gone through the scripting documents and references all day and I have not found how to handle Data Sets externally from Photoshop.
To reiterate, the process I am looking to do is:
Script opens PS
Applies Data Set from CSV
Saves result to folder
Copy link to clipboard
Copied
I doe not think you want scripting Photoshop look ate this instead Creating data-driven graphics in Photoshop
Copy link to clipboard
Copied
I know how data sets work,, I am looking for help to script these "Data-driven graphics".
I would like to have a script apply the data sets to my file so a human does not have to.
I hope I have cleared this up.
Copy link to clipboard
Copied
You need Templates, CSV and Image files for Data driven graphics. You are not going to be able to script the creation of Template PSD create CSV files and run the Photshop's Data Driven Graphic without a lot of design work to automate what you want. You need to design your pipeline and supply its sources so it can deliver product.
Copy link to clipboard
Copied
JJMack, I have all of that already designed and variables set and a CSV file made. I even have python code to generate CSV files the way I need them to.
The only missing piece was the Scripting phase for loading and applying datasets
Copy link to clipboard
Copied
Have a look at this thread...
Copy link to clipboard
Copied
Super Merlin
This gets me exactly where I need. Thank you
Copy link to clipboard
Copied
That good to hear. Its hard to know what to write when you do not know what one has to begin with. Not many use use Dataset with Photoshop.
I wish Mike Hale was still around
Copy link to clipboard
Copied
Anyone have expereince location old forum post?
Trying to locate this one, https://forums.adobe.com/thread/628182
It's a respond to this thread, Submit Batch of Data Set Variable Replacement externally?
Thanks!
Copy link to clipboard
Copied
Many old post have been archived. I contacted someone who can hopefully move the post, so it can be accessed again. He's checking into it.
Copy link to clipboard
Copied
I believe all post over three years have been removed which is bad news for Adobe users. All old links will simply be redirected to Adobe Support Community like the link you posted is.
Copy link to clipboard
Copied
The old post is now active:
Copy link to clipboard
Copied
That is good news now lets hope they fix search.
Copy link to clipboard
Copied
Unfortunately, I doubt that will happen. We discussed this at length last week with Adobe, and all we can do is give them the thread link and they will determine if it's justified to transfer it out of the archives. We asked if the moderators could at least view the threads, and the copy pertinent info into a new thread, but that was vetoed, because if we could see them, we could also transfer them, and they want to keep a strict control of what gets transferred back.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
r-bin, the link you posted just return with a 404 error... in russian.
Copy link to clipboard
Copied
I've managed to use wayback machine to look for the cached website and got this
https://web.archive.org/web/20100803014754/http://forums.adobe.com/thread/628182
Copy link to clipboard
Copied
the link is not durable, try this
Copy link to clipboard
Copied
It appears that I had archived at least one piece of code from May 2019 in that topic:
// forums.adobe.com/thread/628182
// forums.adobe.com/message/2773935#2773935
// It assumes that the activeDocument has datasets defined and uses the first fieldname in the dataset csv as the savename for the jpg
fileImportDataSets = function(file) {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putClass( stringIDToTypeID( "dataSetClass" ) );
desc.putReference( charIDToTypeID( "null" ), ref );
desc.putPath( charIDToTypeID( "Usng" ), new File( file ) );
desc.putEnumerated( charIDToTypeID( "Encd" ), stringIDToTypeID( "dataSetEncoding" ), stringIDToTypeID( "dataSetEncodingAuto" ) );
desc.putBoolean( stringIDToTypeID( "eraseAll" ), true );
desc.putBoolean( stringIDToTypeID( "useFirstColumn" ), true );
executeAction( stringIDToTypeID( "importDataSets" ), desc, DialogModes.NO );
}
applyDataSet = function(setName) {
var desc = new ActionDescriptor();
var setRef = new ActionReference();
setRef.putName( stringIDToTypeID( "dataSetClass" ), setName );
desc.putReference( charIDToTypeID( "null" ), setRef );
executeAction( charIDToTypeID( "Aply" ), desc, DialogModes.NO );
}
getDataSetNames = function(csvFileRef) {
_ftn = function(string){
var csvItems = string.split(",");
datasetName = csvItems[0]
return datasetName;
}
csvFileRef.open();
var datasetArray = new Array();
var i = 0;
while (csvString = csvFileRef.readln()) {
if (csvString.length < 2) continue; // Skip empty lines
datasetArray[i] = _ftn(csvString);
i++;
}
csvFileRef.close();
return datasetArray;
}
// jpeg options used for all the saves
var jpgOptns = new JPEGSaveOptions();
jpgOptns.formatOptions = FormatOptions.STANDARDBASELINE;
jpgOptns.embedColorProfile = true;
jpgOptns.matte = MatteType.NONE;
jpgOptns.quality = 8;
//prompt for file
var csvFileRef = File.openDialog("Please select CSV file");
fileImportDataSets(csvFileRef); //inport the CSV file into the template
var datasetNames = getDataSetNames(csvFileRef);// set up the dataset array
//setup a loop for your data set names
for (i=1; i < datasetNames.length; i++) {
applyDataSet(datasetNames[i]);
//edit the file if needed
//save the file. Here I use testItem.contents of layer 'name' as the filename
app.activeDocument.activeLayer = app.activeDocument.artLayers.getByName("name"); // double check that your layer name matches!
jpgSaveFile = new File(csvFileRef.path + "/" + app.activeDocument.activeLayer.textItem.contents + ".jpg");
app.activeDocument.saveAs (jpgSaveFile ,jpgOptns , true, Extension.LOWERCASE);
}//loop to next data set
Copy link to clipboard
Copied
I updated the link.