Created
December 14, 2023 02:26
-
-
Save UskeS/d507785191e997a25aa2990687a501f8 to your computer and use it in GitHub Desktop.
[InDesign] 指定したコードポイント範囲の文字列をテキストフレームにタブ区切りで取得する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var doc = app.activeDocument; | |
var txf = doc.selection[0]; // テキストフレームの文字設定などを先に変えておき、そこに流し込む | |
var sta = "0000"; // 入力したい範囲の最初のコードポイント(末尾0) | |
var end = "000f"; // 入力したい範囲の最後のコードポイント(末尾f) | |
var result = []; | |
var hexSta = parseInt(sta, 16); | |
var hexEnd = parseInt(end, 16); | |
var con = [ sta ]; | |
var k = 0; | |
for (var i = hexSta; i <= hexEnd; i++) { | |
con.push(String.fromCharCode(i)); | |
if (con.length === 17) { | |
result.push(con.join("\t")); | |
con = [ (i+1).toString(16) ]; | |
} | |
} | |
txf.contents = result.join("\r"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment