• 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 delete page items in layer

Explorer ,
Apr 10, 2022 Apr 10, 2022

Copy link to clipboard

Copied

Hello all,

I got the below script from the Adobe help community to the delete the pathitems by size. But, I am facing the prblem with the below script was its deleting only the path made of rectange, circle or polygonal with size 3.5 x 4. 

 

Please the run the script in sample file and provide the solution for this. I am attaching the sample file.

 

var paths = app.activeDocument.layers["keyline"].pageItems;
for (var i = paths.length - 1; i > -1; i--) {
if (paths[i].width != 3.5 * 72 || paths[i].height != 4 * 72) {
paths[i].remove();
}
}

TOPICS
Scripting

Views

229

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
Adobe
Guide ,
Apr 11, 2022 Apr 11, 2022

Copy link to clipboard

Copied

Sorry, the question is unclear.  What do you expect the script to do which it is not doing?  

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 ,
Apr 11, 2022 Apr 11, 2022

Copy link to clipboard

Copied

Hi Femkeblanco,

 

Above script is no keeping all the PathItems with width 3.5 inch and height 4 inch.

 

Please open the attached "Sample.eps", in that there two pathitems with the width 3.5inch and height 4 inch. 

 

Surya24_0-1649690106660.png

What I need is , the two rectangles with size 3.5 x 4 inch  need to be there in the file, only the small rectangle alone need to be deleted. But the blue rectangle also deleting while running the script.

 

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 ,
Apr 11, 2022 Apr 11, 2022

Copy link to clipboard

Copied

Hmmh?

 

@Surya24 the snippet provided by @femkeblanco works for me with your sample file as expected.

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 ,
Apr 11, 2022 Apr 11, 2022

Copy link to clipboard

Copied

LATEST

Sorry, its working now. I think some problem on my system. 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