[ExtendScript] Unexpected error occurs when getting kinsoku or mojikumi and the value is None
[ExtendScript] kinsoku/mojikumi取得の際、値が なし だと予期しないエラーが起こる
ja
ExtendScriptにてTextRangeからkinsokuまたはmojikumiを取得する際、値がなしの状態だとエラーが出ます。これは期待する動作ではありません。
スクリプト開発者はなしというstateがあると考えるので、何かそういった値を返すはずです。セットするときには''空文字列が使われるので、それを採用するのがわかりやすいでしょう。
環境
- macOS 12.7.5
- Illustrator 2025(29.8.1)
再現手順
- Illustrator書類でテキストフレームを選択する
- 禁則をなしにセットする
- 実行するスクリプト欄のスクリプトを実行する
実際の結果
次のエラーが発生する
Error 9563: the requested attribute is undefined for the text range

期待する結果
''が返る
実行するスクリプト
alert(app.documents[0].selection[0].textRange.kinsoku) ;
添付したファイル
- kinsokumojikuminone.png
en
[ExtendScript] Unexpected error occurs when getting kinsoku or mojikumi and the value is None
When retrieving kinsoku or mojikumi from a TextRange in ExtendScript, an error occurs if the value is None. This is not the expected behavior.
Script developers should assume the None state exists and expect some value to be returned. Since an empty string '' is used when setting it, adopting this approach would be clear.
Environment
- macOS 12.7.5
- Illustrator 2025 (29.8.1)
Steps to reproduce
- Select a text frame in Illustrator document
- Set kinsoku to None
- Execute the script in the Script to execute section
Actual result
The following error occurs:
Error 9563: the requested attribute is undefined for the text range

Expected result
Returns ''
Script to execute
alert(app.documents[0].selection[0].textRange.kinsoku) ;
Attached files
- kinsokumojikuminone.png
