【2023/05/17 11:00】「text・grepの場合の記述例」を追記しました
【2024/01/24 11:22】利用上の注意を追記しました
はじめに
今年2月に開催されたInDesign日本語版リリース20周年記念イベントにおいて、「InDesignのスクリプトを使いこなそう」というテーマで登壇しました。
ここで紹介したプリインストールスクリプトとコミュニティスクリプトのうち、検索置換を連続で実行する findChangeByList.jsx を改めて紹介したいと思います*1。
なお、細かい話/前置きはいいからとにかく使ってみたいという方は、
- 下準備>スクリプトをユーザーフォルダへ複製する
- 設定ファイルを作って動かしてみる
の2項目だけ読んでもらえればなんとかいけるかもと思います。
本記事の動作環境
アプリケーション | バージョン |
---|---|
OS | macOS Mojave(v10.14.6) |
InDesign | InDesign 2021(v16.4.1) |
免責事項
万全を期して記事を書いているつもりですが、本記事が原因と思われる何かしらの不都合・不具合を被ったとしても筆者は一切責任を負えません。試す場合はご自身の責任でお試しください。
利用上の注意
詳細は以下の記事を参照ください。
便利なPreference.propertiesプロパティの落とし穴 - DTPab
利用できないプロパティ(存在しない文字スタイル名など)を指定しても、スクリプトがエラーにならず、設定をスキップして置換してしまいます。
FindChangeByList.jsx is 何?
事前に準備した検索置換リストに従って、連続で検索置換を行うスクリプトです(上記配信動画の12'35"くらいから)。
このスクリプトの使い方の説明(概略)は下記のサイトにもあります*2。
- InDesignの勉強部屋さん:
No.16 サンプルスクリプト | other | 勉強部屋 | study-room - DTPTransitさん:
検索と置換やスクリプトを使ったInDesignでの文章整形 | DTP Transit
どちらも初期設定の動作を説明してくださっています。
このスクリプトのメリット・デメリット
メリット
- 設定ファイルを切り替えて使い分けられる
- 設定ファイルがコメントアウトに対応しているので、注意点や処理の詳細などコメントをたくさん書いておける
- 検索置換対象を都度選んで実行できる
- 設定ファイルがスクリプトと分離したテキストファイルなので、(スクリプト本体をいじらず)設定ファイルを書き換えながらスクリプトを制御できる
デメリット
- 設定ファイルの書き方がほとんどスクリプトそのものなので、知識がそこそこ必要で、スペルミス一つすら許されない(エラーになる)
- スクリプトから参照する設定ファイル名が固定なので、複数の設定ファイルを使い分けるような管理がしにくい
- Undoに対応していないので、スクリプト実行前に戻るのは至難の業*3
下準備
このままでは使い勝手が悪いので、スクリプトパネルの「アプリケーション」側ではなく「ユーザー」側で使えるようにしておきましょう。
その上で、設定ファイルの書き換え方をお伝えします。
そうすれば自分専用の連続検索置換スクリプトに早変わりです!
スクリプトをユーザーフォルダへ複製する
というのも、このスクリプトを自由に扱うためには設定ファイルの内容を適宜書き換える必要があるのですが、アプリケーションフォルダに入っているとファイルを修正する(保存する)たびにパスワードによる認証を求められるためです。
まずスクリプトパネルから、FindChangeByList.jsxを選択してコンテクストメニューを開きます。
Macの場合は「Finderで表示」を選択し、スクリプトをFinderで表示させます(Windowsの場合はエクスプローラーで表示)。
同様に、今度はスクリプトパネルから「ユーザー」フォルダを選択して「Finderで開く」。そうすると Scripts Panel というフォルダが一つだけ入っているScriptsフォルダが開きます。
この Scripts Panel フォルダの中に、FindChangeByList.jsx ファイルと FindChangeSupport フォルダを複製します。
そうすると、InDesignのスクリプトパネルの「ユーザー」フォルダ側に FindChangeByList.jsx が見えるようになります。
「アプリケーション」フォルダ側だとファイルの移動や削除のたびにパスワード入力を求められるので面倒なので、スクリプトの管理はこの「ユーザー」フォルダを使うのがおすすめですね。
設定ファイルの書式(ルール)
このスクリプトの設定ファイルの基本ルールは、設定ファイルである FindChangeList.txt にこのように書いてあります。
//A support file for the InDesign JavaScript FindChangeByList.> jsx
//
//This data file is tab-delimited, with carriage returns separating records.
//
//The format of each record in the file is:
//findTypefindProperties changeProperties findChangeOptions description
//
//Where:
//is a tab character
//findType is "text", "grep", or "glyph" (this sets the type of find/change operation to use).
//findProperties is a properties record (as text) of the find preferences.
//changeProperties is a properties record (as text) of the change preferences.
//findChangeOptions is a properties record (as text) of the find/change options.
//description is a description of the find/change operation
要するに、
- この設定ファイルのレコード(検索置換1回分の命令)は改行コードCRで区切られており、レコード内はタブ区切り
- 各レコードの書式は下記の通り
- 検索置換タイプ <タブ> 検索設定 <タブ> 置換設定 <タブ> 検索置換オプション <タブ> 説明文
- 検索置換タイプは下記3種類に対応
- text(テキスト検索置換)
- grep(正規表現検索置換)
- glyph(字形検索置換)
- 検索設定・置換設定はそれぞれほぼスクリプトと同様の書式で記述する必要がある
- 検索置換オプションは、検索置換ダイアログの図の囲み部分を指す(この書式もスクリプトとほぼ同様)
- 説明文は自由に書いて良い
というような感じです。
冒頭に「text」「grep」「glyph」があれば検索置換設定としてその行が読み込まれ、実際に検索置換されます。それ以外は無視される仕様なので、設定ファイルの冒頭のようにいろいろとコメントを書いておけるわけです。
引用した冒頭の説明文の下に、サンプルも記述されています。
また、何も書き加えなくとも最初からちょっとした検索置換が行われるようになっていますが、その内容は前掲のInDesignの勉強部屋さんやDTPTransitさんで書かれているので割愛します。
気をつけていただきたいのは、何度も書いていますが書式がほぼスクリプトと同様ということです。文字列には引用符が必要になりますし、それぞれの設定はObject型オブジェクトの形(プロパティ名: 値
という1セットを,
区切りで{ }
の中に記述する)になっています。
どのようなプロパティ名があり、どのような値を渡さないといけないか、というのが前知識として求められます*4。
記述ルールは主に以下のとおりです。
- 冒頭の検索置換タイプ(text、grep、glyph)と、末尾の説明文以外のタブで囲まれた部分はスクリプトの記述ルールに厳密に従う
- 要素をまとめて
{ }
で囲む(検索設定、置換設定、検索置換オプションそれぞれを{ }
で囲む) - 設定を複数指定する場合、
,
で区切る - 文字列として記述する必要があるものは引用符
' '
もしくは二重引用符" "
で囲む必要がある(どちらでも良い) - 引用符または二重引用符の中で同じものを使いたいときはエスケープが必要(
'\''
や"\""
とする。'"'
や"'"
は問題なし) - 文字列の中で
\
を使う場合、エスケープする必要がある(\\
となる)
実際にサンプルを見てもらったほうが分かりやすいと思うので、とりあえず次へ進みましょう。
設定ファイルの書き方(サンプル)
検索置換タイプ3種類については先に挙げましたので、検索設定から順に書き方(のサンプル)を掲載します。
見ていただくと分かりますが、ほぼスクリプトなんですよね……。
text・grepの場合の検索設定
{ }
の中にプロパティ名: 値
という書き方で記述していきます。複数指定する場合は,
で区切ってください。
設定項目 | プロパティ名 | 値(型) | 記述例 |
---|---|---|---|
検索文字列 | findWhat |
文字列 | "^\\t" |
段落スタイル | appliedParagraphStyle |
ParagraphStyleオブジェクト | app.activeDocument.paragraphStyles.item("本文") |
文字スタイル | appliedCharacterStyle |
CharacterStyleオブジェクト | app.activeDocument.characterStyles.item("強調") |
文字サイズ | pointSize |
数値 もしくは 文字列 | 12 、"14Q" |
文字色 | fillColor |
文字列 もしくは Swatchオブジェクト | "Black" 、app.activeDocument.swaches.item("C=100 M=0 Y=0 K=0") |
他にも細かくたくさんありますが、より詳しくはお〜まちさんのオブジェクトモデル図のfindGrepPreferencesの項などを参照ください。リンク先はgrep(正規表現)向けです。
なお、InDesignの検索置換ダイアログで設定できるものはすべて*5指定できます(テキスト/正規表現/字形の3つとも)が、それにはスクリプトの知識が必要になります。
text・grepの場合の置換設定
検索設定と同じく、{ }
の中にプロパティ名: 値
という書き方で記述していきます。複数指定する場合は,
で区切ってください。
設定項目 | プロパティ名 | 値(型) | 記述例 |
---|---|---|---|
置換文字列 | changeTo |
文字列 | "~(" |
段落スタイル | appliedParagraphStyle |
ParagraphStyleオブジェクト | app.activeDocument.paragraphStyles.item("本文") |
文字スタイル | appliedCharacterStyle |
CharacterStyleオブジェクト | app.activeDocument.characterStyles.item("強調") |
文字サイズ | pointSize |
数値 もしくは 文字列 | 12 、"14Q" |
文字色 | fillColor |
文字列 もしくは Swatchオブジェクト | "Black" 、app.activeDocument.swaches.item("C=0 M=100 Y=0 K=0") |
glyphの場合の検索置換設定
glyphの検索置換の場合、設定必須となる項目がいくつかあります。
というのも、検索したい字形を確定させるためにGID*6を指定する必要があります。このGIDはフォントごとにcmap*7と紐付いているので、GIDを指定するためにはフォントが決まらないといけません。見方を変えると、フォントさえ決まればあとは文字(コードポイント)かGIDがわかれば検索できます。
つまり字形を検索置換するには、
- フォント(ファミリー+ウェイト)と GID
- フォント(ファミリー+ウェイト)と 文字のコードポイント
のどちらかをセットにして指定する必要があります*8。
設定項目 | プロパティ名 | 値(型) | 記述例 |
---|---|---|---|
フォント(ウェイト含む) | appliedFont |
文字列 もしくは Fontオブジェクト | "A-OTF リュウミン Pr6N\tR-KL" *9 |
GID/CID | glyphID |
数値 | 3767 |
文字のコードポイント | designAxes |
文字列もしくは数値 | "6E4A" |
検索置換オプション
値はすべて真偽値(true
かfalse
)です。オンにしたいものは値にtrue
を記述します(オフならfalse
)。記述しないとInDesignの検索置換パネルの現在の設定に従います。
これまで見てきた検索・置換設定とは異なり、オプションについては下記で表示しているもので全てです。検索置換ダイアログに表示されるオプション系のボタン群をそのままスクリプトで指定する格好です(設定ファイルの書式(ルール)に掲載している図の部分です)。
テキスト検索置換のオプション
設定項目 | プロパティ名 | 値(型) |
---|---|---|
ロックされたレイヤー内を検索するか | includeLockedLayersForFind |
真偽 |
ロックされたストーリー内を検索するか | includeLockedStoriesForFind |
真偽 |
非表示のレイヤーを含めるか | includeHiddenLayers |
真偽 |
親ページ(マスターページ)を含めるか | includeMasterPages |
真偽 |
脚注を含めるか | includeFootnotes |
真偽 |
大文字・小文字を区別するか | caseSensitive |
真偽 |
単語として検索 | wholeWord |
真偽 |
カナを区別するか | kanaSensitive |
真偽 |
全角・半角を区別するか | widthSensitive |
真偽 |
正規表現検索置換のオプション
設定項目 | プロパティ名 | 値(型) |
---|---|---|
ロックされたレイヤー内を検索するか | includeLockedLayersForFind |
真偽 |
ロックされたストーリー内を検索するか | includeLockedStoriesForFind |
真偽 |
非表示のレイヤーを含めるか | includeHiddenLayers |
真偽 |
親ページ(マスターページ)を含めるか | includeMasterPages |
真偽 |
脚注を含めるか | includeFootnotes |
真偽 |
カナを区別するか | kanaSensitive |
真偽 |
全角・半角を区別するか | widthSensitive |
真偽 |
字形検索置換のオプション
設定項目 | プロパティ名 | 値(型) |
---|---|---|
ロックされたレイヤー内を検索するか | includeLockedLayersForFind |
真偽 |
ロックされたストーリー内を検索するか | includeLockedStoriesForFind |
真偽 |
非表示のレイヤーを含めるか | includeHiddenLayers |
真偽 |
親ページ(マスターページ)を含めるか | includeMasterPages |
真偽 |
脚注を含めるか | includeFootnotes |
真偽 |
text・grepの場合の記述例
表記が分かりにくい書き方だったので(反省)、実際にどのように検索置換の設定を書くか紹介します。
段落スタイル「hoge」を検索し、段落スタイル「fuga」を当てたいテキスト検索置換ではこのように書きます(わかりやすいようにタブの部分を改行して書いています)。
text
(検索置換種別)
{appliedParagraphStyle: app.activeDocument.paragraphStyles.item("hoge")}
(検索設定)
{appliedParagraphStyle: app.activeDocument.paragraphStyles.item("fuga")}
(置換設定)
{}
(検索置換オプション、設定を変えたければ適宜入れる)
となります。
もっと複合的にやるケースも紹介しましょう。
「。」の後ろにある「山路」という文字列を、文字スタイル「bar」の「坂道」という文字列に置換する正規表現検索置換だとこのようになります。
grep
(検索置換種別)
{findWhat: "(?<=。)山路"}
(検索設定)
{changeTo: "坂道", appliedCharacterStyle: app.activeDocument.characterStyles.item("bar")}
(置換設定)
{}
(検索置換オプション、設定を変えたければ適宜入れる)
もし分かりにくいようでしたら、コメントでもTwitterでもお気軽にお問い合わせください!
設定ファイルを作って動かしてみる
スクリプトの細かい設定について長く書いてしまいましたが、ここからがやっとこの記事の本懐です^^;;
いくつかシチュエーションを考えてみたので、それをユースケースに見ていきましょう。
ちなみに、設定ファイルがタブ区切りなのでスプレッドシート(ExcelやGoogleスプレッドシート、LibreOfficeなど)を使うと編集しやすいかもしれません。
マークダウンを基に段落スタイルを当てる
記事冒頭に掲載した配信で紹介したものです。実際の動作はこんな感じ。 もちろん、段落スタイルや文字スタイルの名称は設定ファイル(FindChangeList.txt)の中身とちゃんと対応させる必要があります。
// マークダウンテキストを変換 // 検索置換オプションはInDesignの設定に従う grep {findWhat: "(?s)(.+?\\r)---\\r"} {changeTo: "$1", appliedParagraphStyle: app.activeDocument.paragraphStyles.item("H1 見出し")} {} ドキュメントの節見出し設定 grep {findWhat: "^# (.+)"} {changeTo: "$1", appliedParagraphStyle: app.activeDocument.paragraphStyles.item("H2 見出し")} {} H2 項見出しを当てる grep {findWhat: "^## (.+)"} {changeTo: "$1", appliedParagraphStyle: app.activeDocument.paragraphStyles.item("H3 見出し")} {} H3 項見出しを当てる grep {findWhat: "^- (.+)"} {changeTo: "$1", appliedParagraphStyle: app.activeDocument.paragraphStyles.item("箇条書き")} {} 箇条書きスタイルを当てる grep {findWhat: "\\*\\*([^*\\r\\n]+)\\*\\*"} {changeTo: "$1", appliedCharacterStyle: app.activeDocument.characterStyles.item("ボールド")} {} ボールドの文字スタイルを当てる
丸数字を黒丸数字に変換する
よくありそうでなさそうな、特定の文字を変換する処理。一つずつ検索置換するのは面倒ですけど、スクリプトにしてしまえば楽ちんですね。
正規表現については過去の記事を参照ください。
// 丸数字を黒丸数字に変換 // マスターページ・脚注を含む grep {findWhat: "\\x{2460}"} {changeTo: "\\x{2776}"} {includeMasterPages: true, includeFootnotes: true} 1 grep {findWhat: "\\x{2461}"} {changeTo: "\\x{2777}"} {includeMasterPages: true, includeFootnotes: true} 2 grep {findWhat: "\\x{2462}"} {changeTo: "\\x{2778}"} {includeMasterPages: true, includeFootnotes: true} 3 grep {findWhat: "\\x{2463}"} {changeTo: "\\x{2779}"} {includeMasterPages: true, includeFootnotes: true} 4 grep {findWhat: "\\x{2464}"} {changeTo: "\\x{277a}"} {includeMasterPages: true, includeFootnotes: true} 5 grep {findWhat: "\\x{2465}"} {changeTo: "\\x{277b}"} {includeMasterPages: true, includeFootnotes: true} 6 grep {findWhat: "\\x{2466}"} {changeTo: "\\x{277c}"} {includeMasterPages: true, includeFootnotes: true} 7 grep {findWhat: "\\x{2467}"} {changeTo: "\\x{277d}"} {includeMasterPages: true, includeFootnotes: true} 8 grep {findWhat: "\\x{2468}"} {changeTo: "\\x{277e}"} {includeMasterPages: true, includeFootnotes: true} 9 grep {findWhat: "\\x{2469}"} {changeTo: "\\x{277f}"} {includeMasterPages: true, includeFootnotes: true} 10 grep {findWhat: "\\x{246a}"} {changeTo: "\\x{24eb}"} {includeMasterPages: true, includeFootnotes: true} 11 grep {findWhat: "\\x{246b}"} {changeTo: "\\x{24ec}"} {includeMasterPages: true, includeFootnotes: true} 12 grep {findWhat: "\\x{246c}"} {changeTo: "\\x{24ed}"} {includeMasterPages: true, includeFootnotes: true} 13 grep {findWhat: "\\x{246d}"} {changeTo: "\\x{24ee}"} {includeMasterPages: true, includeFootnotes: true} 14 grep {findWhat: "\\x{246e}"} {changeTo: "\\x{24ef}"} {includeMasterPages: true, includeFootnotes: true} 15 grep {findWhat: "\\x{246f}"} {changeTo: "\\x{24f0}"} {includeMasterPages: true, includeFootnotes: true} 16 grep {findWhat: "\\x{2470}"} {changeTo: "\\x{24f1}"} {includeMasterPages: true, includeFootnotes: true} 17 grep {findWhat: "\\x{2471}"} {changeTo: "\\x{24f2}"} {includeMasterPages: true, includeFootnotes: true} 18 grep {findWhat: "\\x{2472}"} {changeTo: "\\x{24f3}"} {includeMasterPages: true, includeFootnotes: true} 19 grep {findWhat: "\\x{2473}"} {changeTo: "\\x{24f4}"} {includeMasterPages: true, includeFootnotes: true} 20
括弧囲み字形に変換する
先ほどのものと似ていますが、こちらは異体字(GSUB)で扱うケースです。(ア)という組み合わせの文字列を、1文字分の異体字に変換します。
字形変換は対象の1文字の字形を変換するので、「(ア)」という3文字を1文字の括弧付き字形に直接は変換できません。
そこで、一度テキストか正規表現で「(」+「任意のカタカナ」+「)」という3文字を検索します。
続いて、検索マッチした対象を一時的に適当な1文字に変換(確実に本文中ないし選択範囲に存在し得ない文字が望ましい)します。
最後に、その文字を元のカタカナに合わせた括弧付き字形に変換する、という流れになります。
末尾のそのサンプルで、一時的に変換する文字にスペイン語の疑問符「¡」を使いました。MacOSだと「Option+1」でさっと出せるのでたまに使います。
フォントが小塚明朝Pr6N Rになっているので、そこはお好みのフォントに変えてください。
ただし、フォントによってcmapが異なる都合上、フォントを変更する場合にはGID番号も合わせて確認してください。
全文は100行近くなるので最後に掲載します。
さいごに
まとめです。
- スクリプトの管理はスクリプトパネル上で「ユーザー」と表示されるフォルダのほうがオススメ
- FindChangeByList.jsx は設定ファイルを書き換えて使うことができる
- 設定ファイルの書き方にはスクリプトの知識が必要になる
- なので掲載したサンプルを見本にいろいろチャレンジしてほしい
- ただしUndoが使えないなど注意点もある
スクリプトの強みは単純作業を漏れなく・素早く・確実に行えるところです。
使い方に注意して、ぜひ普段のお仕事にお役立てください。
括弧付きカタカナの字形に変換する設定ファイル
長いのでここに掲載しておきます。
// (ア)の形のカタカナを1文字分の異体字にする // マスターページ・脚注を含む text {findWhat: "(ア)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ア) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10078} {includeMasterPages: true, includeFootnotes: true} (ア) text {findWhat: "(イ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (イ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10079} {includeMasterPages: true, includeFootnotes: true} (イ) text {findWhat: "(ウ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ウ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10080} {includeMasterPages: true, includeFootnotes: true} (ウ) text {findWhat: "(エ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (エ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10081} {includeMasterPages: true, includeFootnotes: true} (エ) text {findWhat: "(オ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (オ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10082} {includeMasterPages: true, includeFootnotes: true} (オ) text {findWhat: "(カ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (カ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10083} {includeMasterPages: true, includeFootnotes: true} (カ) text {findWhat: "(キ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (キ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10084} {includeMasterPages: true, includeFootnotes: true} (キ) text {findWhat: "(ク)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ク) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10085} {includeMasterPages: true, includeFootnotes: true} (ク) text {findWhat: "(ケ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ケ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10086} {includeMasterPages: true, includeFootnotes: true} (ケ) text {findWhat: "(コ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (コ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10087} {includeMasterPages: true, includeFootnotes: true} (コ) text {findWhat: "(サ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (サ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10088} {includeMasterPages: true, includeFootnotes: true} (サ) text {findWhat: "(シ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (シ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10089} {includeMasterPages: true, includeFootnotes: true} (シ) text {findWhat: "(ス)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ス) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10090} {includeMasterPages: true, includeFootnotes: true} (ス) text {findWhat: "(セ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (セ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10091} {includeMasterPages: true, includeFootnotes: true} (セ) text {findWhat: "(ソ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ソ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10092} {includeMasterPages: true, includeFootnotes: true} (ソ) text {findWhat: "(タ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (タ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10093} {includeMasterPages: true, includeFootnotes: true} (タ) text {findWhat: "(チ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (チ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10094} {includeMasterPages: true, includeFootnotes: true} (チ) text {findWhat: "(ツ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ツ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10095} {includeMasterPages: true, includeFootnotes: true} (ツ) text {findWhat: "(テ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (テ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10096} {includeMasterPages: true, includeFootnotes: true} (テ) text {findWhat: "(ト)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ト) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10097} {includeMasterPages: true, includeFootnotes: true} (ト) text {findWhat: "(ナ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ナ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10098} {includeMasterPages: true, includeFootnotes: true} (ナ) text {findWhat: "(ニ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ニ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10099} {includeMasterPages: true, includeFootnotes: true} (ニ) text {findWhat: "(ヌ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ヌ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10100} {includeMasterPages: true, includeFootnotes: true} (ヌ) text {findWhat: "(ネ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ネ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10101} {includeMasterPages: true, includeFootnotes: true} (ネ) text {findWhat: "(ノ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ノ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10102} {includeMasterPages: true, includeFootnotes: true} (ノ) text {findWhat: "(ハ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ハ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10103} {includeMasterPages: true, includeFootnotes: true} (ハ) text {findWhat: "(ヒ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ヒ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10104} {includeMasterPages: true, includeFootnotes: true} (ヒ) text {findWhat: "(フ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (フ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10105} {includeMasterPages: true, includeFootnotes: true} (フ) text {findWhat: "(ヘ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ヘ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10106} {includeMasterPages: true, includeFootnotes: true} (ヘ) text {findWhat: "(ホ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ホ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10107} {includeMasterPages: true, includeFootnotes: true} (ホ) text {findWhat: "(マ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (マ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10108} {includeMasterPages: true, includeFootnotes: true} (マ) text {findWhat: "(ミ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ミ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10109} {includeMasterPages: true, includeFootnotes: true} (ミ) text {findWhat: "(ム)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ム) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10110} {includeMasterPages: true, includeFootnotes: true} (ム) text {findWhat: "(メ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (メ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10111} {includeMasterPages: true, includeFootnotes: true} (メ) text {findWhat: "(モ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (モ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10112} {includeMasterPages: true, includeFootnotes: true} (モ) text {findWhat: "(ヤ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ヤ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10113} {includeMasterPages: true, includeFootnotes: true} (ヤ) text {findWhat: "(ユ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ユ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10114} {includeMasterPages: true, includeFootnotes: true} (ユ) text {findWhat: "(ヨ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ヨ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10115} {includeMasterPages: true, includeFootnotes: true} (ヨ) text {findWhat: "(ラ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ラ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10116} {includeMasterPages: true, includeFootnotes: true} (ラ) text {findWhat: "(リ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (リ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10117} {includeMasterPages: true, includeFootnotes: true} (リ) text {findWhat: "(ル)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ル) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10118} {includeMasterPages: true, includeFootnotes: true} (ル) text {findWhat: "(レ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (レ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10119} {includeMasterPages: true, includeFootnotes: true} (レ) text {findWhat: "(ロ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ロ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10120} {includeMasterPages: true, includeFootnotes: true} (ロ) text {findWhat: "(ワ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ワ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10121} {includeMasterPages: true, includeFootnotes: true} (ワ) text {findWhat: "(ヰ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ヰ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10122} {includeMasterPages: true, includeFootnotes: true} (ヰ) text {findWhat: "(ヱ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ヱ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10123} {includeMasterPages: true, includeFootnotes: true} (ヱ) text {findWhat: "(ヲ)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ヲ) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10124} {includeMasterPages: true, includeFootnotes: true} (ヲ) text {findWhat: "(ン)"} {changeTo: "¡"} {includeMasterPages: true, includeFootnotes: true} (ン) glyph {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 101} {appliedFont: "小塚明朝 Pr6N\tR", glyphID: 10125} {includeMasterPages: true, includeFootnotes: true} (ン)
*1:使い倒そうとか銘打っておいて、聞いただけでは全然使い倒せるようにならない半端なセッションになってしまったと自戒しています…。機会があればもう一度同じテーマで登壇したい
*2:Adobe公式のヘルプには1行でスクリプトの紹介程度しか書かれていない:InDesign でのスクリプト
*3:スクリプト実行前に保存しておき、うまく動作しなかったら復帰させるのがおすすめです
*4:正直なところ、必要なプロパティ名とそれに渡せる値がある程度わかっているなら、わざわざこのスクリプトに頼る必要がないとも言える
*5:筆者の感覚的には「すべて設定できそう」だなと思っているので「すべて」と書きました。細かい設定までつぶさに調べて試したわけではないですが、例えば入れ子構造になっている箇条書き設定などもスクリプトから検索置換ダイアログに間違いなくちゃんとセットできます
*6:Glyph IDのこと。CID:Character IDともほぼ同義
*7:CMapとも。厳密には対応する処理系で表記が異なる
*8:スクリプトだから必要というわけではなくて、InDesignで字形の検索置換を行うために必要なことです
*9:フォントの指定は、フォントファミリー名 <タブ> ウェイト名、という形です。