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

ScriptUI executing: ETSK vs Illustrator

Valorous Hero ,
Sep 03, 2012 Sep 03, 2012

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.toString().match(searchRx)){

                findWindow.text = L.items;

                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();

TOPICS
Scripting
1.2K
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

correct answers 1 Correct answer

Community Expert , Sep 03, 2012 Sep 03, 2012

add a couple of window updates as follows

here

        findBtn.enabled=false;

                    w.update();

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

and here

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

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

            }

Translate
Adobe
Community Expert ,
Sep 03, 2012 Sep 03, 2012

add a couple of window updates as follows

here

        findBtn.enabled=false;

                    w.update();

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

and here

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

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

            }

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 ,
Sep 03, 2012 Sep 03, 2012
LATEST

Thanks a lot, it made the operation work in AI as it did in the ETSK.  Now I can sleep easy till tomorrow!

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