2 Replies Latest reply on Sep 3, 2012 10:44 PM by Silly-V

    ScriptUI executing: ETSK vs Illustrator

    Silly-V Adobe Community Professional

      Hey everyone, I am having a very technical difficulty which is unsettling to me:  it appears my UI functions execute differently in ETSK than Illustrator, the intended app. 

       

      This is a code to find an item in the list and immediately target it, if the list is really long, I wanted the Find button disabled while it is searching.  Also I wanted to have "Nothing Found" to pop up momentarily before clearing the find field.  In ETSK it works like it is supposed to, however in AI it only does the search functions and clears the field, it does not disable the find button or do the little pop-in message of "Nothing Found".

       

      By the way.. putting alert() into the function in the parts that do not seem to be executing, makes their execution visible but only held up by the alert box? 

       

      [Edit]: Interestingly, it works fine in my InDesign but not so much in Photoshop- which displays it the worst actually.  I'm on CS5 btw.

       

      Does anybody have any advice? 

       

      Thanks in advance to anyone who's wanting to take a look at this.

      -V

       

      var w = new Window("dialog","Find List");

      var L = w.add("listbox"); L.size=[170,400];

      for(i=0; i<1300; i++){

          L.add("item","Line "+i);

      }

       

      var findWindow = w.add("edittext"); findWindow.characters=25;       

       

      var findBtn = w.add("button",undefined,"The Find Button");

      findBtn.onClick = function(){

          if(findWindow.text != ""){

              findBtn.enabled=false;

              var searchRx = new RegExp(findWindow.text,"ig");

              for(i=0; i<L.items.length; i++){

                  if(L.items[i].toString().match(searchRx)){

                      findWindow.text = L.items[i];

                      L.selection = i;

                      break;

                  } else if(i==L.items.length-1){

                      findWindow.text = "Nothing Found"; $.sleep(700); findWindow.text = "";

                  }

              }

          findBtn.enabled=true;

          } else {

              findBtn.enabled=true;

              alert("Type something into the Find Window");

          }

      }

       

      w.show();