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

Script to copy all layers names into keywords metadata...sorting files which have layers

Participant ,
May 22, 2015 May 22, 2015

Hello

I need script that can copy all layers names to some metadata field, like keywords all similar...In this way I can sort files which have layers to some subfolder

thanks

TOPICS
Scripting
832
Translate
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
Enthusiast ,
May 22, 2015 May 22, 2015

You would need a Photoshop script and it would need to open each file to get the layer information.

Translate
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
Participant ,
May 22, 2015 May 22, 2015

do you have it?

Translate
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
Enthusiast ,
May 22, 2015 May 22, 2015

It would have to be written, you could try asking in the Photoshop scripting forum.

Photoshop Scripting

Translate
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
Participant ,
May 24, 2015 May 24, 2015

After many many copy/paste trial/error I have finished script. CS6 on Windows. Someone can clean code. Error log go to Windows/temp for easy clean.

Script convert layered images to pdf format which I think is better than psd and into source subfolder PDFs. PDF parameters is in the script.

Script convert non-layered images to jpg format and into source subfolder JPGs. JPG parameters is in the script.

1. Copy script "Layered PSD-TIF to layered PDF_Non-layered to JPG.jsx" to C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\Presets\Scripts

2. Copy droplet "Layered PSD-TIF to layered PDF_Non-layered to JPG.exe" somewhere on pc.

3. Load actions set1 into action panel

4. Drop images onto droplet and wait.

download

http://1drv.ms/1LyMlGF

// 2015, use it at your own risk;

#target photoshop

if (app.documents.length > 0) {

var myDoc = app.activeDocument;

if (myDoc.layers.length == 1 && myDoc.layers[0].isBackgroundLayer == true) {

// Defines the active document that is opened

var docRef = app.activeDocument;

var imgName= docRef.name;

imgName = imgName.substr(0, imgName.length -4);

// Get name of Folder Path

var docFolder = docRef.fullName.parent;

var folderPath = docFolder.fsName;

// Create a sub-folder called PDFs in the working folder

var newPathFolder = new Folder( folderPath + "//JPGs/");

newPathFolder.create();

// Save Options for JPGs

var saveFile = new File( folderPath + "//JPGs/" + imgName + ".jpg");

SaveJPEG(saveFile, 10);

function SaveJPEG(saveFile, jpegQuality){

jpgSaveOptions = new JPEGSaveOptions();

jpgSaveOptions.embedColorProfile = false;

jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;

jpgSaveOptions.matte = MatteType.NONE;

jpgSaveOptions.quality = jpegQuality; // 10

activeDocument.saveAs(saveFile, jpgSaveOptions, true,Extension.LOWERCASE);

}

} else {

// Defines the active document that is opened

var docRef = app.activeDocument;

var imgName= docRef.name;

imgName = imgName.substr(0, imgName.length -4);

// Get name of Folder Path

var docFolder = docRef.fullName.parent;

var folderPath = docFolder.fsName;

// Create a sub-folder called PDFs in the working folder

var newPathFolder = new Folder( folderPath + "//PDFs/");

newPathFolder.create();

// Save Options for PDFs

pdfFile = new File( folderPath + "//PDFs/" + imgName + "_photoshop.pdf")

pdfSaveOptions = new PDFSaveOptions()

pdfSaveOptions.layers = true;

pdfSaveOptions.embedColorProfile = false;

pdfSaveOptions.PDFStandard = PDFStandard.NONE;

pdfSaveOptions.PDFCompatibility = PDFCompatibility.PDF17;

pdfSaveOptions.preserveEditing=true;

pdfSaveOptions.embedThumbnail=true;

pdfSaveOptions.optimizeForWeb = true;

pdfSaveOptions.downSample = PDFResample.NONE;

pdfSaveOptions.encoding = PDFEncoding.PDFZIP;

pdfSaveOptions.colorConversion = false;

pdfSaveOptions.profileInclusionPolicy = false;

pdfSaveOptions.alphaChannels = true;

// set to NONE to allow PDF Security Options. Permission is for Printing only. A common password

// needs to be added as soon as the file is saved without typing it in all the time

docRef.saveAs(pdfFile, pdfSaveOptions, true, Extension.LOWERCASE);

docRef.close(SaveOptions.DONOTSAVECHANGES);

}

};

Translate
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
Participant ,
May 25, 2015 May 25, 2015

better version which detect more than base set channels and bitmap images which cant be saved as jpg.

// 2015, use it at your own risk; 

#target photoshop 

if (app.documents.length > 0) {

    var myDoc = app.activeDocument; 

}

//DEFINIRANJE MODA

var modSlike = app.activeDocument.mode;

if(modSlike == DocumentMode.CMYK){modSlike = "CMYK";}

if(modSlike == DocumentMode.RGB){modSlike = "RGB";}

if(modSlike == DocumentMode.GRAYSCALE){modSlike = "GRAYSCALE";}

if(modSlike == DocumentMode.BITMAP){modSlike = "BITMAP";}

var dodatnihKanala = 0;

if(modSlike == "CMYK"){dodatnihKanala = myDoc.channels.length - 4;}

if(modSlike == "RGB"){dodatnihKanala = myDoc.channels.length - 3;}

if(modSlike == "GRAYSCALE"){dodatnihKanala = myDoc.channels.length - 1;}

if(modSlike == "BITMAP"){dodatnihKanala = myDoc.channels.length - 1;}

if(modSlike == "BITMAP"){

    // Defines the active document that is opened

    var docRef = app.activeDocument;

    var imgName= docRef.name;

    imgName = imgName.substr(0, imgName.length -4);

    

    // Get name of Folder Path

    var docFolder = docRef.fullName.parent;

    var folderPath = docFolder.fsName;

    

    // Create a sub-folder called TIFBitmaps in the working folder

    var newPathFolder = new Folder( folderPath + "//TIFBitmaps/");

    newPathFolder.create();

    

    // Save Options for TIFBitmaps 

    var saveFile = new File( folderPath + "//TIFBitmaps/" + imgName + ".tif"); 

    SaveTIFF(saveFile); 

    function SaveTIFF(saveFile){ 

    tiffSaveOptions = new TiffSaveOptions();  

    tiffSaveOptions.embedColorProfile = false;  

    tiffSaveOptions.alphaChannels = true;  

    tiffSaveOptions.byteOrder = ByteOrder.IBM;  

    tiffSaveOptions.layers = true; 

    tiffSaveOptions.imageCompression = TIFFEncoding.TIFFLZW; 

    tiffSaveOptions.layerCompression = LayerCompression.ZIP; 

    tiffSaveOptions.spotColors = true; 

    tiffSaveOptions.transparency = true; 

    activeDocument.saveAs(saveFile, tiffSaveOptions, true, Extension.LOWERCASE);  

    }   

}else if (myDoc.layers.length == 1 && myDoc.layers[0].isBackgroundLayer == true && dodatnihKanala == 0) { 

    // Defines the active document that is opened

    var docRef = app.activeDocument;

    var imgName= docRef.name;

    imgName = imgName.substr(0, imgName.length -4);

    

    // Get name of Folder Path

    var docFolder = docRef.fullName.parent;

    var folderPath = docFolder.fsName;

    

    // Create a sub-folder called PDFs in the working folder

    var newPathFolder = new Folder( folderPath + "//JPGs/");

    newPathFolder.create();

    

    // Save Options for JPGs 

    var saveFile = new File( folderPath + "//JPGs/" + imgName + ".jpg"); 

    SaveJPEG(saveFile, 10); 

    function SaveJPEG(saveFile, jpegQuality){ 

        jpgSaveOptions = new JPEGSaveOptions(); 

        jpgSaveOptions.embedColorProfile = false; 

        jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE; 

        jpgSaveOptions.matte = MatteType.NONE; 

        jpgSaveOptions.quality = jpegQuality; // 10

        activeDocument.saveAs(saveFile, jpgSaveOptions, true,Extension.LOWERCASE);

    }

} else { 

    // Defines the active document that is opened

    var docRef = app.activeDocument;

    var imgName= docRef.name;

    imgName = imgName.substr(0, imgName.length -4);

    

    // Get name of Folder Path

    var docFolder = docRef.fullName.parent;

    var folderPath = docFolder.fsName;

    

    // Create a sub-folder called PDFs in the working folder

    var newPathFolder = new Folder( folderPath + "//PDFs/");

    newPathFolder.create();

    

    // Save Options for PDFs

    pdfFile = new File( folderPath + "//PDFs/" + imgName + "_photoshop.pdf")

    pdfSaveOptions = new PDFSaveOptions()

    pdfSaveOptions.layers = true;

    pdfSaveOptions.embedColorProfile = false;

    pdfSaveOptions.PDFStandard = PDFStandard.NONE;

    pdfSaveOptions.PDFCompatibility = PDFCompatibility.PDF17;

    pdfSaveOptions.preserveEditing=true;

    pdfSaveOptions.embedThumbnail=true;

    pdfSaveOptions.optimizeForWeb = true;

    pdfSaveOptions.downSample = PDFResample.NONE;

    pdfSaveOptions.encoding = PDFEncoding.PDFZIP;

    pdfSaveOptions.colorConversion = false;

    pdfSaveOptions.profileInclusionPolicy = false;

    pdfSaveOptions.alphaChannels = true;

    

    // set to NONE to allow PDF Security Options. Permission is for Printing only. A common password

    // needs to be added as soon as the file is saved without typing it in all the time

    docRef.saveAs(pdfFile, pdfSaveOptions, true, Extension.LOWERCASE);

    docRef.close(SaveOptions.DONOTSAVECHANGES);

}

Translate
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 ,
Feb 07, 2016 Feb 07, 2016
LATEST

Try the following (it is for layered TIFF, however I presume it could also be made to work for PSD or PSB):

Find Layered TIFF Files

Translate
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