0

以下のスクリプトがあります。

picked = myItems (['item 1', 'item 2', 'item 3', 'item 4', 'new item 1', 'new item 2']); 


function myItems (templates) {
var w = new Window ('dialog {text: "Item List", alignChildren: "fill"}');

 var entry = w.add ('edittext {active: true}')
  entry.graphics.font= ScriptUI.newFont ("Arial", "Bold", 12);
 var list = w.add ('listbox', [0, 0, 200, 100], templates);
 list.selection = 0;

list.graphics.font= ScriptUI.newFont ("Arial", "Italic", 14);

entry.onChanging = function ()
{
var temp = entry.text,
 tempArray = [];
for (var i = 0; i < templates.length; i++)

 if (templates[i].toLowerCase().indexOf (temp) == 0)
tempArray.push (templates[i]);

else if (templates[i].toUpperCase().indexOf (temp) == 0)
tempArray.push (templates[i]);

if (tempArray.length > 0)
 {
 tempList = w.add ("listbox", list.bounds, tempArray, {scrolling: true});

 tempList.graphics.font= ScriptUI.newFont ("Times New Roman", "Regular", 14);
 w.remove(list);
 list = tempList;
 list.selection = 0;
 list.onDoubleClick=function(){

if (list.selected){
     var buttonname = list.selection.text
     var templatefile = new File (searchpath + "/" + buttonname + '.psd');
               mainfunction (templatefile)
}
w.close();
}
 }
} 

ListItem.add

 var B = w.add ('button', undefined, 'Ok', {name: 'ok'}) 


list.onDoubleClick=function(){

if (list.selected){
     var buttonname = list.selection.text
     var templatefile = new File (searchpath + "/" + buttonname + '.psd');
               mainfunction (templatefile)
}

w.close();
}

 if (w.show () != 2){
     var buttonname = list.selection.text
     var templatefile = new File (searchpath + "/" + buttonname + '.psd');
               mainfunction (templatefile)

 }
w.close();
}

ExtendScript では、以下のリストを含む検索ボックスが作成されます。タブキーを使用して、検索ボックスとリストを切り替えることができます。矢印キーでも検索ボックスとリストを切り替えられるようにしたいです。これが可能かどうか誰にもアドバイスできますか?

jQuery でいくつかの結果を見てきましたが、残念ながら ExtendScript は jQuery をサポートしていませんが、ScriptUI はサポートしています。

どうもありがとう、

編集

これが解決策であることがわかりました:

    w.addEventListener ("keydown", function (kd) {pressed (kd)});
function pressed (k)
{
if (k.keyIdentifier === "Down" && entry.active = true)
    list.active = true;
    else if (k.keyIdentifier === "Up" && list.active = true)
    entry.active = true ;
    else 
list.scrolling = true;
}

ただし、Photoshop CC 2014 では機能しません。後方互換性を確保するために何を変更できるか知っている人はいますか?

4

0 に答える 0