3 Replies Latest reply on Mar 21, 2012 11:54 PM by c.pfaffenbichler

    Determining if a text box was transformed

    StephanPeterson

      I'm trying to find a way to determine if a text box has been transformed. Thus far I've been able to find a way to do so. Any helps would be greatly appreciated.

       

      I did my best to look through the archive and couldn't find an answer to this. If I missed it, my apologies.

       

      Thanks,

      Stephan

        • 1. Re: Determining if a text box was transformed
          c.pfaffenbichler Level 9

          Could you give this a try?

          Mind you, this only checks for Transformations, not Warped Text!

           

          // check if text layer has been transformed;
          // based on code by michael l hale;
          // 2012, use it at your own risk;
          #target photoshop
          if (app.documents.length > 0) {
          var myDoc = app.activeDocument;
          if (myDoc.activeLayer.kind == LayerKind.TEXT) {
          var ref = new ActionReference();
          ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
          var layerDesc = executeActionGet(ref);
          var textDesc = layerDesc.getObjectValue(stringIDToTypeID('textKey'));
          try {
                    var theTransform = textDesc.getObjectValue(textDesc.getKey(3));
                    alert ("text layer has been transformed")
                    }
          catch (e) {alert ("text layer has not been transformed")};
          }
          else {alert ("not text")};
          };
          
          1 person found this helpful
          • 2. Re: Determining if a text box was transformed
            StephanPeterson Level 1

            It seems to work, thank you.

             

            Can you help me understand how it's making the determination? I'm an AppleScript guy but am slowly learning JS as needed.

             

            Thanks,

            Stephan

            • 3. Re: Determining if a text box was transformed
              c.pfaffenbichler Level 9

              The Script tries to get the Descriptor for Transform from the Text Descriptor.

              If there is none the try-clause fails and the alert is presented.