2016-11-09 19 views
0

今私が今行っていることは、脚注に次のマークを見つけるためにテキストをサーフィンしています。15.ここで15が上付き文字になります。 keybindとGREPを使ってこれを行う方法はありますか? grepを含む新しい段落スタイルを適用できますが、場所をスワップする方法はわかりません。また、私はこれを自動検索できません。.15を入れ替えないでください。だから私はちょうど.numberの形式を選択し、その選択をnumber.にスワップし、番号を上付き文字に変更したいと思う。indesignで文字を反転させる

答えて

2

Slightyは変更:

#target indesign 
app.findGrepPreferences = app.changeGrepPreferences = null; 
app.findGrepPreferences.findWhat = "(\\.)(\\d+)"; 
app.changeGrepPreferences.changeTo = "$2$1"; 
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; 
    } 

それは、変更前の求めている( "いいえ" の次に行く意味します)。

ウォッチ条件セット==>適用paraStyle.name == "pstyle"

+0

魅力のように機能するアイ、ありがとう! –

+0

'doJob'の' changeGrep'はドキュメント全体の* everything *を変更しませんか? – usr2564301

+1

いいえ。このメソッドのターゲットは、特定の見つかったインスタンスです。 – Cashmirek

0

スクリプトを実行するために提案するが、2つの質問があります:(?のみ、特定のparagrafスタイル) 1.ターゲット(?DOC選択したテキスト)が何である 2.「dotDigits」の適切なインスタンスをフィルタリングする方法が

コードは次のようになり得る:

#target indesign 
app.findGrepPreferences = app.changeGrepPreferences = null; 
app.findGrepPreferences.findWhat = "(\\.)(\\d+)"; 
app.changeGrepPreferences.changeTo = "$2$1"; 
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; 
    } 

警告:今のところ- 上記のコードのための目標は、全ドキュメントに見られるすべてのインスタンスである

Jarek

+0

jarekねえ、返信いただきありがとうございます。基本的に、私が "dotDigit"を見つけてそれをダブルクリックすると、常に両方が選択されるので、ターゲットは選択されます。 "dotDigit"フォーメーションは常に "pstyle"と呼べるスタイルで見つけられます。選択肢だけでホットキーを使ってこのスクリプトを起動できるのであれば、私は好きですか?安全な方法。乾杯! –

関連する問題