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

How to manage nested/wrapped objects using scripting?

Contributor ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

Hi,

 

Does anyone know how to manage nested/wrapped objects (items placed in items) in Javascript?

How to check if a pageItem has other items inside? (isolation mode)

 

var myDoc = app.activeDocument;

for (var i = 0; i < myDoc.pageItems.length; i++){
    var myItem = myDoc.pageItems[i];

    // How to check if myItem contains isolated items
    // How to remove subitems?
}

for (var i = 0; i < myDoc.symbolItems.length; i++){
    var mySymbolItem = myDoc.symbolItems[i];

    // How to check if mySymbolItem contains isolated items
    // How to remove subitems?
    
}

 

Thanx

TOPICS
Scripting

Views

321

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
Community Expert ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

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 ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

The phrase "isolation mode", being in brackets at the end of the post, reads like an afterthought. Is the question about (1) using nested items in general or (2) using nested items with isolation mode?  An example of what is being sought would be helpful. 

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
Contributor ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

The original post has been modified ...

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 ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

LATEST
var items = app.activeDocument.pageItems;
for (var i = 0; i < items.length; i++) {
    if (items[i].parent.name == "Isolation Mode") {
        var x = confirm(items[i].name + " is in Isolation Mode. Delete it?");
        if (x) items[i].remove();
    } 
}

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