If I use the code below - I receive no errors:
#target photoshop var fileToParse = File (Folder.desktop + '/PhotoshopColor.txt'); fileToParse.open('r'); var NewColor = fileToParse.readln(); fileToParse.close(); app.foregroundColor.rgb.hexValue=NewColor;
However, when I move the txt file to a different location, and then change the code to that below - I receive an error saying Exception:SyntaxError: Expected: )
#target photoshop var fileToParse = File (/Users/richard/Library/Application\ Support/Test\ Data/PhotoshopColor.txt); fileToParse.open('r'); var NewColor = fileToParse.readln(); fileToParse.close(); app.foregroundColor.rgb.hexValue=NewColor;
It seems to be telling me that a close parenthesis is missing, but my code seems to indicate otherwise.
Can anyone please help me?
Thank you all in advance.
Fixed it myself - I needed to surround the path in quote marks
It should be within quote and use only forward slashs.
var fileToParse = File ("/Users/richard/Library/Application/Support/Test/Data/PhotoshopColor.txt");
I used backslashes as there are spaces in the file name (Application Support, and Test Data), therefore the backslashes are required on OS X