0 Replies Latest reply on Aug 18, 2010 7:42 AM by Kazan7

    What is the best way to automate button creation for web

    Kazan7

      I am trying to make a script that will enable me to quickly create standardized buttons.

       

      I want to specify the text, then have the script apply a consistent style and dimensions.

       

      I'd also like it to create the rollover, click, and disable states, and I'd like it to
      save the files as GIF.

       

      I am new to scriptign in Photoshop.  This is what I have come up with so far:

       

      var c = new SolidColor();
      c.rgb.red = 0;
      c.rgb.green = 255;
      c.rgb.blue = 0;
      var newTextLayer = activeDocument.artLayers.add();
      newTextLayer.kind = LayerKind.TEXT;
      newTextLayer.textItem.font = "Georgia";
      newTextLayer.textItem.size = 20; // points, not pixels
      newTextLayer.textItem.contents = "Continue Shopping";
      newTextLayer.textItem.color = c;
      newTextLayer.textItem.position = Array(10, 20);
         
      var LB=newTextLayer.bounds;
      var textBackLayer = activeDocument.artLayers.add();
      newTextLayer.move( activeDocument.activeLayer,  ElementPlacement.PLACEBEFORE)
      var Height = LB[3].value - LB[1].value;
      var Width = LB[2].value - LB[0].value;
      activeDocument.selection.select([[LB[0],LB[1]], [LB[2],LB[1]], [LB[2],LB[3]], [LB[0], LB[3]]], SelectionType.REPLACE, 0, false);

       

      //Background fill colour.
      var FillColor = new SolidColor;
      FillColor.rgb.hexValue = 'ffff00';
      activeDocument.selection.fill(FillColor);
      activeDocument.selection.deselect();

       

      However, I was wondering if there is an example out there that I could start with, or look at.

       

      Thanks.