4 Replies Latest reply on Feb 12, 2009 11:19 PM by (bogdan_cosmin)

    Printing separations with applescript

      Hello, i have a lil bit of a problem with the following script so if someone just drop a hint i would appreciate it:

      Platform:
      MacOsX Leopard 10.4.11
      Indesign CS 2.0

      The values defined are:
      thedoc = document 1 of the Indesign Application
      pPages = a single number (e.g.: 2)
      presetUsed = string, name of the preset(in this case a preset with output set to separations and application built-in trapping)
      pcolors = string of colors to be printed in csv form, eg: Pantone XXX,Process Black ... etc.

      tell print preferences of theDoc
      set page range of print preferences of theDoc to pPages
      set (active printer preset) to presetUsed
      set profile to "Generic CMYK Profile"
      set bleed bottom to 10
      set bleed top to 10
      set bleed inside to 10
      set bleed outside to 10
      set mark offset to 0
      set (print ink of every ink of theDoc) to false

      set AppleScript's text item delimiters to ","

      if length of text items of pColors > 1 then
      set tItems to (text items of pColors)
      repeat with vC in tItems
      set (print ink of ink vC of theDoc) to true
      end repeat
      else
      set (print ink of ink pColors of theDoc) to true
      end if
      end tell
      tell theDoc
      print without print dialog
      end tell

      Now the problem: the problem is that when printing with the "print without print dialog" option, the program just prints all the plates ignoring the settings in the print preferences declaration. This is not the same when the "print with print dialog" option is used. When using that option everything seems to be fine. However i need to work it out without using the print dialog. Any help regarding this issue is highly appreciated.

      Thanks in advance and wish ya a wonderful day.
        • 1. Re: Printing separations with applescript
          Kasyan Servetsky Level 5
          Hi Bogdan,

          I don't have CS version, so I can't check your script. But I recomend you to save all print settings in a print preset and set it as active printer preset in your script. Another property you may need to set is page range, for example if you need to print each plate to a separate file/sheet.

          Kasyan

          tell application "Adobe InDesign CS3"
          
          set myPrintPrefs to print preferences of active document
          set active printer preset of myPrintPrefs to "Your preset name"
          end tell
          • 2. Re: Printing separations with applescript
            Level 1
            Thanks for your reply Kasyan. I really appreciate it.
            However the script i'm trying to work out is doing exactly the things that you've mentioned (having a printer preset that is set as the active printer preset) except that my script is modifying a few settings of that preset(that's because i need a lot of custom printing, and having a separate preset for each one would make me create a dozen presets). However the thing that i dun really get is why this works when using the print display dialog, and why it doesn't work without the print dialog. The thing that i really dun seem to understand ... why if i add after the "tell preferences" end tell the line:
            set numberOfActiveInks to (every ink of theDoc whose print ink is true)
            display dialog ((length of numberOfActiveInks) as string)
            will show the "correct" number of inks i want to be printed, but when it goes printing them it just prints them all. I'm pretty sure i'm overlooking something here but i dun seem to find out what exactly.

            Thanks again for your time and have a wonderful day.
            • 3. Re: Printing separations with applescript
              sstanleyau Level 4
              On 13/2/09 12:12 AM, "bogdan cosmin" <member@adobeforums.com> wrote:<br /><br />> the program just prints all the plates ignoring the settings in the print<br />> preferences declaration<br /><br />Why are treating inks as if they belong to print preferences? They actually<br />belong to the document; try addressing them outside your "tell print<br />preferences" block.<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au><br />AppleScript Pro Florida, April 2009 <a href=http://scriptingmatters.com/aspro>
              • 4. Re: Printing separations with applescript
                Level 1
                Thanks Shane for your response and suggestion.
                I tried moving the ink declaration out of the tell statement, but seems like this doesn't fix the problem. Again if i get the number of active inks just before the print statement, it shows the "correct" number of them but when printing them, it simply ignores settings and just prints all plates.

                Thanks again both of you, Kasyan and Shane, for your time, patience and suggestions.