Adobe InDesign-编写脚本在尖括号之间查找特定单词,并将其复制到列表中

Adobe InDesign-编写脚本在尖括号之间查找特定单词,并将其复制到列表中,adobe,adobe-indesign,Adobe,Adobe Indesign,如果我对这个问题的措辞不正确,请提前道歉。我对InDesign脚本一无所知,但这将解决我在公司遇到的一个工作流问题,因此我非常感谢所有人的帮助 我想找到InDesign文件中尖括号(即)之间的所有字符串,并将其导出到列表中。理想情况下,这个列表应该是一个单独的文档,但如果它可以被转储到文本框或其他什么东西中,那就好了 有什么办法吗?提前感谢您的帮助。这里有一些简单的事情: app.findGrepPreferences=NothingEnum.NOTHING; //to reset the Gr

如果我对这个问题的措辞不正确,请提前道歉。我对InDesign脚本一无所知,但这将解决我在公司遇到的一个工作流问题,因此我非常感谢所有人的帮助

我想找到InDesign文件中尖括号(即)之间的所有字符串,并将其导出到列表中。理想情况下,这个列表应该是一个单独的文档,但如果它可以被转储到文本框或其他什么东西中,那就好了


有什么办法吗?提前感谢您的帮助。

这里有一些简单的事情:

app.findGrepPreferences=NothingEnum.NOTHING; //to reset the Grep search
app.findGrepPreferences.findWhat = '<[^<]+?>'; //the word(s) you are searching
var fnd = app.activeDocument.findGrep (); //execute search
var temp_str = ''; //initialize an empty string
for (var i = 0; i < fnd.length; i++) { //loop through results and store the results
    temp_str += fnd[i].contents.toString() + '\r'; // add next found item text to string
}
var new_doc = app.documents.add (); //create a new document
app.scriptPreferences.measurementUnit = MeasurementUnits.POINTS; //set measurement units to points
var text_frame = new_doc.pages[0].textFrames.add({geometricBounds:[0,0,100,100]});// create a new text frame on the first page
text_frame.contents = temp_str; //output your text to the text frame in the new document
app.findgrepreferences=nothingeum.NOTHING//重置Grep搜索

app.findgrepreferences.findWhat='编写脚本以使用grep,然后使用结果数组导出文本文件或创建新的indesign文档。这应该让你开始: