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

Testing scriptUI resource spec

Community Beginner ,
Feb 28, 2014 Feb 28, 2014

Copy link to clipboard

Copied

How do you all test your resource spec script UI code? Every time I try to make a dialog with it, I get errors and have the hardest time troubleshooting. Any tips to make this easier?

TOPICS
Scripting

Views

494

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
Advocate ,
Mar 05, 2014 Mar 05, 2014

Copy link to clipboard

Copied

I've used a clunky cheat to sorta help with debugging resource errors. I use a try/catch and process the err description to pull the error character out into an alert. Ideally there is a buffer of characters around the error character to help me hunt down the exact spot in the string. Doesn't always work, but usually gets me in the ballpark to find the error.

//START

try{

          var myPanel = new Window("palette", "Name", undefined);

          var res = "group{orientation:'row', aligment:['fill', 'fill'], alignChildren::['fill', 'fill'],\

                    test: StaticText{text:'Hi'},\

          }";

          myPanel.grp = myPanel.add(res);

          myPanel.show();

}catch(err){

          var desc = err.description                                        //Calls the error description

          var charOffsetLine = desc.split(",")[1];                        //Splits at the commas

          var offset = charOffsetLine.split(" ");                         //Grabs the second line of error text

          var charLocation = offset[offset.length-1];               //Grabs what should be the numerical value of the error

          var errSegment = res.substr(charLocation-20, 20);     //Grabs characters before and after the error character

          alert(errSegment);                                                       //Alert the results

}

//END

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
Community Beginner ,
Mar 06, 2014 Mar 06, 2014

Copy link to clipboard

Copied

Thanks David. That's pretty helpful. I copied and pasted your code and was able to find and correct the errors based on the alert message. I'll try implementing this into my code. It would be awesome if there was a working ScriptUI WYSIWYG generator. I know there was one in the past but I never got it to work. So much time is wasted away for me when dealing with UI.

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
Advocate ,
Mar 06, 2014 Mar 06, 2014

Copy link to clipboard

Copied

LATEST

Thanks for that David. Nice idea.

Xavier.

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