2013-06-11 2 views
0

여기있는 모든 유용한 사람들 덕분에 InDesign CS6에 대한 많은 양의 스크립팅을 배웠습니다! 나는 계속 돌아오고 싶지 않지만, 때때로 나는 때때로 벽돌 벽에 뛰어 드는 것을 발견한다. 이제는 문서의 printPreferences를 설정하는 데 문제가 있습니다. 여기 내가 가지고있는 코드 :InDesign에서 printBlack printPreference를 설정할 수 없습니다.

with(document.printPreferences) { 
     activePrinterPreset = outputPreset; 
     pageRange = outputRange; 
     for (var j = 0; j < allInks.length; j++) { 
      document.inks.item(allInks[j]).printInk = false; 
     } 
     for (var k = 0; k < printInks.length; k++) { 
      if (printInks[k].toString() === "Black") { 
       $.writeln("Found Black!"); 
       printBlack = true; 
       $.writeln("Set Black!"); 
      } else { 
       document.inks.item(printInks[k]).printInk = true; 
      } 
     } 
     if (offsetJob) { 
      // If it's an offset job, we might need to change page sizes. 
      if (productType === "HI-N13W") { 
       paperSize = PaperSizes.custom; 
       paperHeight = 12.5; 
       paperWidth = 8.5; 
      } else if (productType.subString(3,5) === "PC") { 
       paperSize = PaperSizes.custom; 
       paperHeight = 8; 
       paperWidth = 12.5; 
      } else if (couldBeBothJobs.toString().indexOf(productType.subString(3,5)) > -1) { 
       paperSize = "US Letter"; 
      } else { 
       paperSize = PaperSizes.custom; 
       paperHeight = 8; 
       paperWidth = 25; 
      } 
     } 
    } 

두 번째 for 루프에서, 당신은 내가 먼저 인쇄 문서에 잉크를 모두 꺼져 것을 볼 수 있습니다. 그런 다음 printInks 어레이에있는 것만 켭니다. 그러나 배열에 "Black"이라는 단어가있는 경우 Ink가 없으므로 대신 내장 된 printPreference "printBlack"을 설정하려고합니다. (이 문자는 —의 printCyan, printMagenta 및 printYellow를 보완합니다.)

InDesign CS6 Object Model Reference에 따르면 부울 값일뿐입니다. 그러나 스크립트가 그 지점에 도달하면 스크립트가 중단됩니다. 새로운 문서에이 작은 코드 조각을 붙여 넣으면 오류 메시지가 나옵니다.

The property is not applicable in the current state. 

허? 이것은 무엇을 의미 하는가? 더 중요한 것은 어떻게 해결할 수 있습니까? 이 속성이 설정되기 전에 트래핑이 해제되어야한다는 것을 알고 있지만 확실히 해제되었는지 확인했습니다. 아무도 도와 줄 수 있습니까?

답변

0

Adobe Community Forums에서이 질문을 한 후에 인쇄 기본 설정 중 일부는 문서에서 직접 설정할 수 없지만 대신 인쇄 미리 설정에서 설정해야합니다. 그러면 인쇄 사전 설정이 활성으로 설정됩니다 프리셋 인쇄. 따라서 필자는 필요한 사전 설정을 다시 작성하여 새로운 임시 설정에 할당했습니다. 결과는 다음과 같습니다.

try { 
     tempPreset.name; 
    } 
    catch(eNoSuchPreset) { 
     tempPreset = app.printerPresets.add({name:"tempPreset"}); 
    } 

    // Let's turn off all of the spot colors before everything else. 
    for (var j = 0; j < allInks.length; j++) { 
     document.inks.item(allInks[j]).printInk = false; 
    } 

     with(document.printPreferences) { 
      tempPreset.printer = Printer.POSTSCRIPT_FILE; 
      tempPreset.ppd = "OYO Imagesetter"; 
      tempPreset.pagePosition = PagePositions.CENTERED; 
      tempPreset.paperSize = PaperSizes.CUSTOM; 
      tempPreset.paperHeight = "12.5 in"; 
      tempPreset.paperWidth = "6.5 in"; 
      tempPreset.colorOutput = ColorOutputModes.SEPARATIONS; 
      tempPreset.trapping = Trapping.OFF; 
      tempPreset.screening = "60 lpi/600 dpi"; 
      tempPreset.sendImageData = ImageDataTypes.OPTIMIZED_SUBSAMPLING; 
      pageRange = outputRange; 
      // Now let's turn off all of the CMYK colors. 
      tempPreset.printCyan = false; 
      tempPreset.printMagenta = false; 
      tempPreset.printYellow = false; 
      tempPreset.printBlack = false; 
      // Then we turn back on BLACK if it exists. 
      for (var k = 0; k < printInks.length; k++) { 
       if (printInks[k] === "Black") { 
        tempPreset.printBlack = true; 
       } else { 
        document.inks.item(printInks[k]).printInk = true; 
       } 
      } 
      // If this is a four-color process job, then turn back on all of the process colors. 
      if (processJob) { 
       tempPreset.printCyan = true; 
       tempPreset.printMagenta = true; 
       tempPreset.printYellow = true; 
       tempPreset.printBlack = true; 
      } 
      // That concludes OYO seps. 
     } 
     var mydpp = document.printPreferences; 
     mydpp.activePrinterPreset = "tempPreset"; 

이렇게하면이 스크립트를 완성하는 데 99 %의 시간이 걸립니다. 예!!