7 Replies Latest reply: Aug 1, 2012 7:23 AM by Trevorׅ RSS

    Script Dialog Flashes Briefly Then Disappears


      Hi All,

      I'm trying to write a script for indesign CS6 mac which will open a panel and let me interact with it while indesign is open. I've tried several different code approaches, and with all of them, the window briefly opens and then closes immediately. If I add an infinite loop into the mix, it does not close, but remains  unresponsive. This is one version of the code:

      #target inDesign
      #targetengine main
      function myScript(thisObj) {
                function myScript_buildUI(thisObj) {
                          var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "My Panel Name", [0, 0, 300, 300]);
                          res="group{orientation:'column', alignment:['fill', 'fill'], alignChildren:['fill', 'fill'],\
                                    myStaticText: StaticText{text:'StaticText Text'},\
                                    myEditText: EditText{text:'EditText text'},\
                                    myButton: Button{text:'Button Name'},\
                                    myCheckbox: Checkbox{text:'Checkbox Name'},\
                                    myRadioButton: RadioButton{text:'RadioButton Name'},\
                                    myDropDownList: DropDownList{properties:{items:['Item 1 Name', 'Item 2 Name', 'Item 3 Name', 'Item 4 Name']}},\
                                    myListBox: ListBox{properties:{items:['Item 1 Name', 'Item 2 Name', 'Item 3 Name', 'Item 4 Name']}},\
                                    myGroup: Group{orientation:'row', alignment:['fill', 'fill'], alignChildren:['fill', 'fill'],\
                                              myGroupItem1: Button{text:'Hi'},\
                                              myGroupItem2: Button{text:'Hello'},\
                                              myGroupItem3: Button{text:'Goodbye'},\
                                    myPanel: Panel{text:'Panel Name', orientation:'column', alignChildren:['right', 'fill'],\
                                              myPanelItem1: Button{text:'One'},\
                                              myPanelItem2: Button{text:'Two'},\
                                              myPanelItem3: Button{text:'Three'},\
                                    myProgressBar: Progressbar{text:'Progressbar Name', minvalue:0, maxvalue:100, value:50},\
                          app.addEventListener("afterSelectionChanged", onSelChg, false ); 
                          //Add resource string to panel
                          myPanel.grp = myPanel.add(res);
                          // DropDownList default selection
                          myPanel.grp.myDropDownList.selection = 2;//Item index starts at 0
                          //Setup panel sizing and make panel resizable
                          myPanel.grp.minimumSize = myPanel.grp.size;
                          myPanel.onResizing = myPanel.onResize = function () {this.layout.resize();}
                          return myPanel;
                var myScriptPal = myScript_buildUI(thisObj);
                if ((myScriptPal != null) && (myScriptPal instanceof Window)) {
      function onSelChg()


      Any ideas?