Adobe 如何将indd文件内容复制并粘贴到另一个indd文件中?

Adobe 如何将indd文件内容复制并粘贴到另一个indd文件中?,adobe,copy-paste,extendscript,adobe-indesign,Adobe,Copy Paste,Extendscript,Adobe Indesign,我是indesign脚本方面的新手。所以我道歉,因为我无法发布我的试用版 目标: 我有一个indd文件,其中将有图形标题、标签等。我需要将内容(可编辑的图形)从其他indd文件复制到存在相关图形标签的该文件中 例如: 样本indd Some text Fig.1.1 caption some text 我需要复制figure1.indd的内容并粘贴到sample.indd文档中,其中存在Fig.1.1字符串,依此类推。现在我正在手动操作。但我应该让它自动化 所以,我需要一些提示如何使用e

我是indesign脚本方面的新手。所以我道歉,因为我无法发布我的试用版

目标:
我有一个indd文件,其中将有图形标题、标签等。我需要将内容(可编辑的图形)从其他indd文件复制到存在相关图形标签的该文件中

例如:
样本indd

Some text   
Fig.1.1 caption
some text
我需要复制figure1.indd的内容并粘贴到sample.indd文档中,其中存在
Fig.1.1
字符串,依此类推。现在我正在手动操作。但我应该让它自动化

所以,我需要一些提示如何使用extendscript实现它

我已经找到了下面类似的方法来实现这一点,但我没有任何进一步发展的线索,也不确定这种方法是否正确以获得我的结果。请帮帮我

myDocument=app.open(File("file.indd"),false);  //opening a file to get the content without showing.
myDocument.pages.item(0).textFrames.item(0).contents="some text"; 
//here I could set the content but I don't knw how to get the content

// ?????? Then I have to paste the content into active document.

如果您可以接受,您可以将indesign文件作为链接(place…)放置。因此,脚本可以尝试捕捉“fig…”字符串并进行导入。
请看一下使用finGrep()和place()命令的脚本。

我找到了符合我要求的脚本

var myDoc = File("sample.indd");//Destination File  
var myFigDoc = File("fig.indd");//Figure File  
app.open(File(myFigDoc));  
app.activeDocument.pageItems.everyItem().select();  
app.copy();  
app.open(File(myDoc));  
app.findGrepPreferences = app.changeGrepPreferences = null;  
app.findGrepPreferences.findWhat = "FIG. 1.1 ";//Figure caption text  
//app.findGrepPreferences.appliedParagraphStyle = "FigureCaption";//Figure Caption Style  
myFinds = app.activeDocument.findGrep();  
for(var i=0;i<myFinds.length;i++){  
    myFinds[i].insertionPoints[0].contents="\r";  
    myFinds[i].insertionPoints[0].select();  
    app.paste();  
}  
app.findGrepPreferences = app.changeGrepPreferences = null;
var myDoc=File(“sample.indd”)//目标文件
var myFigDoc=文件(“fig.indd”)//图形文件
app.open(文件(myFigDoc));
app.activeDocument.pageItems.everyItem().select();
app.copy();
app.open(文件(myDoc));
app.findgrepreferences=app.changegrepreferences=null;
app.findgrepreferences.findWhat=“图1.1 ";//图标题文本
//app.findgrepreferences.appliedParagraphStyle=“FigureCaption”;//图形标题样式
myFinds=app.activeDocument.findGrep();

对于(var i=0;ii如果我将一个文件链接放入文档中,我将如何获得我的输出?手动执行类似操作,打开一个indd文件。全选,复制并粘贴到目标indd文件中。我需要复制一个文件的内容,而不是一个文件。如果我这样做,
myTextFrame.place(文件(“fig.indd”);
它像图形一样放置(无框架不可编辑)。如果我选择全部并仅复制和粘贴,则它将作为可编辑图放置在目标中。我理解。您也可以使用app.select()/copy()/paste()…