다음과 같은 경우가 있습니다. 페이지 항목을 새로운 Indesign 문서로 복사 한 다음 모든 속성을 비교하고 동등하지 않은 항목을 로그 파일로 작성해야합니다.텍스트 프레임을 다른 Indesign 파일로 복사 한 다음 구체적으로 지정하지 않고 속성을 비교하십시오.
나는 다음과 같은 코드를 사용하고 있습니다 :
var textFramesCollection = new Array();
var myDocHeight;
var myDocWidth;
main();
function main()
{
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
app.scriptPreferences.measurementUnit = MeasurementUnits.millimeters;
try
{
myDocHeight = app.activeDocument.documentPreferences.pageHeight;
myDocWidth = app.activeDocument.documentPreferences.pageWidth;
textFramesCollection = app.activeDocument.textFrames;
var newInddDoc = app.documents.add();
newInddDoc.documentPreferences.pageHeight = myDocHeight;
newInddDoc.documentPreferences.pageWidth = myDocWidth;
for(var j = 0; j < textFramesCollection.length; j++)
{
var myPageItem = newInddDoc.pages.item(0);
var newPageItem = textFramesCollection[j].duplicate(myPageItem) ;
comparePageItems(textFramesCollection[j], newPageItem);
}
//app.activeDocument.close(SaveOptions.NO);
}
catch(e)
{
alert(e);
}
}
function comparePageItems(pageItemOne, pageItemTwo)
{
try
{
var Log = checkTypeOfProperty (pageItemOne, pageItemTwo, "", false, "", 0);
logInfo(Log);// write in the log file
}
}
function checkTypeOfProperty(objOne, objTwo, path, isRecursive, strLog, level)
{
try
{
for (var property in objOne)
{
var propPath = property;
if (isRecursive)
{
propPath = path + "." + property;
}
try
{
if (typeof (objOne[property]) == 'object')
{
strLog = checkTypeOfProperty(objOne[property], objTwo[property], propPath, true, strLog);
}
else if (objOne[property] != objTwo[property])
{
strLog += typeof (objOne[property]) + " : " + propPath + " :: " + objOne[property]+ "\n";
}
}
catch(e)
{
}
}
return strLog;
}
catch(e)
{
}
}
때문에이 작업을 수행하는 다른 방법이 있나요,이 속성의 어떤으로 많은 시간을 복용하지 않습니다 너무 많이 있습니다.
방금 스크립트를 발견했습니다. 이 스크립트로 놀면서, 스크립트가 열거 형 이름을 추출 할 수 있다는 것을 알아 냈습니다 (값뿐만 아니라'NONE' 대신'ArrowHead.NONE'과 같은 정보를 추출 할 수 있습니다.) 최근에 그의 어도비 포럼에서 끝났지 만 InDesign CS6에서이 작업을 수행하는 방법을 파악하지 못했습니다. ID CS6에서 스크립트를 실행했는데 어떻게 든 효과가 있습니다. 열거 이름을 추출하는 방법을 설명 할 수 있습니까? 그래서 ArrowHead.NONE'의 'ArrowHead' 부분)? 감사합니다. – mdomino
스크립트로 올바른 형식을 추출 할 수 없다고 생각합니다. ID를 얻는 것뿐입니다. 나는 완전히 다른 것을했습니다 ... 나의 초기 출발점은 모든 기능, 값 및 열거 형을 포함하는 공식 InDesig xml 사양.이 xml을 구문 분석하고 모든 내부에 대해 알고있는 새로운 generator-jsx-script를 생성했습니다. 'ArrowHead.NONE'에 ID 1852796517이 저장되어 있습니다. 그렇다면 generator-jsx-script는 18527을 봅니다. 96517 ArrowHead 컨텍스트에서 다음 'ArrowHead를 인쇄합니다.NONE '을 추가합니다. BTW generator-jsx-script는 700KB입니다. :) – agreif
아, 알겠습니다. 설명해 주셔서 감사합니다. 이제 막 스크립트가 실제로 얼마나 큰지 깨달았습니다. 그래서 이것은 기본적으로 하드 코딩 된 검색 목록과 같습니다. 불행히도이 접근 방식을 제 목적에 실제로 사용할 수는 없습니다. 그래도 위대한 대본을 보내 주셔서 감사합니다! – mdomino