Skip to content

Instantly share code, notes, and snippets.

@moluapple
Created July 19, 2011 08:43
Show Gist options
  • Save moluapple/1091740 to your computer and use it in GitHub Desktop.
Save moluapple/1091740 to your computer and use it in GitHub Desktop.
Extend width of TextFrames with the same geometricBounds
#include "doEx.jsx"
var s = app.selection[0].geometricBounds.toString().replace(/\.\d+/g, '');
doEx('textFrames').each(function () {
if (this.geometricBounds.toString().replace(/\.\d+/g, '') == s) {
this.geometricBounds = [
this.geometricBounds[0], this.geometricBounds[1] - 50, this.geometricBounds[2], this.geometricBounds[3]]
}
});
@moluapple
Copy link
Author

扩展如下:
逐一找出与(多个)所选对象相同位置及类别的对象,执行某种操作,比如:一同移动位置

#include "doEx.jsx"
var d = app.activeDocument;
doEx(app.selection).each(function () {
    var s = this.geometricBounds.toString().replace(/\.\d+/g, ''),
        str = this.toString(),
        type = eval('d.' + str.slice(8, 9).toLowerCase() + str.slice(9, -1) + 's');
    doEx(type).each(function () {
        if (this.geometricBounds.toString().replace(/\.\d+/g, '') == s) {
            this.geometricBounds = [
            this.geometricBounds[0] + 20, this.geometricBounds[1], this.geometricBounds[2] + 20, this.geometricBounds[3]]
        }
    })
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment