插入点
app.activeDocument.textFrames[index].insertionPoints
InsertionPoint 对象的集合。
InsertionPoints.length
Section titled “InsertionPoints.length”app.activeDocument.textFrames[index].insertionPoints.length
集合中的元素数量。
数字;只读。
InsertionPoints.parent
Section titled “InsertionPoints.parent”app.activeDocument.textFrames[index].insertionPoints.parent
对象的容器。
对象;只读。
InsertionPoints.typename
Section titled “InsertionPoints.typename”app.activeDocument.textFrames[index].insertionPoints.typename
对象的类名。
字符串;只读。
InsertionPoints.index()
Section titled “InsertionPoints.index()”app.activeDocument.textFrames[index].insertionPoints.index(itemKey)
从集合中获取一个元素。
参数 | 类型 | 描述 |
---|---|---|
itemKey | 字符串, 数字 | 字符串或数字键 |
使用插入点添加空格
Section titled “使用插入点添加空格”// 创建一个新文档,添加文本,然后使用插入点在每个字符之间插入空格
var docRef = documents.add();var textRef = docRef.textFrames.add();textRef.contents = "Wouldn't you rather be scripting?";textRef.top = 400;textRef.left = 100;textRef.textRange.characterAttributes.size = 20;
redraw();
// 使用插入点在每个字符之间添加空格。var ip;for (var i = 0; i < textRef.insertionPoints.length; i += 2) { ip = textRef.insertionPoints[i]; ip.characters.add(" ");}