Skip to main content
Lara_seven
Known Participant
May 20, 2019
Answered

Batch processer for the CTLP to Tiff conversion

  • May 20, 2019
  • 2 replies
  • 926 views

Dear Friends

I need batch processer for the CTLP to Tiff conversion Script. I got one script from the Esko but is working in individual images but I want to create a bunch of CTLP image in one folder. It needs to convert.

Below script for your reference.

  1. /**
  2. * Sample scripts are provided as-is with no warranty of fitness for a particular purpose.
  3. * These scripts are solely intended to demonstrate techniques for accomplishing common tasks.
  4. * Additional script logic and error-handling may need to be added to achieve the desired results in your specific environment.
  5. *
  6. * It is up to the user to verify that his intended use of the offered automation functionality is compliant with any third party license agreement and/or other restrictions applicable to any non-Esko products.
  7. */ 
  8. inputs = ["~/Desktop/ctlp/Bear_Transparency_CT.ct"] 
  9. outputFolder = "~/Desktop" 
  10.  
  11. for (i=0;i<inputs.length;i++) 
  12.     var fileRef = new File(inputs); 
  13.     openctlp(fileRef); 
  14.     docRef = app.activeDocument; 
  15.  
  16.     outputFile = new File(outputFolder + "/"+ fileRef.name); 
  17.     var TiffSaveOptions = new TiffSaveOptions(); 
  18.     TiffSaveOptions.transparency = true; 
  19.     TiffSaveOptions.embedColorProfile = true; 
  20.     docRef.saveAs(outputFile, TiffSaveOptions, true, Extension.LOWERCASE); 
  21.     docRef.close(SaveOptions.DONOTSAVECHANGES); 
  22.  
  23. function openctlp() 
  24. var idOpn = charIDToTypeID( "Opn " ); 
  25.     var desc35 = new ActionDescriptor(); 
  26.     var idnull = charIDToTypeID( "null" ); 
  27.     desc35.putPath( idnull, fileRef ); 
  28.     var idAs = charIDToTypeID( "As  " ); 
  29.         var desc36 = new ActionDescriptor(); 
  30.         var idktra = charIDToTypeID( "ktra" ); 
  31.         desc36.putBoolean( idktra, true ); 
  32.         var idkgrd = charIDToTypeID( "kgrd" ); 
  33.         desc36.putBoolean( idkgrd, false ); 
  34.         var idisol = charIDToTypeID( "isol" ); 
  35.         desc36.putInteger( idisol, 0 ); 
  36.     var idEskoEskoCTLPFormat = stringIDToTypeID( "Esko Esko CT/LP Format" ); 
  37.     desc35.putObject( idAs, idEskoEskoCTLPFormat, desc36 ); 
  38. executeAction( idOpn, desc35, DialogModes.NO ); 

Thanks in Advance

Kalaimani .S

This topic has been closed for replies.
Correct answer Developer1009

Hi,

Although I have updated the code shared by so that you can run this process for all files in the selected folder. Above script process only one file because it has a single file in inputs.

Here is the updated code.

var folder = Folder.selectDialog ('Select the folder for processing.')

var files = folder.getFiles('*.ct');

outputFolder = "~/Desktop" 

 

for (i=0;i<files.length;i++) 

    var fileRef = new File(files); 

    openctlp(fileRef); 

    docRef = app.activeDocument; 

 

    outputFile = new File(outputFolder + "/"+ fileRef.name); 

    var TiffSaveOptions = new TiffSaveOptions(); 

    TiffSaveOptions.transparency = true; 

    TiffSaveOptions.embedColorProfile = true; 

    docRef.saveAs(outputFile, TiffSaveOptions, true, Extension.LOWERCASE); 

    docRef.close(SaveOptions.DONOTSAVECHANGES); 

 

function openctlp() 

var idOpn = charIDToTypeID( "Opn " ); 

    var desc35 = new ActionDescriptor(); 

    var idnull = charIDToTypeID( "null" ); 

    desc35.putPath( idnull, fileRef ); 

    var idAs = charIDToTypeID( "As  " ); 

        var desc36 = new ActionDescriptor(); 

        var idktra = charIDToTypeID( "ktra" ); 

        desc36.putBoolean( idktra, true ); 

        var idkgrd = charIDToTypeID( "kgrd" ); 

        desc36.putBoolean( idkgrd, false ); 

        var idisol = charIDToTypeID( "isol" ); 

        desc36.putInteger( idisol, 0 ); 

    var idEskoEskoCTLPFormat = stringIDToTypeID( "Esko Esko CT/LP Format" ); 

    desc35.putObject( idAs, idEskoEskoCTLPFormat, desc36 ); 

executeAction( idOpn, desc35, DialogModes.NO ); 

In the updated version of the script first, it will ask you to select the folder and then it will process all files with .ct extension present in the selected folder.

Hope this helps you.

2 replies

Inspiring
May 21, 2019

Hi,

You can post your question in the Photoshop Scripting forum.

Here is the link for the same

Photoshop Scripting

Thanks

Charu

Developer1009Correct answer
Inspiring
May 21, 2019

Hi,

Although I have updated the code shared by so that you can run this process for all files in the selected folder. Above script process only one file because it has a single file in inputs.

Here is the updated code.

var folder = Folder.selectDialog ('Select the folder for processing.')

var files = folder.getFiles('*.ct');

outputFolder = "~/Desktop" 

 

for (i=0;i<files.length;i++) 

    var fileRef = new File(files); 

    openctlp(fileRef); 

    docRef = app.activeDocument; 

 

    outputFile = new File(outputFolder + "/"+ fileRef.name); 

    var TiffSaveOptions = new TiffSaveOptions(); 

    TiffSaveOptions.transparency = true; 

    TiffSaveOptions.embedColorProfile = true; 

    docRef.saveAs(outputFile, TiffSaveOptions, true, Extension.LOWERCASE); 

    docRef.close(SaveOptions.DONOTSAVECHANGES); 

 

function openctlp() 

var idOpn = charIDToTypeID( "Opn " ); 

    var desc35 = new ActionDescriptor(); 

    var idnull = charIDToTypeID( "null" ); 

    desc35.putPath( idnull, fileRef ); 

    var idAs = charIDToTypeID( "As  " ); 

        var desc36 = new ActionDescriptor(); 

        var idktra = charIDToTypeID( "ktra" ); 

        desc36.putBoolean( idktra, true ); 

        var idkgrd = charIDToTypeID( "kgrd" ); 

        desc36.putBoolean( idkgrd, false ); 

        var idisol = charIDToTypeID( "isol" ); 

        desc36.putInteger( idisol, 0 ); 

    var idEskoEskoCTLPFormat = stringIDToTypeID( "Esko Esko CT/LP Format" ); 

    desc35.putObject( idAs, idEskoEskoCTLPFormat, desc36 ); 

executeAction( idOpn, desc35, DialogModes.NO ); 

In the updated version of the script first, it will ask you to select the folder and then it will process all files with .ct extension present in the selected folder.

Hope this helps you.

Lara_seven
Known Participant
May 21, 2019

Dear

Thanks for your help. it's very useful for the conversion.

pixxxelschubser
Community Expert
May 20, 2019

Are you really sure that this the right forum is?

Your code shows Photoshops Action Manager Code (AM-code). There is no equivalent in Illustrator scripting. Should I move your thread into Photoshop scripting?

Lara_seven
Known Participant
May 21, 2019

I don't know how to move the Photoshop Scripting. Kindly advice me.