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

[ESTK] Very fast way to delete a huge list with ExtendScript - HowTo

Enthusiast ,
Dec 01, 2019 Dec 01, 2019

Copy link to clipboard

Copied

I had trouble deleting a list of many items (over 200) with ExtendScript. FrameMaker has not responded for a very long time or is frozen.
I found a way to speed up the process considerably.

I hope that it will help some of you.

 

In the example more than 2000 items are built and deleted.
Of course you can adjust the counter.

 

var MyArray = ["A","B","C","D"];
var MyArray2 = ["Ax","Bx","Cx","Dx"];
var MaxCount = 2000;

for (var i = 0; i < MaxCount; i++)
    {
     MyArray.push("AAAAAAAAAAAAAAAAAAAAAAAAAAAA" + i);   
    }

var oDia = new Window("dialog","RemoveItems",undefined);

oDia.OuterBox = oDia.add("panel",undefined,"FRAME");
oDia.OuterBox.size = [300,350];
oDia.InnerGroup = oDia.OuterBox.add("group",undefined,"");
   
oDia.ItemList = oDia.InnerGroup.add("listbox",undefined,MyArray);
oDia.ItemList.size = [250,300];
var dButtonR = oDia.add("button",undefined,"RemoveAll");
dButtonR.onClick = AllRemove;

var dButtonR = oDia.add("button",undefined,"Remove(quick)");
dButtonR.onClick = KillList;
oDia.layout.layout (true);

oDia.show();

function KillList()
{
    oDia.OuterBox.remove(0);  
  
    oDia.ItemList = oDia.OuterBox.add("listbox",undefined,MyArray2);

    oDia.ItemList.size = [250,300];
   oDia.layout.layout (true);
   
   oDia.update();
}

function AllRemove()
{
    oDia.ItemList .removeAll();

    for (var i = 0; i < MyArray2.length; i++)
        {
         oDia.ItemList.add("item", MyArray2[i]); 
        }
}

 

 

TOPICS
Scripting

Views

455

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
no replies

Have something to add?

Join the conversation