0 Replies Latest reply on Oct 15, 2014 3:50 PM by Crundo

    Why can't I get the value of "checkedState" in ScriptUI?

    Crundo

      I found I can't get checkedState's value recently, and anybody can help me?

       

      The snippet script is following:

       

      #target "InDesign-8.0"

      main();

       

       

      function main(){

          myInterFace();

          myTeardown();

      }

       

       

      function myInterFace(){

          //<fragment>

          var myDialog = app.dialogs.add({name:"Testing", canCancel:true});

          with(myDialog){

              //Add a dialog column.

              with(dialogColumns.add()){

                  with(checkboxControls.add()){

                      staticLabel = "Facing Pages";

                      checkedState = true;

                      minWidth = 140;

                      }

                  }

              }

        if(myDialog.show() == true){

              var mycheckboxControl = app.dialogs.item(0).dialogColumns.item(0).checkboxControls.item(0);

              var pageMarginSetting = new Array;

              pageMarginSetting.push(mycheckboxControl.checkedState);

              alert("testing");

              formattingTemplate(pageMarginSetting);

              myDialog.destroy();

              }

        else{

        myDialog.destroy()

              }

          }

       

       

      function formattingTemplate(pageMarginSetting){

          var myFileNameString = "/C_Test_Template.indd"

          var myDoc = app.documents.add({name:myFileNameString});

          with(myDoc.documentPreferences){

              pageHeight = 280;

              pageWidth = 210;

              pageOrientation = PageOrientation.portrait;

              facingPages = pageMarginSetting[0];

              startPageNumber = 1;

              }

          myDoc.save(File(Folder.desktop + myFileNameString));

          }

      function myTeardown(){

         

          }