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]);
}
}
Have something to add?