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

Indd CS6 script request

Community Beginner ,
Aug 05, 2014 Aug 05, 2014

Copy link to clipboard

Copied

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

Pablo López

TOPICS
Scripting

Views

637

Translate

Translate

Report

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 ,
Aug 06, 2014 Aug 06, 2014

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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 Beginner ,
Aug 06, 2014 Aug 06, 2014

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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
People's Champ ,
Aug 06, 2014 Aug 06, 2014

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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 ,
Aug 06, 2014 Aug 06, 2014

Copy link to clipboard

Copied

What a timely article! Yup, no need to write a custom script when there is one that does the job.

This even allows you to run an 'external' script, wow! So Pablo, you would make a line-line script to set the RGB blend space, save it, then run *this* script to process a folder. Use the Run A Script checkbox and choose your blend-setting script. Then sit back and let the computer do its thing.

Votes

Translate

Translate

Report

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 ,
Aug 06, 2014 Aug 06, 2014

Copy link to clipboard

Copied

Note that the Scripting forum is not meant for "requesting scripts" (even though we have been seeing a lot of these, lately).

The Illustrator Scripting Forum makes this abundantly clear, right on the starting page:

scriptingforum.PNG

Unfortunately, for some reason a similar text does not appear on this forum, which may be the reason this one is flooded with "requests" and the Illustrator Scripting forum is not.

See also Re: Can you fix my script problem? for a very appropriate parable.

Bottom lines:

1. If you want someone to write you a script, hire a freelancer. If you want a free script, hire a freelancer and then don't pay him.

2. If you want to learn how to write scripts, read the documentation, then try for yourself.

See

InDesign developer documentation | Adobe Developer Connection

How do I start learning InDesign Scripting?

3. If you need help finding some object or function in InDesign, look in the online pages I pointed you to. Only if you cannot find it, ask.

4. Do not use titles such as "Why this unfunction", "Plz Correct My Script", "Need a script to [xxx]".

Votes

Translate

Translate

Report

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
Guide ,
Aug 06, 2014 Aug 06, 2014

Copy link to clipboard

Copied

"1. If you want someone to write you a script, hire a freelancer. If you want a free script, hire a freelancer and then don't pay him."

Cheered me up, thank you. LOL.

Votes

Translate

Translate

Report

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 Beginner ,
Aug 07, 2014 Aug 07, 2014

Copy link to clipboard

Copied

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(); 

 

    }

Votes

Translate

Translate

Report

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 ,
Aug 16, 2014 Aug 16, 2014

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

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