3 Replies Latest reply on May 19, 2014 10:26 PM by Jump_Over

    function on active page with a window with ScriptUI

    JulienFR

      Hi,

      I don't know why the button function doesn't work on my active page.

      perhaps probleme of target engine.

       

      I try to do action BEFORE to active parameters in windows.

      I thank create dialog box with UI nativ Dialog of type ....var myDialog = app.dialogs.add({name:'Toold',canCancel:true});

      but it's most difficult to create a window with UI nativ that ScriptUI..

       

      so :

       

       

      #targetengine "mySession"

      var myDocument=app.activeDocument;

      var myPage = app.activeWindow.activePage;

       

      var w = new Window ("dialog","Tools");

      var titreGrande = w.add ("checkbox", undefined, "Grande Puce");

      titreGrande.graphics.font = "Tahoma-Bold:12";

      titreGrande.value = true;

      var buttonF1 = w.add ('button', undefined, 'Valider');

      var buttonCancel = w.add ('button', undefined, 'Annuler');

       

      // OK button

      buttonF1.onClick = function ()

      {

       

      // condition if checkbox ?

      // problem !!

       

      // if checkbox True

       

      myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.MILLIMETERS;

      myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.MILLIMETERS;

       

      var myColor = myDocument.colors.item('PUCE');

      try {myName = myColor.name;}

      catch (myError)

      {myColor = myDocument.colors.add({name:'PUCE', model:ColorModel.process,colorValue:[0,100,100,0]});}

       

      alert(myError); // problem !!

       

       

              w.destroy(); //not necessary..

      }

       

       

      // cancel button

      buttonCancel.onClick = function()

          {

          w.close();

      }

       

       

      w.show ();