var doc = app.documents[0] ; var myStory = doc.selection[0].parentStory; function myFootnotes(){ for (i=grl-1; i>=0; i--) { var fn=gr[i].insertionPoints[0].footnotes.add(); //脚注を作成 gr[i].select(); //選択する var str =doc.selection[0].contents; //文字列を取得 doc.selection[0].remove(); //選択部分を削除 fn.texts[0].insertionPoints[-1].contents = str ; //脚注に入れる } } function myEndnotes(){ for (i=grl-1; i>=0; i--) { var en = gr[i].insertionPoints[0].createEndnote(); //文末脚注を作成 gr[i].select(); //選択する var str =doc.selection[0].contents; //文字列を取得 doc.selection[0].remove(); //選択部分を削除 en.texts[0].insertionPoints[-1].contents = str ; //文末脚注に入れる } } var mySelName = ""; try{mySelName= doc.selection[0].constructor.name;}catch(e){} //選択中のconstructor.nameを取得 if(mySelName == "InsertionPoint"|mySelName == "Text"|mySelName == "Character"){ //確認 //ダイアログ表示 var dlg = app.dialogs.add( {name:"脚注/文末脚注を生成"} ); with(dlg){ with(dialogColumns.add() ){ var bp1 = borderPanels.add(); with(bp1) { with(dialogColumns.add() ){ with(dialogRows.add()){ staticTexts.add({staticLabel:"作業内容を選択", minWidth:10 }); } with(dialogRows.add()){ var myWork = dropdowns.add({stringList: ['A:〔◆◆◇◇〕も〔★★☆☆〕も脚注にする', 'B:〔◆◆◇◇〕も〔★★☆☆〕も文末脚注にする', 'C:〔◆◆◇◇〕は脚注/〔★★☆☆〕は文末脚注にする'], selectedIndex:0, minWidth:360}); } } } } } // } flag =dlg.show(); if(flag){ //共通でやること //検索オプションGrep app.findGrepPreferences = NothingEnum.nothing; app.changeGrepPreferences = NothingEnum.nothing; app.findChangeGrepOptions.includeHiddenLayers = true;//非表示レイヤーを含めるかどうか app.findChangeGrepOptions.includeMasterPages = true;//マスターページを含めるかどうか app.findChangeGrepOptions.includeFootnotes = true;//脚注を含めるかどうか app.findGrepPreferences.findWhat="〓\\t+" app.changeGrepPreferences.changeTo = "〓"; app.changeGrep(); //〓後のタブを削除 app.findGrepPreferences.findWhat="〓\\t+" app.changeGrepPreferences.changeTo = "〓"; app.changeGrep(); //改行を∞∞に function kaigyo(){ app.findGrepPreferences.findWhat="(〔★★[^☆\n\r]*)[\n\r]+" app.changeGrepPreferences.changeTo = "$1∞∞" ; app.changeGrep(); } //10回実行 kaigyo(); kaigyo(); kaigyo(); kaigyo(); kaigyo(); kaigyo(); kaigyo(); kaigyo(); kaigyo(); kaigyo(); //空だった場合×××とする app.findGrepPreferences.findWhat="(〔★★\\d+〓)(☆☆〕)" app.changeGrepPreferences.changeTo = "$1×××$2" ; app.changeGrep(); /////////表組み内の脚注・文末脚注を表の直後に出す。///////// for(i=0;myStory.tables.length>i;i++){ //01 app.findGrepPreferences.findWhat="〔[◆★][◆★][\\s\\S]+?[◇☆][◇☆]〕" var gr=myStory.tables[i].findGrep(); // 検索 var grl=gr.length; //表の中の脚注を1つにまとめる var myContents =""; for (j=0; j