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

Script to resize every object on a layer

Community Beginner ,
Jun 22, 2017 Jun 22, 2017

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
902
Translate
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

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];

    }

Translate
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

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]);

Translate
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

Hi Luke,

Equalizer settings for your task:

EQLZ.png

Best,

Marc

Translate
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

Wow. What a powerful tool!!!

Great!

Translate
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
LATEST

This is fantastic - Thank you so much everyone

Translate
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