Created
February 8, 2012 12:11
-
-
Save moluapple/1768602 to your computer and use it in GitHub Desktop.
[Indesign]Fix text to frame eventListener
This file contains hidden or 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
/********************** | |
* 请事先为文本框添加自定义脚本标签"fixwidth" | |
* 出现溢流后,文本框选中时内容会自动适应文本框 | |
* 非正式脚本,仅用于测试演示目的 | |
*********************/ | |
#targetengine "events" | |
var doc = app.activeDocument; | |
/afterSelectionAttributeChanged/.test(doc.eventListeners.everyItem().eventType) || doc.addEventListener("afterSelectionAttributeChanged", fixWidth); | |
function fixWidth (e) { | |
var t, s; | |
if (!app.selection.length || (t = app.selection[0], t.constructor.name != 'TextFrame') || t.label != 'fixwidth') return; | |
s = t.parentStory; | |
while (s.overflows) { | |
s.tracking -= 1, s.horizontalScale -= 3; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment