0 Replies Latest reply on Jul 9, 2010 3:41 AM by Ghoulfool

    Simple UI test

    Ghoulfool Level 1

      I've managed to get check boxes working. No vast feat I know but I'm happy with it!

       

      Feast your eyes on the incredible red or grey box script!

       

      /// simple UI script that creates an image and fills it red or grey

       

      preferences.rulerUnits = Units.PIXELS

       


      var dlg=
      "dialog{text:'Script Interface',bounds:[100,100,280,250],"+
      "panel0:Panel{bounds:[10,10,170,140] , text:'Fill that box ' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+
      "redcheck:Checkbox{bounds:[30,30,120,51] , text:'Change to red' },"+
      "exit:Button{bounds:[30,90,130,110] , text:'Cancel' },"+
      "fill:Button{bounds:[30,60,130,80] , text:'Fill it!' },"+
      "},"+
      "};"

       

      var ColorRef = new SolidColor;
      ColorRef.rgb.hexValue="A6A6A6"

       

      var win = new Window(dlg,'Simple Window');
      win.center();

       

      win.panel0.exit.onClick = function(){
      win.close(1);
      }

       

      win.panel0.redcheck.onClick = function(){
        if (win.panel0.redcheck.value){
           ColorRef.rgb.hexValue="DD0022";
        } else {
           ColorRef.rgb.hexValue="A6A6A6";
        }
      }

       

      win.panel0.fill.onClick = function(){

       

      var docRef = documents.add(100, 100, 72.0);

       

      app.activeDocument.selection.fill(ColorRef)

       


      win.close(1);
      }

       


      win.show();