• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Script to resize every object on a layer

Community Beginner ,
Jun 22, 2017 Jun 22, 2017

Copy link to clipboard

Copied

Hi all,

My current script produces empty graphic frames on my page, variable quantities and variable sizes.

Does anyone know of a script that would find all objects on this layer (called 'AW') and reduce the height of each one by 10mm from centre, and reduce the width of each one by 10mm from centre? The script must only target the objects on this 'AW' layer due to the other bits going on beforehand.

Any ideas if this is even possible?

Thanks in advance!

Luke

TOPICS
Scripting

Views

663

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 22, 2017 Jun 22, 2017

Copy link to clipboard

Copied

var doc = app.activeDocument;

var rects = doc.layers.item("AW").rectangles;

doc.viewPreferences.horizontalMeasurementUnits  = doc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.MILLIMETERS;

for(var i=0;i<rects.length;i++)

{

        var gb = rects.geometricBounds;

        rects.geometricBounds = [gb[0]+5,gb[1]+5, gb[2]-5,gb[3]-5];

    }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 22, 2017 Jun 22, 2017

Copy link to clipboard

Copied

It would be better if you use something like this (instead of changing the

geometricBounds):

app.selection[0].resize(CoordinateSpaces.innerCoordinates,

AnchorPoint.TOP_CENTER_ANCHOR,

ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH,[newWidth, newHeigth]);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 22, 2017 Jun 22, 2017

Copy link to clipboard

Copied

Hi Luke,

Equalizer settings for your task:

EQLZ.png

Best,

Marc

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 22, 2017 Jun 22, 2017

Copy link to clipboard

Copied

Wow. What a powerful tool!!!

Great!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 22, 2017 Jun 22, 2017

Copy link to clipboard

Copied

LATEST

This is fantastic - Thank you so much everyone

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines