2
我正在嘗試創建一個功能與SplitStory.jsx完全相同的InDesign腳本,只是它不需要先選擇一個線程文本框架,而是通過遍歷整個文檔中的線程/鏈接的所有。在JavaScript InDesign腳本中循環遍歷所有線程化文本框架?
這是我到目前爲止,但它似乎沒有做任何事情。我對腳本相當陌生。
main();
function main(){
//Make certain that user interaction (display of dialogs, etc.) is turned on.
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
if(app.documents.length != 0){
var myDoc = app.activeDocument;
var myStories = 0;
for (var i = 0; myDoc.stories.length > i; i++)
myStories = myDoc.stories[i];
mySplitStory(myStories);
myRemoveFrames(myStories);
}
else{
alert("Please open a document and try again.");
}
}
function mySplitStory(myStory){
var myTextFrame;
//Duplicate each text frame in the story.
for(var myCounter = myStory.textContainers.length-1; myCounter >= 0; myCounter --){
myTextFrame = myStory.textContainers[myCounter];
myTextFrame.duplicate();
}
}
function myRemoveFrames(myStory){
//Remove each text frame in the story. Iterate backwards to avoid invalid references.
for(var myCounter = myStory.textContainers.length-1; myCounter >= 0; myCounter --){
myStory.textContainers[myCounter].remove();
}
}
我覺得我需要添加一些mySplitStory(myStories);
像mySplitStory(myStories.currentStory);
,但我不能特別在網上找到這事(或在Adobe的腳本文件 - 但也許我不是在正確的地方尋找) 。
任何幫助將不勝感激!