Skip to main content
Participant
August 5, 2014
Question

Indd CS6 script request

  • August 5, 2014
  • 2 replies
  • 936 views

How would it be the javascript code to set the transparency blend space of a document to rgb in INDD CS6?

Pablo López

This topic has been closed for replies.

2 replies

Participant
August 7, 2014

I figure it out like this

var myFolder = Folder.selectDialog("Select Indesign Folder"); 

var myIndsnFiles = myFolder.getFiles("*.indd"); 

 

for(k=0; k<myIndsnFiles.length; k++) 

    app.open(myIndsnFiles); 

 

    app.activeDocument.transparencyPreferences.blendingSpace = BlendingSpace.RGB; 

    app.activeDocument.save();

 

    app.activeDocument.close(); 

 

    }

Jongware
Community Expert
Community Expert
August 17, 2014

Very good, congratulations!

Two very minor annotations (you did well so far):

1. app.open returns a Document, so you can use

   myDoc = app.open(..

   myDoc.transparencyPreferences.blendingSpace = ..

   myDoc.save();

(et cetera)

You can open a document without showing the file, which is usually faster - but then activeDocument will not work. (See app.open for that option).

2. No need to first do myDoc.save(), then myDoc.close(). See the options for document.close() -- you can close and save in one step.

Jongware
Community Expert
Community Expert
August 6, 2014

Pablo,

Browsing through the index of Adobe InDesign CS6 (8.0) Object Model JS, I see a BlendingSpace (enum): "Transparency blending space options." These are the values that can be assigned to (looking at the bottom of that page) "TransparencyPreference.blendingSpace". Following the TransparencyPreference link, you arrive at TransparencyPreference, and there at the bottom is where it's used: "Document.transparencyPreferences"

This suggests the full line

app.activeDocument.transparencyPreferences.blendingSpace = BlendingSpace.RGB;

should do it.

Participant
August 6, 2014

Wow, thank you very much.

Since I don´t know anything on scripting can you tell me how would it be if I want a whole script to:

open many indd files from a selected folder,

change the transparency blend space to rgbon the files,

save the files and close them?

Best.

Pablo López

TᴀW
Legend
August 6, 2014

You can use Peter Kahrel's script to batch process a folderfull of files.

Check it out here: http://indesignsecrets.com/creating-batch-pdfs.php

id-extras.com | InDesign tools & scripts for typesetters, form designers, and translators