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

Fit to selected art - each object in own artboard

Explorer ,
Mar 06, 2021 Mar 06, 2021

Copy link to clipboard

Copied

Hey
I have 3 selected objects
Each with its own artboard

I'm looking for a script that will change any artboard
According to the selected object

Right now - if I use the standard command - "fit to selected art" it creates one artboard
For all objects together.

TOPICS
Scripting

Views

550

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

correct answers 3 Correct answers

Guide , Mar 06, 2021 Mar 06, 2021

What about —?

 

for (var i = 0; i < app.activeDocument.artboards.length; i++) {
    var AB = app.activeDocument.artboards[i];
    var ABR = AB.artboardRect;
    for (var j = 0; j < app.activeDocument.selection.length; j++) {
        var SGB = app.activeDocument.selection[j].geometricBounds;
        if ((SGB[2] > ABR[0] && SGB[0] < ABR[2]) && (SGB[3] < ABR[1] && SGB[1] > ABR[3])) {
            AB.artboardRect = SGB;
        }
    }
}

 

Votes

Translate

Translate
Guide , Mar 07, 2021 Mar 07, 2021

I am unsure what you are asking.  This will change pathItem strokes to none.

 

for (var i = 0; i < app.activeDocument.pathItems.length; i++) {
    app.activeDocument.pathItems[i].stroked = false;
}

 

Votes

Translate

Translate
Community Expert , Mar 09, 2021 Mar 09, 2021
var curItem,length = app.activeDocument.pathItems.length;
for (var i = 0; i < length; i++) {
    curItem = app.activeDocument.pathItems[i];
    if(curItem.stroked
        && curItem.strokeColor.spot 
        && curItem.strokeColor.spot.name === "CutContour")
    {
        curItem.stroked = false;
    }
        
}

Votes

Translate

Translate
Adobe
Guide ,
Mar 06, 2021 Mar 06, 2021

Copy link to clipboard

Copied

for (var i = 0; i < app.activeDocument.artboards.length; i++) {
    var AB = app.activeDocument.artboards[i];
    var ABR = AB.artboardRect;
    for (var j = 0; j < app.activeDocument.selection.length; j++) {
        var SGB = app.activeDocument.selection[j].geometricBounds;
        if ((SGB[0] > ABR[0] && SGB[2] < ABR[2]) && (SGB[1] < ABR[1] && SGB[3] > ABR[3])) {
            AB.artboardRect = SGB;
        }
    }
}

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
Explorer ,
Mar 06, 2021 Mar 06, 2021

Copy link to clipboard

Copied

Hi, thanks, but please take a look at this file at this link:

 

https://www.dropbox.com/s/beww7kxbdnb99wq/chealk.pdf?dl=0

 


Choose the 3 squares with the pink contour,
And try running the script.
It does not work the way I should.

 

Thanks!

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 ,
Mar 06, 2021 Mar 06, 2021

Copy link to clipboard

Copied

What about —?

 

for (var i = 0; i < app.activeDocument.artboards.length; i++) {
    var AB = app.activeDocument.artboards[i];
    var ABR = AB.artboardRect;
    for (var j = 0; j < app.activeDocument.selection.length; j++) {
        var SGB = app.activeDocument.selection[j].geometricBounds;
        if ((SGB[2] > ABR[0] && SGB[0] < ABR[2]) && (SGB[3] < ABR[1] && SGB[1] > ABR[3])) {
            AB.artboardRect = SGB;
        }
    }
}

 

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
Explorer ,
Mar 07, 2021 Mar 07, 2021

Copy link to clipboard

Copied

Hey
If you've already helped me,
I'm enclosing an end of what I wanted.
Attach a file, I need a script that will select all the contour lines and make them none.

 

https://www.dropbox.com/s/uqmqi0sh1fk58i2/ch.pdf?dl=0

 

 

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
Explorer ,
Mar 07, 2021 Mar 07, 2021

Copy link to clipboard

Copied

Thanks a lot!

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 ,
Mar 07, 2021 Mar 07, 2021

Copy link to clipboard

Copied

I am unsure what you are asking.  This will change pathItem strokes to none.

 

for (var i = 0; i < app.activeDocument.pathItems.length; i++) {
    app.activeDocument.pathItems[i].stroked = false;
}

 

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
Explorer ,
Mar 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

It removes my contour from the whole document
I only need removal of the
CutCOntour

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
Explorer ,
Mar 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

I.e. only the contour of a spot color called "cutcontour"

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 Expert ,
Mar 09, 2021 Mar 09, 2021

Copy link to clipboard

Copied

LATEST
var curItem,length = app.activeDocument.pathItems.length;
for (var i = 0; i < length; i++) {
    curItem = app.activeDocument.pathItems[i];
    if(curItem.stroked
        && curItem.strokeColor.spot 
        && curItem.strokeColor.spot.name === "CutContour")
    {
        curItem.stroked = false;
    }
        
}

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