In Photoshop I can read in a text file.
var lines = "";
var aFile = new File(f);
var line = aFile.readln();
if (line != null && line.length >0)
lines += line + "\n";
if (lines.length == 0)
alert(f + "\ndoes not exist!");
var trunc = lines.substring(0,256);
alert(f + " exists!\nHere's proof:\n\n" + trunc + "...")
Is a Boolean not a function
Boolean exists Read only Property
If true, this object refers to a file or file-system alias that actually exists in the file system.
Update: Actually "Mr. Mystery Guest" is right (see comments).
returns true for me on macOS 10.12.2 and PS CC2017 even though the file does not exists. Using
seems to work as excepted.
This error seems to be a Photoshop specific problem. In ESTK and in InDesign
File('~/Desktop/does-not-exist.txt').exists returns false