6 Replies Latest reply on Oct 12, 2009 9:48 PM by Yuliaart

    How to inforce specific color settings in InDesign CS4 js

    Yuliaart Level 1

      Hi, I need to set specific color settings when creating a pdf from InDesign in Java script (not as a preset). What I found in previous discutions is:

       

       

       

      #target InDesign
      app.ColorSettings.cmsSettings="MyColorSettings";

       


      ( in the Forum

       


      http://forums.adobe.com/message/1108248#1108248),

       

      which just somewhat make sence to me.

       

       

       

      I saved my MyColorSettings.csf file in color settings folder, but I am not sure how to tell the script to access it, and I am not sure that that's the only

      reason why the lines abouve don't work.

       

      Thank you for your help.

      Yulia

        • 1. Re: How to inforce specific color settings in InDesign CS4 js
          Kasyan Servetsky Level 5

          'C' in colorSettings should be lowercase:

           

          app.colorSettings.cmsSettings = "MyColorSettings";

          • 2. Re: How to inforce specific color settings in InDesign CS4 js
            Yuliaart Level 1

            Hi, thank you for clarification. I still need more help with it to make it work. So I have from OMV:

             

            app.colorSetting.cmsSettings="MyColorSettings";
            app.colorSetting.cmsSettingsList;
            app.colorSetting.cmsSettingsPath= File (Folder.desktop + "/PS_Hotfolder" + "/scripts" + "/MyColorSettings.csf");

             

            I am not sure how to make all of that to work together and I think I need an action to actually set/activate the settings.

             

            Thank you so much for your help.

            Yulia

            • 3. Re: How to inforce specific color settings in InDesign CS4 js
              Kasyan Servetsky Level 5

              app.colorSettings.cmsSettings = "MyColorSettings";

              Is the same as going to Edit > Color Settings in user interface and choosing "MyColorSettings" in Settings drop down.

               

              app.colorSetting.cmsSettingsList; — gives you a list of all available color management system settings — the same as in the above-mentioned drop down.

               

              cmsSettingsPath is the file path of the CSF file to use.

               

              As far as I understand, you should save your Color Settings in user interface first and then set it by script like so:

               

              if (IsInArray("MyColorSettings", app.colorSettings.cmsSettingsList)) {
                  app.colorSettings.cmsSettings = "MyColorSettings";
              }
              else {
                  alert("Color setting named \"MyColorSettings\" doesn't exist. Create it and try again.");
                  exit();
              }

               

              function IsInArray(myString, myArray) {
                  for (x in myArray) {
                      if (myString == myArray[x]) {
                          return true;
                      }
                  }
                  return false;
              }

               

              Notice that I check if it exists before applying it.

              • 4. Re: How to inforce specific color settings in InDesign CS4 js
                Yuliaart Level 1

                Thank you, Kasyan, very much. It works very well with file saved on my computer, now I need the scritp to be able to find that file on the server, so it could be accessed by anybody in the office. Here what I did, and I am not sure if I am defining the path correctly:

                 

                if (IsInArray("NDF_CmSetting_indd", app.colorSettings.cmsSettingsList)) {
                    app.colorSettings.cmsSettings = "NDF_CmSetting_indd";
                    app.colorSettings.cmsSettingsPath = "/SPACE" + "/ Prepress" + "/Export settings" + "/InDesign CS4" + "/ShowPDFoptions_CS4.jsx";
                }
                else {
                    alert("Color setting named \"NDF_CmSetting_indd\" can't be found. Please log into SPACE");
                    exit();
                }

                 

                function IsInArray(myString, myArray) {
                    for (x in myArray) {
                        if (myString == myArray[x]) {
                            return true;
                        }
                    }
                    return false;
                }

                 

                 

                Thank you very much.

                Yulia

                • 5. Re: How to inforce specific color settings in InDesign CS4 js
                  Kasyan Servetsky Level 5

                  Yulia, everything wrong in your script: first of all, setting cmsSettings and cmsSettingsPath at the same time makes no sense — this is the same as choosing a setting in Color Settings dialog and then clicking the Load button and selecting another setting — the second cancels the first. So, you need to set only cmsSettingsPath property. If you take a look at this property in OMV, you'll see that it requires File not String, as you are trying to set.

                   

                  I would use the following code:

                  var myPath = "/Volumes/SPACE/Prepress/Export settings/InDesign CS4/ShowPDFoptions_CS4.jsx";
                  var myFile = new File (myPath);
                  if (myFile.exists) {
                      app.colorSettings.cmsSettingsPath = myFile;
                  }
                  else {
                      alert("File \""+ myPath + "\" can't be found.");
                  }

                   

                  You don't mention if you use Mac OS or Windows, or both at your work.

                  On Mac volume name should be prepended with "/Volumes":

                  /Volumes/Remote/dir/file

                   

                  On Windows, to access a remote volume, use a uniform naming convention path name of the form

                  //servername/sharename.

                  Or, if you have a mapped network drive:

                  /Z/foldername/foldername/filename

                  Where Z is a letter corresponding to your drive.

                   

                  To find out the path to a file, you can also use the following script:

                  myFilePath = File.openDialog("Locate the file");

                  $.writeln(decodeURI (myFilePath));

                  It writes the path of the chosen file to console

                   

                  Kasyan

                  • 6. Re: How to inforce specific color settings in InDesign CS4 js
                    Yuliaart Level 1

                    Thank you, Kasyan.

                     

                    It's working now, and we are already using it. And yes we are on Mac.

                     

                    Thank you very much for your help.

                    Yulia