Filter box in the list dialog

How to get it?

function OnClick(clickData)
{
  var tab = clickData.func.sourcetab;
  var dlg = clickData.func.Dlg;
  //var cmd = clickData.func.command;
  
  var FSUtil = DOpus.FSUtil;
  var list = DOpus.NewVector;
  
  var text = "tag1, tag2, tag3, tag4, tag5, tag6";
/*
  var filepath = "D:\\Test\\DOpusTag.dat";
  if(DOpus.FSUtil.Exists(filepath)) {
  var StringTools = DOpus.Create.StringTools();
  var text = FSUtil.OpenFile(filepath).Read();
  var text = StringTools.Decode(text, "utf-8 bom");
  } else {var text = "";}
*/
  var myArray = text.split(", ");
  
  for(i = 0; myArray[i]; i++) {
      list(i) = myArray[i];
	  }
  
  dlg.title = "Set Tags by List";
  dlg.message = "Tick the Tags";
  dlg.buttons = "OK|Cancel";
  dlg.choices = list;
  dlg.list = DOpus.NewVector();
  dlg.list = DOpus.NewVector("false", "false", "true", "true", "false", "false");
  dlg.cx = 300;
  dlg.cy = 700;
  dlg.Show;
  var r = dlg.result;
  
  if(r == 1) {
    var value = "";
    for(i = 0; i < dlg.choices.size; i++) {
        if(dlg.list(i) == true) {value += dlg.choices(i) + ", "}
	    }
	value = value.substr(0, value.length - 2);
	DOpus.Output(value)
	}
/* 
  for(var eSel = new Enumerator(tab.selected); !eSel.atEnd(); eSel.moveNext()) {
     var ADSfile =  eSel.item() + ":Tags";
	 var fileWrite = FSUtil.OpenFile(ADSfile, "wa");
	 if(fileWrite.error == 0) {
	   fileWrite.Write(value);
	   }
	 fileWrite.Close
	 }
  //cmd.Runcommand("GO REFRESH");
  r.autorefresh = true;
*/

}

Add an edit control to your dialog and it will send a message when its text changes which the script can react to. You’ll need to use a message loop so that your script can react to things that happen in the dialog.

How to put the edit control to the current list dialog?
Adding some versatile combo box script templates would make scripting easier.

See Script Dialogs to get started with custom dialogs in scripts.

I have tried many times, it would be great if you could create more templates in the help file. . .

There are lots of examples on the forum.

9 posts were split to a new topic: Script list with checkboxes in second column?