13 Replies Latest reply on Jul 21, 2016 2:14 PM by RicSum

    Set color from a .txt file?

    RicSum Level 1

      Hi,

      I have a .txt file on my desktop which only contains 1 line of text:    #79a3d2

       

      I also have the following code inside a .jsx file"

       

      var fileToParse = File ('/Desktop/Photoshop.txt');
      fileToParse.open('r');
      var NewColor = fileToParse.readln();
      fileToParse.close();
      
      var color = app.foregroundColor;
      color.RGBColor.hexValue=NewColor;
      app.foregroundColor = color;
      

       

       

      I am trying to change the foreground color to the hexadecimal code inside the text file, but I receive an error saying "Undefined is not an object"?

       

      Can someone please tell me what is wrong with my code (in layman terms)?

       

      Thank you all in advance.