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

Ai 2020 ScriptUI ListBox checked item

Valorous Hero ,
Nov 29, 2019 Nov 29, 2019

Is it just me, or are checked list items now gone from Illustrator 2020?

 

Try this snippet to see what results you get in your Ai 2020:

 

#target illustrator
function test(){
  var w = new Window("dialog""Checkbox Test");
  var testList = w.add("listbox"undefined, []);
  var newItem;
  for (var i = 0i < 10i++) {
    newItem = testList.add("item");
    newItem.text = "Item #" + i;
    newItem.checked = false;
  }
  testList.onDoubleClick = function () {
    alert("Double-clicked!");
  };
  w.show();
};
test();
TOPICS
Scripting
1.4K
Translate
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 30, 2019 Nov 30, 2019

you made me finally update, I did't want to be disappointed at crucial times.

 

I can confirm, check marks are gone, Win 10, CC2020.

 

In 2019, check marks are still there.

Translate
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
Valorous Hero ,
Feb 29, 2020 Feb 29, 2020

This is really starting to get on my nerves. Trying to make an image-based solution but these darn images don't seem to wanna change...

Translate
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
Valorous Hero ,
Feb 29, 2020 Feb 29, 2020
LATEST

Ok, with an image-based approach I've figured out that embedded images don't change, but images referenced via File() do.

 

#target illustrator
function test () {
	// var imageResources = {
	// 	"unchecked" : "\u0089PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00\x14\x00\x00\x00\x14\b\x06\x00\x00\x00\u008D\u0089\x1D\r\x00\x00\x00\x19tEXtSoftware\x00Adobe ImageReadyq\u00C9e<\x00\x00\x00<IDATx\u00DAb`\u00A0\x11X\x0F\u00C4\u00FF)\u00C4\u00EB\u0091\r\x04\t\x04P\u00E0\u00A0\x00\u00A8\x19(\x06R\n\u00C0f0Q;\u00ECF\r\x1C5p\u00D4\u00C0\u00E1g \u00A5\u00C5\x17m\x0BX\u00AA\x01\u0080\x00\x03\x00\x0B7'\u00F5\u00D3\u00C4k\u00F5\x00\x00\x00\x00IEND\u00AEB`\u0082",
	// 	"checked" : "\u0089PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00\x14\x00\x00\x00\x14\b\x06\x00\x00\x00\u008D\u0089\x1D\r\x00\x00\x00\x19tEXtSoftware\x00Adobe ImageReadyq\u00C9e<\x00\x00\x00\u00F2IDATx\u00DA\u00B4\u0094\u00DF\r\u00820\x10\u00C6i'p\x04\u009Exv\x04G`\x04\x18\u0081\x11\u00D8@'\u0080\r\u0088\x13\u00E8\x1C}\u00D1\x11\u00DC\x00\u00BF3mr\u009C\x1C\u0096\u00B4^r\u00E9\u00FF_\u00BF\u00F6\u00AE-\u008A?\u00D9\x04\u009F\x13}\u00E2@\u00EA\u00A8\x13\x04\u00D5\u009E\u00B1\x00\u00A6\u00DA\u0087ayOUU'\u00F8a\x0F\x05\u00F3\u008F\u00BCm\u00C5\u00F8\x13~\u008B\u0085b\u00DE\u0080\u00E2\u00A5\x02\u009Ds\x04\u00BC\u00C2\x1Frg\x05\x16\u00D6\u00A8\n\u00C9\u00CE\u00BE$\u00A5\u00F5\x06\u00AC\u0081\u00F7r\u00EC\x0B\u0088\x1D\u00E9\b\x1D\u009C\u008E=aq\u00A3\u00C0F\u00A9NSH\u00D0\x11\u00C5\u00DD7\u0087p<\x06+\u00D6\u00D4\u0091\x19\x16r##N\u00C7\x16\x01+}\u009D\u00D4\u00B5+ic\u00ACv\u00E9X@\nG\u00D6U\u00B2z\u00AF\u00AD\u00B3?2\u00A3\u0093i\u00A1\u00DD]\x14\u00D0\x07\u00E8\"\u00BA\u00FB\u00E8g\u00B3\u0091s\u0094\u0097s\bN\u00F4\u00D3\u00DB\u00B0v\u008F\u00BA\u00A8\u00CFAKr\u008D\u0091\u00FD\u00FB\u00CA\u00FE\u00C1f\u00B3\u00B7\x00\x03\x00\u00E0ip\u0096\u009B\u0090\u00B5\u00DF\x00\x00\x00\x00IEND\u00AEB`\u0082"
	// };

	// works.
	var imageResources = {
		"unchecked" : File("....../unchecked.png"),
		"checked" : File("....../checked.png")
	}
	var w = new Window("dialog", "Checkbox Test");
	var list = w.add("listbox", undefined, []);
	var items = ["A", "B", "C"];
	var thisItem, thisListItem;
	for (var i = 0; i < items.length; i++) {
		thisItem = items[i];
		thisListItem = list.add("item");
		thisListItem.text = thisItem;
		thisListItem.checked = false;
		thisListItem.image = ScriptUI.newImage(imageResources.checked);
	}
	list.onDoubleClick = function () {
		if (this.selection == null || (this.selection.hasOwnProperty("length") && this.selection.length != 1)) {
			return;
		}
		this.selection.checked = !this.selection.checked;
		this.selection.image = ScriptUI.newImage((this.selection.checked)? imageResources.checked : imageResources.unchecked);
	};
	w.show();
};
test();
Translate
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