I would not have thought your path was valid have you tried to just test that condition on its own?
alert ( File("/temp/testfile1.pdf").exists );
Thanks for that reply
Well I definitly think your right on this one but where does the path begin. When I removed the app.documents.length from the if statement it went to the alert() function.
If I start the path with / it should start from where the original file is right?
/ always starts at the root of your current drive. What *that* means depends on your OS!
You'd get the path from your current file by something like
currPath = app.activeDocument.path;
.. then you can add your temp folder with
embedDoc = new File(currPath+'/temp/testfile.pdf");
.. but *only* if that sub-folder actually exists in the path you stored the file in. The actual code depends entirely on your workflow, I guess.
Are you debugging your script in the ESTK or just writing it in a text editor? What OS are you on? Where is this PDF file? ( the full path )