0 Replies Latest reply on Mar 22, 2011 4:22 AM by BaldandAngry

    textimage.position - VB script issues

    BaldandAngry

      Hi guys,

       

      Long time listener, first time caller.

       

      Ok, so I'm working on a small application for the retail company I work for. I've written several in the past to perform basic repetitive functions... with great success. Unfortunately, this is the first one I've ever tried automating Photoshop with.

       

      Scenario:

      Open Photoshop. - Done

      Open a JPEG at a given location. - Done

      Resize the image to an A4 page. - Done

      Write a line of text at a specific location. - Not working

       

      I can get it to write a line, in a particular font size, and sometimes in a specific font (although not always). The problem I'm having is getting the text layer to appear at a specific location on the sheet... say 11cm from top, 6cm from left. I've read the scripting guide, and googled for hours. The only line of code I can find mentions an array... which instantly causes a generic error.

       

      <code>

       

              textColor = CreateObject("Photoshop.SolidColor")
              textColor.RGB.Red = 0
              textColor.RGB.Green = 0
              textColor.RGB.Blue = 0


              artLayerRef = currentDoc.ArtLayers.Add

       

              layerKind = 2
              artLayerRef.Kind = layerKind


              textItemRef = artLayerRef.TextItem
              textItemRef.position = Array(11, 6) 'The line generating the error. Comment it out, and everything works fine.
              textItemRef.Contents = "PANASONIC"
              textItemRef.Size = 100
              textItemRef.Color = textColor

       

      </code>

       

      Any clues?

       

      Sincerely,

      Bald and Angry