2 Replies Latest reply on Nov 25, 2014 6:58 AM by ClayNasty

    Different results running the same Javascript - CC vs CS6


      I'm having some issues setting a text field's font size using Javascript. For some reason I always get 2.88 point font as opposed to what I set it at (in this case it's 12). Anyone know what is wrong here and why PS isn't recognizing the command to set the font size?


      #9740928 - Pastie



      Line 42 is where I'm setting the size.


      Line 27 is where the variable is defined. I've tried just punching in an integer with the same results.



      Thank you for any help.

      So I think there might be an issue with Adobe CC or perhaps some changes in it's developement as far as how it's handling Javascript. I've ran multiple tests today and did some reading. At the end of the line I decided to try the script out on CS6 and I got the correct results. So the script works on CS6, but not CC? I made an example script that I did my tests on for the Adobe team to take a peak at. It's at the end of this post.

      I'm no script master by any stretch of the imagination, but I find it odd that this script works properly on Adobe CS6, but does not modify the font size correctly on Adobe CC. I'd expect that same results. If any of you come up with anything please let me know. Cheers.




      var defaultRulerUnits = preferences.rulerUnits;

      preferences.rulerUnits = Units.PIXELS;


      var AD = activeDocument ;


      theSize = 53;


      var TextLayer = AD.artLayers.add();

            TextLayer.kind = LayerKind.TEXT;

            TextLayer.opacity = 90;


             var txtRef = TextLayer.textItem;

                  txtRef.font = "Impact";

                  txtRef.contents = theSize;  //The defined size of 53 is reflected accurately in CS6 but when this script is ran on CC it is not. Sometimes it's 12, sometimes it's 2.88.

                  txtRef.size = theSize;



      ^I'm saving this as a .JS



      Message was edited by: Clayton Krause