Last active
February 25, 2020 16:19
-
-
Save UskeS/dfd0442b9b20000f1bc5852d45bd6116 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
/** | |
* @fileoverview 選択したセルの高さを変更する | |
* @author Yusuke SAEGUSA | |
* @version 0.0.1 | |
*/ | |
if (app.documents.length === 0) { | |
exit(); | |
} | |
if (app.activeDocument.selection.length !== 1) { | |
alert("セルか表ひとつを選択してください"); | |
exit(); | |
} | |
var doc = app.activeDocument; | |
var sel = doc.selection[0]; | |
if (sel instanceof Table || sel instanceof Cell) { | |
sel = sel.cells; | |
} else { | |
alert("セルか表ひとつを選択してください"); | |
exit(); | |
} | |
var dlg = new Window("dialog {alignChildren: ['fill','center'], spacing: 8}", "changeCellHeight"); | |
dlg.add("staticText", undefined, "設定値"); | |
var input = dlg.add("editText {preferredSize:[30,-1]}"); | |
var chb = dlg.add("checkBox", undefined, "指定値を使用"); | |
chb.value = true; | |
var btn = dlg.add("button", undefined, "実行", {name:'ok'}).onClick = function() { | |
dlg.close(1); | |
} | |
var result = dlg.show(); | |
if (result === 2) { | |
exit(); | |
} | |
//-- main --// | |
for (var i=0, len=sel.length; i<len; i++) { | |
sel[i].height = input.text; | |
sel[i].autoGrow = !chb.value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment