9 Replies Latest reply on Aug 17, 2013 2:48 AM by bastieneichenberger

    build dialog user interface

    bastieneichenberger Level 1

      Hi all,

       

      I'm building my first UI with javascript and Indesign.

       

      Unfortunatly, I don't understand how to align the static text label with the editext label…

      My goal is to align the labelBitmap, limitBitmap. The result have to look like this: "limite image bitmap 1200 dpi" on 1 ligne.

       

      Can someone help me?

       

      Thanks you for your answer.

       

      I use the following code:

       

      function createDialog() {

                var myArray = [];

           var myListBoxBounds = [0, 0, 564, 160];

       

       

                if (app.extractLabel("KasIgnoredFolders") != "") {

                          myArray = app.extractLabel("KasIgnoredFolders").split(",");

                }

                var dlg = new Window("dialog", "réduction d'images");

       

       

                dlg.orientation = 'column';

                dlg.alignChildren = 'top';

                dlg.btnPnl = dlg.add('panel', undefined, "images ignorées");

                dlg.btnPnl.orientation = 'column';

                dlg.btnPnl.helpTip = "ajouté une image si vous ne souhaitez pas qu'elle soit prise en compte par ce script";

       

       

                dlg.btnPnl.listBox = dlg.btnPnl.add('listbox', undefined, myArray, {multiselect:true});

                dlg.btnPnl.listBox.bounds = myListBoxBounds;

       

       

                dlg.btnPnl.grp = dlg.btnPnl.add('group');

                dlg.btnPnl.grp.orientation = 'row';

                dlg.btnPnl.grp.addBtn = dlg.btnPnl.grp.add('button', undefined, "ajouter image");

                dlg.btnPnl.grp.addBtn.helpTip = "ajouter une image à la liste";

                dlg.btnPnl.grp.removeBtn = dlg.btnPnl.grp.add('button', undefined, "supprimer image");

                dlg.btnPnl.grp.removeBtn.helpTip = "supprimer l'image sélectionnée de la liste";

                dlg.btnPnl.grp.remAllBtn = dlg.btnPnl.grp.add('button', undefined, "supprimer toutes");

                dlg.btnPnl.grp.remAllBtn.helpTip = "supprimer toutes les images de la liste";

         

       

       

                dlg.grp = dlg.add('panel', undefined, "réglages");

          dlg.grp.orientation = 'row';

         

       

       

                dlg.grp.subGrp = dlg.grp.add('group');

                dlg.grp.subGrp.radioPanel_left = dlg.grp.subGrp.add('panel', undefined, "sous-échantillonnage");

                dlg.grp.subGrp.radioPanel_left.alignment = 'left';

                dlg.grp.subGrp.radioPanel_left.alignChildren = 'left';

       

       

          dlg.grp.subGrp.radioPanel_left.rad1 = dlg.grp.subGrp.radioPanel_left.add('radiobutton', undefined, "activé");

                dlg.grp.subGrp.radioPanel_left.rad2 = dlg.grp.subGrp.radioPanel_left.add('radiobutton', undefined, "désactivé");

         

          

                dlg.grp.subGrp2 = dlg.grp.add('group');

                dlg.grp.subGrp2.radioPanel = dlg.grp.subGrp2.add('panel', undefined, "sur-échantillonnage");

                dlg.grp.subGrp2.radioPanel.alignment = 'right';

                dlg.grp.subGrp2.radioPanel.alignChildren = 'left';

       

          dlg.grp.subGrp2.radioPanel.rad3 = dlg.grp.subGrp2.radioPanel.add('radiobutton', undefined, "activé");

                dlg.grp.subGrp2.radioPanel.rad4 = dlg.grp.subGrp2.radioPanel.add('radiobutton', undefined, "désactivé");

         

          //-----------------------limit text box------------------------------ here is the problem ---------------------------

          dlg.grp.subGrp2.radioPanel.labelBitmap = dlg.grp.subGrp2.radioPanel.add('statictext', undefined, 'limite image bitmap');

          dlg.grp.subGrp2.radioPanel.limitBitmap = dlg.grp.subGrp2.radioPanel.add('edittext', undefined, '1200');

                dlg.grp.subGrp2.radioPanel.limitUnitBitmap = dlg.grp.subGrp2.radioPanel.add('statictext', undefined, 'dpi');

         

          dlg.grp.subGrp2.radioPanel.labelRaster = dlg.grp.subGrp2.radioPanel.add('statictext', undefined, 'limite image pixelisée');

          dlg.grp.subGrp2.radioPanel.limitRaster = dlg.grp.subGrp2.radioPanel.add('edittext', undefined, '300');

                dlg.grp.subGrp2.radioPanel.limitUnitRaster = dlg.grp.subGrp2.radioPanel.add('statictext', undefined, 'dpi');

         

                // ----------------------- navigation ------------------------------

          dlg.okBtn = dlg.add('button', undefined, "lancer le script", {name:'ok'});

          dlg.cancelBtn = dlg.add('button', undefined, "annuler", {name:'cancel'});

         

          var myDialogResult = dlg.show();

          var myResult = {};

          return myResult;

          }

        • 1. Re: build dialog user interface
          UQg Level 4

          Just put all three elements (label, value, unit) in a group, orientation 'row'.

           

          Also you dont need to do

          dlg.grp.subGrp = dlg.grp.add('group');

          dlg.grp.subGrp.radioPanel_left = dlg.grp.subGrp.add('panel', undefined, "sous-échantillonnage");

          just add the panel straight away, you dont need the subGroup (unless you didnt show the whole UI and there is something else under the radiobutton panel).

           

          Below is your second (réglage panel) rewritten a bit more organized. ignore if it doesnt help.

           

          Xavier

           

           

           

          var rad1, rad2, rad3, rad4, bitmapValue, rasterValue;

           

          with (dlg.regPnl = dlg.add('panel', undefined, "réglages"))

          {

              orientation = 'row';

           

              with(dlg.regPnl.sousPnl = add('panel', undefined, "sous-échantillonnage"))

              {

                  alignment = 'fill';

                  alignChildren = 'left';

                  rad1 = add('radiobutton', undefined, "activé");     rad1.value = true;

                  rad2 = add('radiobutton', undefined, "désactivé");

                  }

              with(dlg.regPnl.surPnl = add('panel', undefined, "sur-échantillonnage"))

              {

                  alignment = 'fill';

                  alignChildren = 'left';

                  rad3 = add('radiobutton', undefined, "activé");     rad3.value = true;

                  rad4 = add('radiobutton', undefined, "désactivé");

           

                  with(dlg.regPnl.surPnl.bitmapRow = add('group'))

                  {

                      orientation = 'row';

                      alignChildren = 'left';

                      spacing = 2;

                      add('statictext', undefined, 'limite image bitmap');    children[0].characters = 18;

                      bitmapValue = add('edittext', undefined, '1200');    children[1].characters = 4;

                      add('statictext', undefined, 'dpi');

                      }

                  with(dlg.regPnl.surPnl.rasterRow = add('group'))

                  {

                      orientation = 'row';

                      alignChildren = 'left';

                      spacing = 2;

                      add('statictext', undefined, 'limite image pixelisée');    children[0].characters = 18;

                      rasterValue = add('edittext', undefined, '300');        children[1].characters = 4;

                      add('statictext', undefined, 'dpi');

                      }

                  }

              }

          • 2. Re: build dialog user interface
            bastieneichenberger Level 1

            Hi,

             

            Thanks you for your answer! It's work great!

            I have an other question: how to manage the size of an window panel object?

            If I give a bounds array to my panel, the content disapear…:(

             

            I explain the problem in comment at the line 31.

             

            In advance, thanks your for your help!

             

             

            #target indesign

             

             

            createDialog ();

             

             

            function createDialog() {

                var myArray = [];

                var myListBoxBounds = [0, 0, 500, 200];

                // window

                var win = new Window("dialog", "réduction d'images");

                win.orientation = 'column';

                win.alignChildren = 'top';

                // ignored img panel ----------------------------------------------------------------------------------------- -------------------------------------------------------------------

                var ignored_pan = win.add('panel', undefined, "images ignorées");

                ignored_pan.orientation = 'column';

                ignored_pan.helpTip = "ajouté une image si vous ne souhaitez pas qu'elle soit prise en compte par ce script";

                ignored_pan.listBox = ignored_pan.add('listbox', undefined, myArray, {multiselect:true});

                ignored_pan.listBox.bounds = myListBoxBounds;

                // group button

                var ignored_pan_button = ignored_pan.add('group');

                ignored_pan_button.orientation = 'row';

                ignored_pan_button.addBtn = ignored_pan_button.add('button', undefined, "ajouter image");

                ignored_pan_button.addBtn.helpTip = "ajouter une image à la liste";

                ignored_pan_button.removeBtn = ignored_pan_button.add('button', undefined, "supprimer image");

                ignored_pan_button.removeBtn.helpTip = "supprimer l'image sélectionnée de la liste";

                ignored_pan_button.remAllBtn = ignored_pan_button.add('button', undefined, "supprimer toutes");

                ignored_pan_button.remAllBtn.helpTip = "supprimer toutes les images de la liste";

                // settings panel ----------------------------------------------------------------------------------------- ------------------------------------------------------------------------

                var settings_bounds = [0, 0, 600, 300];

                var setting_pan = win.add('panel', undefined, "réglages");

                setting_pan.orientation = 'column';

                setting_pan.bounds = settings_bounds; // if you comment this line there is content inside

                //group cible button

                var cible_bitmap_pan = setting_pan.add('group');

                cible_bitmap_pan.orientation = 'row';

                cible_bitmap_pan.alignment = 'left';

                cible_bitmap_pan.labelCibleBitmap = cible_bitmap_pan.add('statictext', undefined, 'cible image bitmap');

                cible_bitmap_pan.cibleBitmap = cible_bitmap_pan.add('edittext', undefined, '1200');

                cible_bitmap_pan.cibleUnitBitmap = cible_bitmap_pan.add('statictext', undefined, 'dpi');

               

                var cible_raster_pan =  setting_pan.add('group');

                cible_raster_pan.alignment = 'left'

                cible_raster_pan.orientation = 'row';

                cible_raster_pan.labelCibleRaster = cible_raster_pan.add('statictext', undefined, 'cible image pixelisée');

                cible_raster_pan.cibleRaster = cible_raster_pan.add('edittext', undefined, '300');

                cible_raster_pan.cibleUnitRaster = cible_raster_pan.add('statictext', undefined, 'dpi');

                // group sous-echantillonnage

                var ss_echantillonnage_pan = setting_pan.add('panel', undefined, "sous-échantillonnage");

                ss_echantillonnage_pan.alignment = 'left';

                ss_echantillonnage_pan.alignChildren = 'left';

                // group button

                ss_echantillonnage_pan.rad1 = ss_echantillonnage_pan.add('radiobutton', undefined, "activé");

                ss_echantillonnage_pan.rad2 = ss_echantillonnage_pan.add('radiobutton', undefined, "désactivé");

             

             

                 

                  var sur_echantillonnage_pan = setting_pan.add('panel', undefined, "sur-échantillonnage");

                  sur_echantillonnage_pan.alignment = 'right';

                  sur_echantillonnage_pan.alignChildren = 'left';

             

             

                  sur_echantillonnage_pan.rad1 = sur_echantillonnage_pan.add('radiobutton', undefined, "activé");

                  sur_echantillonnage_pan.rad2 = sur_echantillonnage_pan.add('radiobutton', undefined, "désactivé");

             

             

             

             

                  var limite_bitmap_pan=  sur_echantillonnage_pan.add('group');

                  limite_bitmap_pan.orientation = 'row';

                  limite_bitmap_pan.labelBitmap = limite_bitmap_pan.add('statictext', undefined, 'résolution min. image bitmap');

                  limite_bitmap_pan.limitBitmap = limite_bitmap_pan.add('edittext', undefined, '1000');

                  limite_bitmap_pan.limitUnitBitmap = limite_bitmap_pan.add('statictext', undefined, 'dpi');

             

             

                  var limite_raster_pan =  sur_echantillonnage_pan.add('group');

            limite_raster_pan.labelRaster = limite_raster_pan.add('statictext', undefined, 'résolution min. image pixelisée');

            limite_raster_pan.limitRaster = limite_raster_pan.add('edittext', undefined, '200');

                  limite_raster_pan.limitUnitRaster = limite_raster_pan.add('statictext', undefined, 'dpi');

              

                      // ----------------------- navigation ------------------------------

                win.okBtn = win.add('button', undefined, "lancer le script", {name:'ok'});

                win.cancelBtn = win.add('button', undefined, "annuler", {name:'cancel'});

              

                var myDialogResult = win.show();

                var myResult = {};

                return myResult;

                }

            • 3. Re: build dialog user interface
              UQg Level 4

              As far as i know, when you fix the bounds of a container, the AutoLayoutManager stops working out the content of that container.

              Instead of the bounds (which are too restrictive) you can specify the minimumSize (to make sure it is always big enough), or maximumSize, or preferredSize.

               

              Xavier.

              • 4. Re: build dialog user interface
                bastieneichenberger Level 1

                Hi,

                 

                Thanks you! It's work!

                • 5. Re: build dialog user interface
                  bastieneichenberger Level 1

                  Hi,

                   

                  An other question: i don't know how to align verticaly 2 radio button in a group:

                   

                      var ss_echantillonnage_pan = grp_echantillonnage.add('panel', undefined, "sous-échantillonnage");

                      ss_echantillonnage_pan.alignChildren = 'left';

                      ss_echantillonnage_pan.minimumSize = [75,140];

                      ss_echantillonnage_pan.rad1 = ss_echantillonnage_pan.add('radiobutton', undefined, "activé");

                      ss_echantillonnage_pan.rad2 = ss_echantillonnage_pan.add('radiobutton', undefined, "désactivé");

                   

                  And if I want to align the rad1 and rad2 vertically in the panel "sous-échantillonnage"?

                   

                  In advance, thanks your for help!

                  Have a nice day.

                  • 6. Re: build dialog user interface
                    UQg Level 4

                    ss_echantillonnage_pan.orientation = 'column';

                     

                    Funny, you use it several times in your script.

                     

                    Xavier

                    • 7. Re: build dialog user interface
                      bastieneichenberger Level 1

                      Thanks for your answer! My question wasn't good explain…

                      My problem is that this 2 radio button are in a panel and i would like to align this 2 button verticaly in this panel.

                       

                      my code:

                      If you run it you will see that the "sous-échantillonnage" panel contains 2 button and I would like to justify them verticaly…

                       

                       

                      #target indesign

                      var results = create_dialog_main ();

                      alert(results);

                       

                       

                      function create_dialog_main() {

                          var myArray = [];

                          var myListBoxBounds = [0, 0, 500, 200];

                          // window

                          var win = new Window("dialog", "réduction d'images");

                          win.orientation = "column";

                          win.alignChildren = "top";

                          // ignored img panel

                          var ignored_pan = win.add("panel", undefined, "images ignorées");

                          ignored_pan.orientation = "column";

                          ignored_pan.helpTip = "ajouté une image si vous ne souhaitez pas qu'elle soit prise en compte par ce script";

                          ignored_pan.listBox = ignored_pan.add("listbox", undefined, myArray, {multiselect:true});

                          ignored_pan.listBox.bounds = myListBoxBounds;

                          // group button

                          var ignored_pan_button = ignored_pan.add("group");

                          ignored_pan_button.orientation = "row";

                          ignored_pan_button.addBtn = ignored_pan_button.add("button", undefined, "ajouter image");

                          ignored_pan_button.addBtn.helpTip = "ajouter une image à la liste";

                          ignored_pan_button.removeBtn = ignored_pan_button.add("button", undefined, "supprimer image");

                          ignored_pan_button.removeBtn.helpTip = "supprimer l'image sélectionnée de la liste";

                          ignored_pan_button.remAllBtn = ignored_pan_button.add("button", undefined, "supprimer toutes");

                          ignored_pan_button.remAllBtn.helpTip = "supprimer toutes les images de la liste";

                          // settings panel

                          var setting_pan = win.add("panel", undefined, "réglages");

                          setting_pan.orientation = "column";

                          setting_pan.minimumSize = [500, 0];

                          //group cible and prop

                          var grp_cible_prop = setting_pan.add("group");

                          grp_cible_prop.orientation = "row";

                          grp_cible_prop.alignment = "left";

                          //group cible bitmap, cible raster

                          var grp_bitmap_raster = grp_cible_prop.add("group");

                          grp_bitmap_raster.orientation = "column";

                          grp_bitmap_raster.minimumSize = [250, 0];

                          //group bitmap cible

                          var cible_bitmap_pan = grp_bitmap_raster.add("group");

                          cible_bitmap_pan.orientation = "row";

                          cible_bitmap_pan.alignment = "left";

                          cible_bitmap_pan.labelCibleBitmap = cible_bitmap_pan.add("statictext", undefined, "cible image bitmap");

                          cible_bitmap_pan.cibleBitmap = cible_bitmap_pan.add("edittext", undefined, "1200");

                          cible_bitmap_pan.cibleBitmap.minimumSize = [60,0];

                          cible_bitmap_pan.cibleUnitBitmap = cible_bitmap_pan.add("statictext", undefined, "dpi");

                          //group raster cible

                          var cible_raster_pan =  grp_bitmap_raster.add("group");

                          cible_raster_pan.alignment = "left"

                          cible_raster_pan.orientation = "row";

                          cible_raster_pan.labelCibleRaster = cible_raster_pan.add("statictext", undefined, "cible image pixelisée");

                          cible_raster_pan.cibleRaster = cible_raster_pan.add("edittext", undefined, "300");

                          cible_raster_pan.cibleRaster.minimumSize = [50, 10];

                          cible_raster_pan.cibleUnitRaster = cible_raster_pan.add("statictext", undefined, "dpi");

                          // group proportionnelle

                          var prop_pan = grp_cible_prop.add("panel", undefined, "images non-proportionnelles");

                          prop_pan.alignChildren = "left";

                          prop_pan.minimumSize = [200, 0];

                          prop_pan.rad1 = prop_pan.add("radiobutton", undefined, "activé");

                          prop_pan.rad2 = prop_pan.add("radiobutton", undefined, "désactivé");

                          // group sous-echantillonnage

                          var grp_echantillonnage = setting_pan.add("group");

                          grp_echantillonnage.orientation = "row";

                          grp_echantillonnage.alignment = "top";

                          grp_echantillonnage.alignChildren = "bottom";

                          var ss_echantillonnage_pan = grp_echantillonnage.add("panel", undefined, "sous-échantillonnage");

                          ss_echantillonnage_pan.alignChildren = "left";

                          ss_echantillonnage_pan.minimumSize = [75,140];

                          ss_echantillonnage_pan.rad1 = ss_echantillonnage_pan.add("radiobutton", undefined, "activé");

                          ss_echantillonnage_pan.rad2 = ss_echantillonnage_pan.add("radiobutton", undefined, "désactivé");

                          // group sur-echantillonnage

                          var sur_echantillonnage_pan = grp_echantillonnage.add("panel", undefined, "sur-échantillonnage");

                          sur_echantillonnage_pan.alignChildren = "left";

                          sur_echantillonnage_pan.rad1 = sur_echantillonnage_pan.add("radiobutton", undefined, "activé");

                          sur_echantillonnage_pan.rad2 = sur_echantillonnage_pan.add("radiobutton", undefined, "désactivé");

                          // group limite bitmap

                          var limite_bitmap_pan=  sur_echantillonnage_pan.add("group");

                          limite_bitmap_pan.orientation = "row";

                          limite_bitmap_pan.labelBitmap = limite_bitmap_pan.add("statictext", undefined, "résolution min. image bitmap");

                          limite_bitmap_pan.limitBitmap = limite_bitmap_pan.add("edittext", undefined, "1000");

                          limite_bitmap_pan.limitUnitBitmap = limite_bitmap_pan.add("statictext", undefined, "dpi");

                          // group limit raster

                          var limite_raster_pan =  sur_echantillonnage_pan.add("group");

                          limite_raster_pan.labelRaster = limite_raster_pan.add("statictext", undefined, "résolution min. image pixelisée");

                          limite_raster_pan.limitRaster = limite_raster_pan.add("edittext", undefined, "200");

                          limite_raster_pan.limitUnitRaster = limite_raster_pan.add("statictext", undefined, "dpi");

                           // ----------------------- navigation ------------------------------

                          var grp_navigation = win.add("group");

                          grp_navigation.orientation = "row";

                          grp_navigation.alignment = "right";

                          grp_navigation.cancelBtn = grp_navigation.add("button", undefined, "annuler", {name:"cancel"});

                          grp_navigation.okBtn = grp_navigation.add("button", undefined, "lancer le script", {name:"ok"});

                          //-------------------------- functions ----------------------------

                          cible_bitmap_pan.cibleBitmap.onChange = function(){

                              is_textfield_valid (this, "1200", "vous devez saisir un nombre entier");

                          }

                         

                          cible_raster_pan.cibleRaster.onChange = function(){

                              is_textfield_valid (this, "300", "vous devez saisir un nombre entier");

                          }

                       

                       

                          limite_bitmap_pan.limitBitmap.onChange = function(){

                              is_textfield_valid (this, "1000", "vous devez saisir un nombre entier")

                          }

                         

                          limite_raster_pan.limitRaster.onChange = function(){

                              is_textfield_valid (this, "200", "vous devez saisir un nombre entier");

                          }

                       

                       

                          function is_textfield_valid(object, default_value_number, alert_str){

                              if (!isInt(object.text)) {

                                  alert(alert_str);

                                  object.text = default_value_number;

                              }

                              if(parseInt (object.text) < 1){

                                  alert("vous devez saisir un nombre plus grand ou égal a 1");

                                  object.text = default_value_number;

                              }

                          }

                       

                       

                          function isInt(n) {

                              return parseFloat(n) == parseInt(n, 10) && !isNaN(n);

                          }

                          //-------------------------- return values ----------------------------

                          var results = {};

                          // if show == 1 the user click run

                          if(win.show() == 1){

                              // is the picture prop check or not

                              if(prop_pan.rad1.value){

                                  results.isPictureProp = true;

                              }

                              else{

                                  results.isPictureProp = false;

                              }

                              // is the sous echantillonnage check

                              if(ss_echantillonnage_pan.rad1){

                                  results.isSousEchantillonnage = true;

                              }

                              else{

                                  results.isSousEchantillonnage = false;

                              }

                              // is the sur echantillonnage check

                              if(sur_echantillonnage_pan.rad1){

                                  results.isSurEchantillonnage = true;

                              }

                              else{

                                  results.isSurEchantillonnage = false;       

                              }

                              // return the target value, the validation is done during onChange event

                              results.cibleBitmap = cible_bitmap_pan.cibleBitmap;

                              results.cibleBaster = cible_raster_pan.cibleRaster

                          }

                          //else the script was canceled

                          else{

                              results = null;

                          }

                          return results;

                      }

                      • 8. Re: build dialog user interface
                        UQg Level 4

                        Hi,

                        i tried your code and the radiobuttons in the ss_echantillonnage_pan where aligned together.

                        Now if you want to align these two buttons with other buttons in similar panels, you have to put those panels in a common group and play with the alignment. That's how it works.

                        For instance to align the radiobuttons from ss_echantillonnage_pan and sur_echantillonnage_pan you have to put these 2 panels in a group, orientation 'row' and set their alignment to ['fill', 'top'], or ['fill', 'fill'], something like this.

                        Make some tries.

                         

                        I didnt read you code entirely, no time, but apparently the faultive is grp_echantillonnage.alignChildren = "bottom";

                        Change it to 'fill' or 'top' maybe.

                        Xavier

                        • 9. Re: build dialog user interface
                          bastieneichenberger Level 1

                          Hi thanks you for your reply!

                          It's work now.

                           

                          I add my code if it can help someone:

                           

                           

                          #include "tools.jsx"
                          #include "pictures_tools.jsx"
                          
                          
                          /*
                          @Example
                          var results = create_dialog_main ();
                          if(results != null){
                              $.writeln (results.cibleBitmap)
                              $.writeln (results.cibleRaster);
                              $.writeln (results.limitBitmap);
                              $.writeln (results.limitRaster);
                              $.writeln ("prop "+results.isPictureProp)
                              $.writeln ("sous echant "+results.isSousEchantillonnage)
                              $.writeln ("sur echant "+results.isSurEchantillonnage)
                              for(var i = 0; i<results.array_of_ignored_picture.length; i++){
                                  $.writeln("img: "+results.array_of_ignored_picture[i]);
                              }
                          }
                          else{
                                  alert("le script a été annulé");
                                  exit();
                          }*/
                          
                          
                          /*
                           * function who create a dialog box for the script
                           * @return an array of results if the user click run, then return null
                           **/
                          function create_dialog_main() {
                              var myArray = [];
                              var myListBoxBounds = [0, 0, 500, 200];
                              var myListMargins = [10, 10, 0, 0];
                              // window
                              var win = new Window("dialog", "réduction d'images");
                              win.orientation = "column";
                              win.alignChildren = "top";
                              // ignored img panel 
                              var ignored_pan = win.add("panel", undefined, "images ignorées");
                              var grp_ignored = ignored_pan.add("group");
                              grp_ignored.orientation = "column";
                              grp_ignored.helpTip = "ajouté une image si vous ne souhaitez pas qu'elle soit prise en compte par ce script";
                              grp_ignored.listBox = grp_ignored.add("listbox", undefined, myArray, {multiselect:true});
                              grp_ignored.listBox.bounds = myListBoxBounds;
                              grp_ignored.margins = myListMargins;
                              // group button
                              var ignored_pan_button = ignored_pan.add("group");
                              ignored_pan_button.orientation = "row";
                              ignored_pan_button.addBtn = ignored_pan_button.add("button", undefined, "ajouter image");
                              ignored_pan_button.addBtn.helpTip = "ajouter une image à la liste";
                              ignored_pan_button.removeBtn = ignored_pan_button.add("button", undefined, "supprimer image");
                              ignored_pan_button.removeBtn.helpTip = "supprimer l'image sélectionnée de la liste";
                              ignored_pan_button.remAllBtn = ignored_pan_button.add("button", undefined, "supprimer toutes");
                              ignored_pan_button.remAllBtn.helpTip = "supprimer toutes les images de la liste";
                              // settings panel
                              var setting_pan = win.add("panel", undefined, "réglages");
                              setting_pan.orientation = "column";
                              setting_pan.minimumSize = [500, 0];
                              //group cible and prop
                              var grp_cible_prop = setting_pan.add("group");
                              grp_cible_prop.orientation = "row";
                              grp_cible_prop.alignment = "left";
                              //group cible bitmap, cible raster
                              var grp_bitmap_raster = grp_cible_prop.add("group");
                              grp_bitmap_raster.orientation = "column";
                              grp_bitmap_raster.minimumSize = [250, 0];
                              //group bitmap cible
                              var cible_bitmap_pan = grp_bitmap_raster.add("group");
                              cible_bitmap_pan.orientation = "row";
                              cible_bitmap_pan.alignment = "left";
                              cible_bitmap_pan.labelCibleBitmap = cible_bitmap_pan.add("statictext", undefined, "cible image bitmap");
                              cible_bitmap_pan.cibleBitmap = cible_bitmap_pan.add("edittext", undefined, "1200");
                              cible_bitmap_pan.cibleBitmap.minimumSize = [60,0];
                              cible_bitmap_pan.cibleUnitBitmap = cible_bitmap_pan.add("statictext", undefined, "dpi");
                              //group raster cible
                              var cible_raster_pan =  grp_bitmap_raster.add("group");
                              cible_raster_pan.alignment = "left"
                              cible_raster_pan.orientation = "row";
                              cible_raster_pan.labelCibleRaster = cible_raster_pan.add("statictext", undefined, "cible image pixelisée");
                              cible_raster_pan.cibleRaster = cible_raster_pan.add("edittext", undefined, "300");
                              cible_raster_pan.cibleRaster.minimumSize = [50, 10];
                              cible_raster_pan.cibleUnitRaster = cible_raster_pan.add("statictext", undefined, "dpi");
                              // group proportionnelle
                              var prop_pan = grp_cible_prop.add("panel", undefined, "images non-proportionnelles");
                              prop_pan.alignChildren = "left";
                              prop_pan.minimumSize = [200, 0];
                              prop_pan.rad1 = prop_pan.add("radiobutton", undefined, "autorisées");
                              prop_pan.rad2 = prop_pan.add("radiobutton", undefined, "interdites");
                              prop_pan.rad2.value = true;
                              // group ss echantillonnnage and ss echantillonnage -> group echantillonnage
                              var grp_echantillonnage = setting_pan.add("group");
                              grp_echantillonnage.orientation = "row";
                              // group ss echantillonnage
                              var ss_echantillonnage_pan = grp_echantillonnage.add("panel", undefined, "sous-échantillonnage");
                              ss_echantillonnage_pan.minimumSize = [75,140];
                              var grp_ss_echantillonnage = ss_echantillonnage_pan.add("group");
                              grp_ss_echantillonnage.alignChildren = "left";
                              grp_ss_echantillonnage.orientation = "column";
                              grp_ss_echantillonnage.alignment = "left";
                              grp_ss_echantillonnage.margins = [0,25,0,0];
                              ss_echantillonnage_pan.rad1 = grp_ss_echantillonnage.add("radiobutton", undefined, "activé");
                              ss_echantillonnage_pan.rad1.value = true;
                              ss_echantillonnage_pan.rad2 = grp_ss_echantillonnage.add("radiobutton", undefined, "désactivé");
                              // group sur-echantillonnage
                              var sur_echantillonnage_pan = grp_echantillonnage.add("panel", undefined, "sur-échantillonnage");
                              sur_echantillonnage_pan.alignChildren = "left";
                              sur_echantillonnage_pan.rad1 = sur_echantillonnage_pan.add("radiobutton", undefined, "activé");
                              sur_echantillonnage_pan.rad1.value = true;
                              sur_echantillonnage_pan.rad2 = sur_echantillonnage_pan.add("radiobutton", undefined, "désactivé");
                              // group limite bitmap
                              var limite_bitmap_pan=  sur_echantillonnage_pan.add("group");
                              limite_bitmap_pan.orientation = "row";
                              limite_bitmap_pan.labelBitmap = limite_bitmap_pan.add("statictext", undefined, "résolution min. image bitmap");
                              limite_bitmap_pan.limitBitmap = limite_bitmap_pan.add("edittext", undefined, "1000");
                              limite_bitmap_pan.limitUnitBitmap = limite_bitmap_pan.add("statictext", undefined, "dpi");
                              // group limit raster
                              var limite_raster_pan =  sur_echantillonnage_pan.add("group");
                              limite_raster_pan.labelRaster = limite_raster_pan.add("statictext", undefined, "résolution min. image pixelisée");
                              limite_raster_pan.limitRaster = limite_raster_pan.add("edittext", undefined, "200");
                              limite_raster_pan.limitUnitRaster = limite_raster_pan.add("statictext", undefined, "dpi");
                               // ----------------------- navigation ------------------------------
                              var grp_navigation = win.add("group");
                              grp_navigation.orientation = "row";
                              grp_navigation.alignment = "right";
                              grp_navigation.cancelBtn = grp_navigation.add("button", undefined, "annuler", {name:"cancel"});
                              grp_navigation.okBtn = grp_navigation.add("button", undefined, "lancer le script", {name:"ok"});
                              //-------------------------- functions ----------------------------
                              cible_bitmap_pan.cibleBitmap.onChange = function(){
                                  is_textfield_valid (this, "1200", "vous devez saisir un nombre entier");
                              }
                              
                              cible_raster_pan.cibleRaster.onChange = function(){
                                  is_textfield_valid (this, "300", "vous devez saisir un nombre entier");
                              }
                          
                          
                              limite_bitmap_pan.limitBitmap.onChange = function(){
                                  is_textfield_valid (this, "1000", "vous devez saisir un nombre entier")
                              }
                              
                              limite_raster_pan.limitRaster.onChange = function(){
                                  is_textfield_valid (this, "200", "vous devez saisir un nombre entier");
                              }
                          
                          
                              function is_textfield_valid(object, default_value_number, alert_str){
                                  if (!isInt(object.text)) {
                                      alert(alert_str);
                                      object.text = default_value_number;
                                  }
                                  if(parseInt (object.text) < 1){
                                      alert("vous devez saisir un nombre plus grand ou égal a 1");
                                      object.text = default_value_number;
                                  }
                              }
                              
                              function is_limitfield_valid(current_object, object_to_compare, default_value_number, alert_str){
                                  is_textfield_valid (current_object, default_value_number, alert_str);
                                  if(parseInt(current_object.text)){
                                      
                                  }
                              }
                              
                              function isInt(n) {
                                  return parseFloat(n) == parseInt(n, 10) && !isNaN(n);
                              }
                              
                              ignored_pan_button.addBtn.onClick = function() {
                                              var array_of_files = File.openDialog ("selectionner une image ou plusieurs images", get_file_filter ([".psd", ".png", ".jpg", ".eps"], "choisir une image"), true);
                                              if (array_of_files != null) {
                                       for(var index = 0; index<array_of_files.length; index++){
                                          if (!is_in_array(File.decode(array_of_files[index].name), myArray)) {
                                              var file_name = array_of_files[index].fsName.toLowerCase();
                                              var extension = file_name.slice(file_name.lastIndexOf ("."));
                                               if (extension == ".eps") {
                                                  var eps_img = new File(file_name);
                                                  if(is_raster_eps(eps_img)){
                                                      myArray.push(File.decode(array_of_files[index].name));
                                                  }
                                                  else{
                                                      alert("seule les fichiers eps de type image (non-vectorielle) peuvent être ajoutés");
                                                  }
                                               }
                                               else{
                                                  myArray.push(File.decode(array_of_files[index].name));
                                               }
                                          }
                                          else {
                                                                  alert("cette image a déjà été ajoutée");
                                          }
                                       }
                                       grp_ignored.remove(grp_ignored.listBox);
                                       grp_ignored.listBox = grp_ignored.add('listbox', myListBoxBounds, myArray, {multiselect:true});
                                       grp_ignored.listBox.bounds = myListBoxBounds;
                                       grp_ignored.margins = myListMargins;
                                              } 
                                    }
                              
                              ignored_pan_button.remAllBtn.onClick = function() {
                                              grp_ignored.listBox.removeAll();
                                              myArray = [];
                                    }
                          
                          
                              ignored_pan_button.removeBtn.onClick = function() {
                                              if (grp_ignored.listBox.selection != null) {
                                                        for (var i = grp_ignored.listBox.selection.length - 1; i  >= 0; i --) {
                                                                  myArray.splice(grp_ignored.listBox.selection[i].index, 1);
                                                                  grp_ignored.listBox.remove(grp_ignored.listBox.selection[i]);
                          
                          
                                                        }
                                              }
                                  else{
                                      alert("selectionner une image puis clicker sur le bouton supprimer image");
                                  }
                                    }
                              
                              //-------------------------- return values ----------------------------
                              var results = {};
                              // if show == 1 the user click run
                              if(win.show() == 1){
                                  // is the picture prop check or not
                                  if(prop_pan.rad1.value){
                                      results.isPictureProp = true;
                                  }
                                  else{
                                      results.isPictureProp = false;
                                  }
                                  // is the sous echantillonnage check
                                  if(ss_echantillonnage_pan.rad1.value){
                                      results.isSousEchantillonnage = true;
                                  }
                                  else{
                                      results.isSousEchantillonnage = false;
                                  }
                                  // is the sur echantillonnage check
                                  if(sur_echantillonnage_pan.rad1.value){
                                      results.isSurEchantillonnage = true;
                                  }
                                  else{
                                      results.isSurEchantillonnage = false;        
                                  }
                                  // return the target value, the validation is done during onChange event
                                  results.cibleBitmap = cible_bitmap_pan.cibleBitmap.text;
                                  results.cibleRaster = cible_raster_pan.cibleRaster.text;
                                  results.limitBitmap = limite_bitmap_pan.limitBitmap.text;
                                  results.limitRaster = limite_raster_pan.limitRaster.text;
                                  results.array_of_ignored_picture = myArray;
                              }
                              //else the script was canceled
                              else{
                                  results = null;
                              }
                              return results;
                          }
                          
                          
                          function get_file_filter(array_of_ext, prompt_str){
                              function return_filter(file){
                                  var is_valid = false;
                                  var index = 0;
                                  while(!is_valid){
                                          while (file.alias) {
                                              file = file.resolve();
                                              if (file == null) { 
                                                  is_valid = false 
                                              }
                                          }
                                          if (file.constructor.name == "Folder") {
                                              is_valid= true;
                                          }
                                          else{
                                              var extension = file.name.toLowerCase().slice(file.name.lastIndexOf("."));
                                              if (extension.indexOf (array_of_ext[index]) > -1 ){
                                                  is_valid = true;
                                              }
                                          }
                                          index++;
                                      if(index>=array_of_ext.length){
                                          break;
                                      }
                                  }
                                  return is_valid;
                              }
                              return return_filter;
                          }