Skip to content

Instantly share code, notes, and snippets.

@kkazuo
Created June 11, 2015 12:07
Show Gist options
  • Save kkazuo/9e59ce663a84561aa3d0 to your computer and use it in GitHub Desktop.
Save kkazuo/9e59ce663a84561aa3d0 to your computer and use it in GitHub Desktop.
Adobeイラストレータスクリプト テキストオブジェクトまたはその選択領域の"-"のベースラインを上げる(電話番号とか)
var dia = new Window("dialog", "ハイフンあげ", [0, 0, 250, 110]);
dia.pane1 = dia.add("panel", [5, 10, 240, 60], "0.5");
dia.tex1 = dia.pane1.add("edittext", [10, 10, 100, 30]);
dia.add("statictext", [110, 30, 240, 50], "pt");
dia.bot1 = dia.add("button", [10, 70, 100, 100], "実行", {
name: "OK"
});
dia.tex1.text = 0.5;
dia.center();
dia.show();
selt = activeDocument.selection;
if (selt.typename == "TextRange") {
selt = [selt];
}
for (i = 0; i < selt.length; i++) {
n = selt[i].characters.length;
for (j = 0; j < n; j++) {
c = selt[i].characters[j].contents;
if (c == "-" || c == "+") selt[i].characters[j].baselineShift = dia.tex1.text;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment