単位を合字に小数点を中黒に。
どなたかが公開されていた全角数字を半角にするスクリプトを参考にしました。
app.doScript (main, ScriptLanguage.JAVASCRIPT, [], UndoModes.FAST_ENTIRE_SCRIPT); function main (){ var F=["(?<=\\d)cm","(?<=\\d)mm","(?<=\\d)kg","\\.","(?<=\\d)cc","(?<=\\d)ml"];//バックスラッシュ1個だと検索パネルに出ない(macだけ?) var C=["㎝","㎜","㎏","・","㏄","㎖"];//リットルはLが正しいみたい var Pg = app.activeDocument.allPageItems; for (var i=0; i<Pg.length; i++){ if(Pg[i].constructor.name == 'TextFrame'&&Pg[i].parentStory.storyPreferences.storyOrientation==StoryHorizontalOrVertical.VERTICAL){//縦組抽出 for(var j=0; j<F.length; j++){ app.findGrepPreferences.findWhat =F[j]; app.changeGrepPreferences.changeTo =C[j]; Pg[i].parentStory.changeGrep(); } } } }
追記。allPageItem→storyに手直し。冗長でした。
app.doScript (main, ScriptLanguage.JAVASCRIPT, [], UndoModes.FAST_ENTIRE_SCRIPT); function main (){ var F=["(?<=\\d)cm","(?<=\\d)mm","(?<=\\d)kg","\\.","(?<=\\d)cc","(?<=\\d)ml"]; var C=["㎝","㎜","㎏","・","㏄","㎖"]; var St = app.activeDocument.stories; for (var i=0; i<St.length; i++){ if(St[i].storyPreferences.storyOrientation==StoryHorizontalOrVertical.VERTICAL){ for(var j=0; j<F.length; j++){ app.findGrepPreferences.findWhat =F[j]; app.changeGrepPreferences.changeTo =C[j]; St[i].changeGrep(); } } } }