indesign中的反向字符形成

Reverse character formation in indesign

所以我现在正在做的是浏览文本以找到以下脚注标记:.15,我想将其更改为 15.,其中 15 成为上标。有没有办法使用键绑定和可能的 GREP 来做到这一点?我可以应用涉及 grep 的新段落样式,只是不确定如何使其交换位置。另外,我不能自动搜索这个,因为还有其他情况 .15 不应该被交换。所以我只想 select 格式 .number 并将 selection 交换为 number. 并将数字更改为上标。

向 运行 建议一个脚本,但有 2 个问题: 1. 什么是target(doc?selected text?) 2. 如何过滤 "dotDigits" 的适当实例(仅限特定段落样式?)

代码可能是这样的:

#target indesign
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = "(\.)(\d+)";
app.changeGrepPreferences.changeTo = "";
var 
    mTarget = app.activeDocument,
    mFound = mTarget.findGrep(),
    cText;
// iterate through found texts
while (cText = mFound.pop())
    if (checkCondition(cText)) doJob(cText);
//
app.findGrepPreferences = app.changeGrepPreferences = null;
//
function checkCondition (testText) {
    var mRes = true;
    // how to filter proper instances of found text?
    return mRes;
    }
function doJob (testText) {
    testText.changeGrep();
    testText.characters.itemByRange(0,-2).position = Position.SUPERSCRIPT;
    }

警告: 目前 - 上述代码的目标是在整个文档中找到的每个实例

亚雷克

略微修改:

#target indesign
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = "(\.)(\d+)";
app.changeGrepPreferences.changeTo = "";
var 
    mTarget = app.activeDocument,
    mFound = mTarget.findGrep(),
    cText;
//
while (cText = mFound.pop())
    if (checkCondition(cText)) 
        doJob(cText);

alert ("No more found. Done.");
app.findGrepPreferences = app.changeGrepPreferences = null;
//
function checkCondition (testText) {
    if (testText.appliedParagraphStyle.name == "pstyle")
    return true;
    else return false;
    }
function doJob (testText) {
    testText.showText();
    if (!confirm("Replace?")) return;
    testText.changeGrep();
    testText.characters.itemByRange(0,-2).position = Position.SUPERSCRIPT;
    }

更改前询问("No"表示转到下一步)。

观看条件设置 ==> 应用 paraStyle.name == "pstyle"