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

Searchable Drop Down List (Script UI)

Engaged ,
Oct 21, 2016 Oct 21, 2016

Copy link to clipboard

Copied

So I tried the following script from here​, on page 96:

var numbers = ["one", "two", "three", "thirty", "hundred"];

var w = new Window ("dialog", "Drop-down select");

var ddown = w.add ("dropdownlist", undefined, numbers);

ddown.minimumSize.width = 200; ddown.selection = 0; ddown.active = true;

var buffer = " ";

ddown.onActivate = function () {buffer = " "}

ddown.addEventListener ("keydown", function (k)

      {

                buffer += k.keyName.toLowerCase();   var i = 0;   while (i < numbers.length-1 && numbers[i].toLowerCase().indexOf (buffer) != 0)

          {++i;}

  if (numbers[i].toLowerCase().indexOf (buffer) == 0)                                ddown.selection = i;

      }

);

w.add ("button", undefined, "OK");

  w.show ();

And it's described that

"The dropdown's behaviour is now different. If you press t, two is highlighted as before. But when you now type h, the script selects three in the list, not hundred as before."

However, when I use the script, this is not true.  When I press h, "hundred" is still highlighted.  Similarly, when I type "two" one becomes highlighted because "o" was the last letter I typed.  I'm not sure how to revise the script to do what it claims.  I need to be able to type out a whole word at once and have the dropdown menu select an item matching that whole word.  Before the whole word is typed, it should just select the closest item.  For example, if I typed "two", two should be selected instead of "one."  If I type "th", thirty should be selected instead of "hundred." When you try this script, does it do as claimed?  If not, how should it be revised to accomplish what I'm looking for?

TOPICS
Actions and scripting

Views

1.2K

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 ,
Oct 21, 2016 Oct 21, 2016

Copy link to clipboard

Copied

LATEST

ScriptUI was re implemented in CC 2015 and many bugs introduced.  Try you script using cc 2014. If it works for you report a bug to Adobe. However ScripUI had many changes and addition made over the years.  So I tried that script in earlier versions of ScriptUI. That works the way you describe in cs6, cc, cc2014, cc 2015 and cc 2015.5.  The script does not work in CS2 it uses scriptUI features no in CS2.  I no longer have cs3 or cs5 installed and never had cs4.   I use Windows could I can not test on a Mac no longer have one.

You need to develop a work around. Even if you report it as a bug at Photoshop Family Customer Community  Adobe may not fix it soon.

JJMack

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